C# 如何使用“调用”从visual studio调用php服务;添加服务参考“;
我想从c#桌面应用程序中使用php服务。我通过“添加服务引用”将php服务添加到我的项目中,但我看不到来自方法的正确响应。这就是php服务wsdlC# 如何使用“调用”从visual studio调用php服务;添加服务参考“;,c#,php,add,service-reference,C#,Php,Add,Service Reference,我想从c#桌面应用程序中使用php服务。我通过“添加服务引用”将php服务添加到我的项目中,但我看不到来自方法的正确响应。这就是php服务wsdl <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns:SOAP-ENV = "http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd = "http://www.w3.org/2001/XMLSch
<?xml version="1.0" encoding="UTF-8"?>
<definitions
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/"
xmlns:tns = "urn:Invest"
xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl = "http://schemas.xmlsoap.org/wsdl/"
xmlns = "http://schemas.xmlsoap.org/wsdl/"
targetNamespace = "urn:Invest">
<types>
<xsd:schema elementFormDefault = "qualified" targetNamespace = "urn:Invest">
<xsd:import namespace = "http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:import namespace = "http://schemas.xmlsoap.org/wsdl/"/>
<xsd:complexType name = "ReturnItems">
<xsd:sequence>
<xsd:element
name = "itemName"
type = "xsd:string"
minOccurs = "0"
maxOccurs = "unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<message name = "ShowDataRequest">
<part name = "no" type = "xsd:string"/>
<part name = "user_name" type = "xsd:string"/>
</message>
<message name = "ShowDataResponse">
<part name = "return" type = "tns:ReturnItems"/>
</message>
<portType name = "InvestPortType">
<operation name = "ShowData">
<input message = "tns:ShowDataRequest"/>
<output message = "tns:ShowDataResponse"/>
</operation>
</portType>
<binding name = "InvestBinding" type = "tns:InvestPortType">
<soap:binding style = "document" transport = "http://schemas.xmlsoap.org/soap/http"/>
<operation name = "ShowData">
<soap:operation soapAction = "urn:Invest#ShowData" style = "rpc"/>
<input>
<soap:body use = "literal" namespace = "urn:Invest"/>
</input>
<output>
<soap:body use = "literal" namespace = "urn:Invest"/>
</output>
</operation>
</binding>
<service name = "Invest">
<port name = "InvestPort" binding = "tns:InvestBinding">
<soap:address location = "http://test.com.tr/service.php"/>
</port>
</service>
</definitions>
当我通过“添加服务引用”从vs2010调用ShowData方法时,响应类型为String[]并始终返回String[0]。此外,我在SoapUi中使用相同的参数调用此方法。根据以下结果返回给我:
请求SoapUi:
<soapenv:Envelope xmlns:soapenv = "http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn = "urn:Invest">
<soapenv:Header/>
<soapenv:Body>
<urn:ShowData>
<no>475</no>
<user_name>7302AEKI</user_name>
</urn:ShowData>
</soapenv:Body>
475
7302AEKI
响应SoapUi:
<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>
<ns1:ShowDataResponse xmlns:ns1 = "urn:Invest">
<return>
<item>
<TAP>
<kod>
<item>768</item>
</kod>
</TAP>
</item>
<item>
<BASV>
<SUB>10</SUB>
</BASV>
</item>
<item>
<BASV>
<SIRK/>
</BASV>
</item>
<item>
<BASV>
<BASV_NO/>
</BASV>
</item>
<item>
<aaa>bbb</aaa>
</item>
</return>
</ns1:ShowDataResponse>
</SOAP-ENV:Body>
768
10
bbb
因此,是否可以通过“添加服务引用”或其他方式从VS2010调用此服务
谢谢。据我所知,WSDL和实际响应不匹配。要获得预期的响应,请修复WSDL或响应