2010-01-01 2 views
0

.NET (C#, WPF) 응용 프로그램에서 SOAP를 통해 PHP WebService에 연결해야합니다. 이 서비스에 대한 참조를 추가하면 일부 프록시가 생성되었습니다.SOAP : PHP WebService 및 .Net

var client = new someAPIPortTypeClient(); 
XmlNode[] response = client.status(arg1, arg2);  

내가 응답있어 :

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:nakopitel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> 
    <SOAP-ENV:Body> 
     <ns1:statusResponse> 
     <statusReturn xsi:type="ns2:Map"> 
      <item> 
       <key xsi:type="xsd:string">is_active</key> 
       <value xsi:type="xsd:boolean">true</value> 
      </item> 
      <item> 
       <key xsi:type="xsd:string">allow_add_paid</key> 
       <value xsi:type="xsd:boolean">false</value> 
      </item> 
      <item> 
       <key xsi:type="xsd:string">allow_search_free</key> 
       <value xsi:type="xsd:boolean">true</value> 
      </item> 
      <item> 
       <key xsi:type="xsd:string">allow_add_free</key> 
       <value xsi:type="xsd:boolean">true</value> 
      </item> 
     </statusReturn> 
     </ns1:statusResponse> 
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 
그것은 XmlNode[] 같은 해석

...

내가 얻을 수있는 방법은 일반 프록시 클래스가 함께 작동하도록 내가 몇 가지 기능을 호출

이 SOAP 서비스? 서비스 작성자에게 필요한 경우 변경하도록 요청할 수 있습니다.

업데이트. 상태 기능을위한 WSDL.

<?xml version='1.0' encoding='UTF-8'?> 

<definitions name="something" targetNamespace="urn:something" xmlns:typens="urn:something" 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/"> 
    <message name="status"> 
    <part name="terminal" type="xsd:integer"/> 
    <part name="code" type="xsd:string"/> 
    </message> 
    <message name="statusResponse"> 
    <part name="statusReturn" type="xsd:anyType"/> 
    </message> 
    <portType name="someAPIPortType"> 
    <operation name="status"> 
     <documentation> 
     Get status 
     </documentation> 
     <input message="typens:status"/> 
     <output message="typens:statusResponse"/> 
    </operation> 
    </portType> 
    <binding name="someAPIBinding" type="typens:someAPIPortType"> 
    <operation name="status"> 
     <soap:operation soapAction="urn:someAPIAction"/> 
     <input> 
     <soap:body namespace="urn:something" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 
     </input> 
     <output> 
     <soap:body namespace="urn:something" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 
     </output> 
    </operation> 
    </binding> 
    <service name="somethingService"> 
    <port name="someAPIPort" binding="typens:someAPIBinding"> 
     <soap:address location="http://something/soap/"/> 
    </port> 
    </service> 
</definitions> 
+0

wsdl 모양이 '양호'합니까? 나는 wsdl이 xsd와 같은 것을 가지고 있다고 확신 할 것이다 : any 또는 that like ... 당신은 아마 상대방의 사람이 그들이 당신에게 준 wsdl을 '고치는 법을 모른다면 당신 자신의 wsdl을 쓸 수있다. – dovholuk

+0

제 생각에, 당신 말이 맞습니다. 질문 텍스트에 WSDL 파일 조각을 추가했습니다. 가장 좋은 방법 (또는 가장 쉬운 방법)을 고치는 방법을 알고 있습니까? SOAP로 작업해야하는 것은 처음입니다. – aks

답변

2

짧게 길게 이야기하고 싶다면 원하는대로 작동 시키려면 올바른 WSDL을 정의해야합니다. XSD_ANY은 문제를 묻는 중입니다.

+0

Yeap, 나는 이미 이것을 이해했다. 예를 들어 MS Visual Studio에서 SOAP 서비스를 만들고 PHP 서비스에서 생성 된 WSDL 파일을 사용할 수 있습니다 ... 가장 간단한 솔루션 중 하나입니다. – aks