使用 SOAP 访问 Web 服务 - 在 soapclient() 上失败
Posted
技术标签:
【中文标题】使用 SOAP 访问 Web 服务 - 在 soapclient() 上失败【英文标题】:Using SOAP to access webservices - failing on soapclient() 【发布时间】:2010-10-10 02:49:22 【问题描述】:我在使用 soapclient($myUrl); 时收到以下错误;
SOAP 错误:解析 WSDL
如果直接访问 WSDL 链接,我会看到以下内容。
http://services" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://services" xmlns:intf="http://services" xmlns:soapenc ="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://rpc.xml.coldfusion" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema"> http://服务"/> http://rpc.xml.coldfusion"/> http://schemas.xmlsoap.org/soap/encoding/"/>
<element name = "key" nillable="true" type="xsd:anyType"/>
<element name = "value" nillable="true" type="xsd:anyType"/>
</sequence>
</complexType>
<complexType name = "Map">
<sequence>
<element maxOccurs = "unbounded" minOccurs="0" name="item" type="apachesoap:mapItem"/>
</sequence>
</complexType>
</schema>
<schema targetNamespace = "http://rpc.xml.coldfusion" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace = "http://services"/>
<import namespace = "http://xml.apache.org/xml-soap"/>
<import namespace = "http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name = "CFCInvocationException">
<sequence/>
</complexType>
<complexType name = "QueryBean">
<sequence>
<element name = "columnList" nillable="true" type="impl:ArrayOf_xsd_string"/>
<element name = "data" nillable="true" type="impl:ArrayOfArrayOf_xsd_anyType"/>
</sequence>
</complexType>
</schema>
<schema targetNamespace = "http://services" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace = "http://xml.apache.org/xml-soap"/>
<import namespace = "http://rpc.xml.coldfusion"/>
<import namespace = "http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name = "ArrayOf_xsd_anyType">
<complexContent>
<restriction base = "soapenc:Array">
<attribute ref = "soapenc:arrayType" wsdl:arrayType="xsd:anyType[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name = "ArrayOf_xsd_string">
<complexContent>
<restriction base = "soapenc:Array">
<attribute ref = "soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name = "ArrayOfArrayOf_xsd_anyType">
<complexContent>
<restriction base = "soapenc:Array">
<attribute ref = "soapenc:arrayType" wsdl:arrayType="xsd:anyType[][]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name = "updateCampaignResponse">
<wsdl:part name = "updateCampaignReturn" type="xsd:boolean"/>
</wsdl:message>
【问题讨论】:
【参考方案1】:看起来该 WSDL 的第一部分被截断了。那只是复制/粘贴错误,还是实际上是您返回的错误?
如果这实际上是您返回的内容,那么您的问题就在那里。出于某种原因,您只能获得 WSDL 的“尾端”。
【讨论】:
以上是关于使用 SOAP 访问 Web 服务 - 在 soapclient() 上失败的主要内容,如果未能解决你的问题,请参考以下文章
SOA,Webservice,SOAP,REST,RPC,RMI的区别与联系
比较和对比 REST 和 SOAP Web 服务? [复制]
SOA,Webservice,SOAP,REST,RPC,RMI,JMS的区别与联系(转载)