我必须开发一个.NET API到工作PHP SOAP服务,但我只有一个WSDL文件,指定服务属性。使用WCF调用PHP SOAP服务
当我试图让与WSDL文件,它不工作,在Visual Studio中的服务引用,一个错误发生:
“响应消息的内容类型text/plain的不匹配 内容类型的结合(应用/肥皂+ xml的;字符集= UTF-8)。 如果使用定制的编码器,可以肯定的是,IsContentTypeSupported 方法被适当地实现“
当我打开。在Visual Studio中的WSDL,intellisense有< xs的问题:序列号>在<类型>,它表示:“名称空间前缀'xs'未定义” - 也许这里有点问题,但我不说WSDL ....
这里是WSDL文件:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="ProtopmailApiWorld"
targetNamespace="urn:ProtopmailApiWorld"
xmlns:tns="urn:ProtopmailApiWorld"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:API">
<xsd:complexType name="arrayOfStrings">
<xs:sequence>
<xs:element name="TheStringValue" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xsd:complexType>
<xsd:element name="outResponse" type="xsd:string" />
</xsd:schema>
</types>
<message name="ApiSoap">
<part name="params" type="tns:arrayOfStrings" />
</message>
<message name="ApiSoapResponse">
<part name="return" type="tns:outResponse" />
</message>
<portType name="APIPort">
<operation name="ApiSoap">
<input message="tns:ApiSoap" />
<output message="tns:ApiSoapResponse" />
</operation>
</portType>
<binding name="APIBinding" type="tns:APIPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="ApiSoap">
<soap:operation soapAction="urn:ApiSoapAction" />
<input>
<soap:body use="encoded" namespace="urn:API" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="urn:API" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="ApiSoapService">
<port name="APIPort" binding="tns:APIBinding">
<soap:address location="https://website/api/soap.php" />
</port>
</service>
感谢
谢谢,现在我可以添加服务参考。但我不能创建任何变量来使用它,甚至有可能使用wcf这种方式使用php肥皂服务?我的意思是这里没有任何端点定义。 –
我现在看到这个服务是rpc /编码的。我建议使用.net 2客户端,而不是wcf,例如“添加Web引用”而不是“添加服务引用” –
这里是如何添加Web服务引用http://webservices20.blogspot.co.il/2008/10/interoperability-gotcha-visual-studio.html –