我的 WSDL 中有以下定义
<wsdl:types>
<xs:schema targetNamespace="http://tryme.limes2.dev/interface/interface/schemas/types" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:l2="http://tryme.local.dev/interface/interface/schemas/types">
<xs:element name="AuthDataResponse">
<xs:annotation>
<xs:documentation>The response for authorization requests.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element ref="l2:SuccessResponse" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>Success result.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="token" type="xs:string" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>The token required for all actions.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="SuccessResponse">
<xs:complexType>
<xs:all>
<xs:element name="message" type="xs:string" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>The message returned by the server.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="success" type="xs:boolean" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>Success result.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
...
(WSDL 由 IBM Enterprise Architect 生成)
Zend_Soap_Server 在 WSDL 模式下运行并接受输入。我编写了一个小的 PHP 函数,它应该需要一个 AuthDataRequest 并返回一个 AuthDataResponse 对象,带有一个令牌(字符串)和 SuccessResponse 对象。
我从服务器得到的响应是:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tryme.local.dev/interface/interface/schemas/types">
<SOAP-ENV:Body>
<ns1:AuthDataResponse>
<SuccessResponse>
<message/>
<success>true</success>
</SuccessResponse>
<token>xVzSFnC5LmqJ4sNG</token>
</ns1:AuthDataResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
哪个失败了 SoapUIs Schema Compliance 测试,因为它给出了SuccessResponse而不是ns1:SuccessResponse。这里到底出了什么问题?您需要任何其他信息吗?
亲切的问候, tim3trick