我已經定義與模式的WSDL:WSDL SOAP響應驗證
<xsd:schema elementFormDefault="unqualified"
targetNamespace="http://www.xpto.com/xpto">
和元素:
<xsd:element name="insertResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="sys_id"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="table"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="display_name"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="display_value"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="status"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="status_message"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="error_message"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
但是當我執行操作,並得到響應,了SoapUI表示,其無效:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<insertResponse xmlns="http://www.xpto.com/xpto">
<sys_id>something</sys_id>
<table>something</table>
<display_name>number</display_name>
<display_value>something</display_value>
<status>something</status>
</insertResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
soapUI的消息(具有線纏繞用於易讀性):
line 4: Expected element 'sys_id' instead of
'[email protected]://www.xpto.com/xpto' here in element
[email protected]://www.xpto.com/xpto
如果我將WSDL更改爲包含elementFormDefault="qualified"
,那麼在模式中,相同的響應是有效的。
這是爲什麼不響應的無效elementFormDefault="qualified"
,什麼是做了正確的方法是什麼?
而且產生針對該WSDL代碼不喜歡的響應或者與失敗:
Unmarshalling Error: unexpected element
(uri:\\"http://www.xpto.com/xpto\\", local:\\"sys_id\\"). Expected
elements are <{}table>,<{}display_value>,<{}display_name>,
<{}error_message>,<{}sys_id>,<{}status_message>,<{}status>
(同樣,包裹的可讀性線。)
使用Apache-CXF。
令人敬畏的答案,我想我明白了。謝謝 – GriffinHeart