2012-09-28 6 views
0

C# desktop 응용 프로그램에서 PHP 서비스를 사용하고 싶습니다. "Add Service Reference"를 통해 프로젝트에 PHP 서비스를 추가했는데 올바른 응답을 볼 수 없습니다. 그것은 방법에서 왔습니다. 그것은 PHP 서비스 wsdl입니다;"Add Service Reference"를 사용하여 Visual Studio에서 PHP 서비스를 호출하는 방법

<?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에서으로 만들었 메서드를 호출 할 때 문자열을 반환 항상 문자열 []는 응답 유형 "서비스 참조 추가"[0] 내가 SoapUi.Return에서 같은 매개 변수이 메서드를 호출에 추가 .IN 나는 다음과 같은 결과를 보았다.

요청 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> 

응답 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> 

을 통해 VS2010에서이 서비스를 호출하려면 "추가 서비스 참조"그것은 가능하다 또는 무엇이 있어야 하는가?

감사합니다 .. 지금까지 내가 WSDL과 일치하지 않는 실제 응답을 볼 수

답변

0

. 응답을 얻으려면 WSDL 또는 응답을 수정해야합니다.