我正在使用PHP SoapServer类,并尝试将纯XML放在SOAP响应的主体中 .
Case 1:
我的WSDL有
<element name="getDataResponse" type="xsd:string"/>
我编码响应
return new SoapVar($my_xml,XSD_ANYXML)
PHP SoapClient说
SOAP-ERROR: Encoding: Violation of encoding rules
Case 2:
WSDL
<element name="getDataResponse" type="xsd:string"/>
响应编码
return new SoapVar($my_xml,XSD_STRING)
响应XML全部<编码为&lt;和> as&gt;
Case 3:
WDSL
<element name="getDataResponse">
<complexType>
...
</complexType>
</element>
其中complexType对应要返回的XML结构
响应编码
return new SoapVar($my_xml,XSD_ANYXML)
现在返回类型是一个对象,而不是XML字符串
Case 4
除了编码为SOAP_ENC_OBJECT之外,与案例3相同 . 结果将是对象 .
请帮忙!我怎样才能将纯XML文本作为SOAP响应的主体?
1 回答
你试过这个吗?
还有其他解决方案at this PHP page . (见'User Contributed Notes'部分)