Soap 如何放置xlmns="&引用;作为回应
我有以下回应:Soap 如何放置xlmns="&引用;作为回应,soap,wsdl,Soap,Wsdl,我有以下回应: <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" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/
<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"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<Response xmlns="http://blahblahblah">
<SomeResult xmlns="">
<id>16</id>
<state>QUEQUE</state>
</SomeResult>
</Response>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
16
魁克
我需要知道如何从wsdl实现这一点:
<SomeResult xmlns="">
在wsdl中,我有以下内容:
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
[...] xlmns:tns="http://blahblahblah" targetNamespace="http://blahblahblah">
<types>
<xsd:schema elementFormDefault="qualified"
targetNamespace="http://blahblahblah">
[...]
<operation name="TheOperation">
<soap:operation soapAction="<anOperation>" style="document"/>
<input><soap:body use="literal" namespace="http://blahblahblah"/></input>
<output><soap:body use="literal" namespace="http://blahblahblah"/></output>
</operation>
[...]
<xsd:complexType name="TheOperationResponseType">
<xsd:all>
<xsd:element name="Response" type="tns:Response" form="unqualified"/>
</xsd:all>
</xsd:complexType>
[...]
<xsd:complexType name="Response">
<xsd:all>
<xsd:element name="id" type="xsd:int"/>
<xsd:element name="state" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
[...]
[...]
[...]
上下文:
老板给了我们wsdl,但有了它,我只能得到如下响应:
<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"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<Response xmlns="http://blahblahblah">
<SomeResult>
<id>16</id>
<state>QUEQUE</state>
</SomeResult>
</Response>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
16
魁克
还有。。。。老板不想更改代码以与原始wsd保持一致:(,因此我需要知道如何创建一个与其真实答案兼容的WSDL,而不是从原始WSDL中定义的WSDL
解决方案必须在wsdl中…独立于语言(因此,我们不能在客户机代码中使用Java注释之类的东西使其与响应兼容…这是我们的第一种方法;)。比如:
默认命名空间声明中的属性值可能为空。
在宣言的范围内,这与
没有默认名称空间
因此,如果希望在响应中获得空的xmlns声明,则需要:
- 设置默认名称空间 xmlns=“您的名称空间”
- 并将SomeResult元素调整到另一个名称空间
在WSDL中,您调整了默认名称空间并添加了以下设置:
xsd:schema elementFormDefault="qualified"
此设置意味着您在架构顶部声明的targetNamespace仅适用于符合架构的XML文档中的元素。但您明确声明不合格选项以响应元素
<xsd:element name="Response" type="tns:Response" form="unqualified"/>
在这种情况下,响应元素获取空命名空间。请检查没有此设置的soap响应消息