Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP][XML]integracja serwera WSDL z klientem w C#
Forum PHP.pl > Forum > Przedszkole
grogacki
witam,
napisalem serwer wsdl w php:

  1. <?php //identification.php
  2.  
  3. ini_set('soap.wsdl_cache_enabled', 0);
  4. global $HTTP_RAW_POST_DATA;
  5.  
  6. $Server = new SoapServer("serwer.wsdl");
  7.  
  8. if(!$HTTP_RAW_POST_DATA){
  9.    $Server->fault('Client', 'Invalid Request');
  10.    return;
  11. }
  12.  
  13. $Server->setClass('klasa');
  14. $Server->handle();
  15.  
  16.  
  17. class klasa
  18. {
  19.  
  20. ...
  21.  
  22. }
  23. ?>


plik z serwer.wsdl wyglada nastepujaco:

  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <definitions
  4.  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  5.  xmlns:tns="http://localhost/serwer"
  6.  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  7.  xmlns="http://schemas.xmlsoap.org/wsdl/"
  8.  targetNamespace="http://localhost/serwer">
  9.  
  10.      <types>
  11.  
  12.          <schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://localhost/serwer">
  13.      
  14. <!-- Function arguments -->
  15.                  <complexType name="RequestType">
  16.                        <sequence>
  17.                              <element name="aaa" type="xsd:string" minOccurs="1" maxOccurs="1"/>
  18.                              <element name="bbb" type="xsd:string" minOccurs="1" maxOccurs="1"/>
  19.                              <element name="ccc" type="xsd:string" minOccurs="1" maxOccurs="1"/>
  20.                        </sequence>
  21.                  </complexType>
  22.          
  23. <!-- Function returns -->
  24.                  <complexType name="ResponseType">
  25.                        <sequence>
  26.                              <element name="ddd" type="xsd:string" />
  27.                              <element name="eee" type="xsd:string" />
  28.                        </sequence>
  29.                  </complexType>
  30.      
  31. <!-- Actual Elements -->
  32.                  <element name="Request" type="tns:RequestType" />
  33.                  <element name="Response" type="tns:ResponseType" />
  34.          
  35.            </schema>
  36.      </types>
  37.      
  38. <!-- Messages Details -->
  39.      <message name="Request">
  40.            <part name="parameters" element="tns:Request" />
  41.      </message>
  42.  
  43.      <message name="Response">
  44.            <part name="parameters" element="tns:Response" />
  45.      </message>
  46.      
  47. <!-- Port Type -->      
  48.      <portType name="serwerPortType">
  49.            <operation name="identification">
  50.                  <input message="tns:Request" />
  51.                  <output message="tns:Response" />
  52.            </operation>
  53.      </portType>
  54.  
  55. <!-- Binding -->
  56.      <binding name="serwerBinding" type="tns:serwerPortType">
  57.            <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
  58.      
  59.            <operation name="identification">
  60.                  <soap:operation soapAction="" style="document" />
  61.                  <input>
  62.                        <soap:body use="literal"/>
  63.                  </input>
  64.                  <output>
  65.                        <soap:body use="literal"/>
  66.                  </output>
  67.            </operation>
  68.      </binding>
  69.  
  70. <!-- Service details -->      
  71.      <service name="serwer">
  72.            <port name="serwerPort" binding="tns:serwerBinding">
  73.                  <soap:address location="http://localhost/identification.php"/>
  74.            </port>
  75.      </service>
  76. </definitions>


wywolujac wsdl poprzez PHP:
  1. <?php
  2. ini_set('soap.wsdl_cache_enabled', 0);
  3.  
  4. $client = new SoapClient(serwer.wsdl, array('soap_version'   => SOAP_1_2));
  5.  
  6. $Return = $client->identification($input);
  7. ?>


wszystko dziala poprawnie.
niestety z tym serwerem probuje sie polaczyc skrypt napisany w C# i otrzymuje nastepujacy komunikat:

ER005 - Wystąpił wyjątek w trakcie identyfikowania klienta. Opis: Client found response content type of 'application/wsdl+xml', but expected 'application/soap+xml'.
The request failed with the error message:
i dalej wywala zawartosc pliku serwer.wsdl.

macie pojecie co moze byc nie tak z serwerem wsdl? a moze szukam w niewlasciwym miejscu.. moze blad lezy po stronie klienta C#? niestety mam go tylko w wersji exe wiec do kodu nie mam wgladu...

czekam na porady!
Darti
Może to Ci się przyda : http://devlicio.us/blogs/ziemowit_skowrons...nd-wse-3-0.aspx
erix
Tak nawiasem:
  1. <?php
  2. global $HTTP_RAW_POST_DATA;
  3. ?>

WTF?
grogacki
proponuje zakonczyc temat. problem nie byl zwiazany z kodem php tylko z blednym wywolaniem WS w C#
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.