ASP.NET ile bir PHP SOAP WebService Tüketmek

1 Cevap ûnet

Ben ASP.NET kullanarak benim PHP SOAP webservice tüketmek çalışırken bazı önemli sorunları yaşıyorum. Söz Webcoder PHP SOAP uzantısı dayalı ve aşağıdaki WSDL tarafından tanıtılıp edilir:

<?xml version="1.0" encoding="UTF-8" ?>
<definitions name="MyServices"
  targetNamespace="http://mydomain.com/api/soap/v11/services"
  xmlns:tns="http://mydomain.com/api/soap/v11/services"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsd1="http://mydomain.com/api/soap/v11/services"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns="http://schemas.xmlsoap.org/wsdl/">

<types>
    <schema targetNamespace="http://mydomain.com/api/soap/v11/services" xmlns="http://www.w3.org/2001/XMLSchema">
        <complexType name="ServiceType">
            <all>
                <element name="id" type="xsd:int" minOccurs="1" maxOccurs="1" />
                <element name="name" type="xsd:string" minOccurs="1" maxOccurs="1" />
                <element name="cost" type="xsd:float" minOccurs="1" maxOccurs="1" />
            </all>
        </complexType>
        <complexType name="ArrayOfServiceType">
            <all>
                <element name="Services" type="ServiceType" minOccurs="0" maxOccurs="unbounded" />
            </all>
        </complexType>
    </schema>
</types>


<message name="getServicesRequest">
    <part name="postcode" type="xsd:string" />
</message>

<message name="getServicesResponse">
  <part name="Result" type="xsd1:ArrayOfServiceType"/>
</message>

<portType name="ServicesPortType">
  <operation name="getServices">
    <input message="tns:getServicesRequest"/>
    <output message="tns:getServicesResponse"/>
  </operation>
</portType>

<binding name="ServicesBinding" type="tns:ServicesPortType">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
  <operation name="getServices">
    <soap:operation soapAction="http://mydomain.com/api/soap/v11/services/getServices" />
    <input>
      <soap:body use="encoded" namespace="urn:my:services" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
    </input>
    <output>
      <soap:body use="encoded" namespace="urn:my:services" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
    </output>
  </operation>
</binding>

<service name="MyServices">
  <port name="ServicesPort" binding="tns:ServicesBinding">
    <soap:address location="http://mydomain.com/api/soap/v11/services"/>
  </port>
</service>
</definitions>

Ben başarıyla Visual Studio bu WSDL bir proxy sınıf oluşturmak, ancak getServices yöntemini çağırmaya çalışırken üzerine ben bir istisna ile sunulan am:

System.Web.Services.Protocols.SoapHeaderException: Procedure 'string' not present

SOAP sunucu sonunda ham post verileri inceledikten sonra, benim PHP SOAP istemci bu gibi istekleri yapıyor:

<?xml version="1.0" encoding="UTF-8"?>
<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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
        <postcode xsi:type="xsd:string">ln4 4nq</postcode>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

. Net proxy sınıfı bu yapıyor oysa:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:tns="http://mydomain.com/api/soap/v11/services" 
    xmlns:types="http://mydomain.com/api/soap/v11/services/encodedTypes" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <xsd:string xsi:type="xsd:string">LN4 4NQ</xsd:string>
    </soap:Body>
</soap:Envelope>

Ben sadece sorun burada yatıyor posta kodu parametre gönderiliyor şekilde fark varsayabiliriz, ama öncelikle bir PHP geliştiricisi Burada meydana ne gibi bir kaybı yaşıyorum. Ben sadece ben sayısız örneklerini gördüğümüz gibi benim WSDL önemli bir şeyin eksik bir his var 'ile PHP SOAP WebServices tüketmek. Net' bu sadece çalışır 'önermek göründükleri.

Ben burada geçtik nereye kadar herhangi bir öneri büyük mutluluk duyacağız. Şu anda artık bu neredeyse bütün bir gün geçirdim ;-)

Teşekkür peşin,

Jamie

1 Cevap

Ben henüz bunun için yeterince itibar yok tarafından yerine bir yorumun bir cevap için özür dilerim ...

Sen soap-UI (onlar ücretsiz bir sürümü var) ile webservice test denemelisiniz, bu yüzden sorun, istemci tarafı veya sunucu tarafı olup olmadığını bileceksiniz.