witam,
napisalem serwer wsdl w php:
<?php //identification.php
ini_set('soap.wsdl_cache_enabled', 0
);
$Server = new SoapServer("serwer.wsdl");
if(!$HTTP_RAW_POST_DATA){
$Server->fault('Client', 'Invalid Request');
return;
}
$Server->setClass('klasa');
$Server->handle();
class klasa
{
...
}
?>
plik z serwer.wsdl wyglada nastepujaco:
<?xml version="1.0" encoding="utf-8"?>
<definitions
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://localhost/serwer"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://localhost/serwer">
<types>
<schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://localhost/serwer">
<!-- Function arguments -->
<complexType name="RequestType">
<sequence>
<element name="aaa" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<element name="bbb" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<element name="ccc" type="xsd:string" minOccurs="1" maxOccurs="1"/>
</sequence>
</complexType>
<!-- Function returns -->
<complexType name="ResponseType">
<sequence>
<element name="ddd" type="xsd:string" />
<element name="eee" type="xsd:string" />
</sequence>
</complexType>
<!-- Actual Elements -->
<element name="Request" type="tns:RequestType" />
<element name="Response" type="tns:ResponseType" />
</schema>
</types>
<!-- Messages Details -->
<message name="Request">
<part name="parameters" element="tns:Request" />
</message>
<message name="Response">
<part name="parameters" element="tns:Response" />
</message>
<!-- Port Type -->
<portType name="serwerPortType">
<operation name="identification">
<input message="tns:Request" />
<output message="tns:Response" />
</operation>
</portType>
<!-- Binding -->
<binding name="serwerBinding" type="tns:serwerPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="identification">
<soap:operation soapAction="" style="document" />
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<!-- Service details -->
<service name="serwer">
<port name="serwerPort" binding="tns:serwerBinding">
<soap:address location="http://localhost/identification.php"/>
</port>
</service>
</definitions>
wywolujac wsdl poprzez PHP:
<?php
ini_set('soap.wsdl_cache_enabled', 0
);
$client = new SoapClient
(serwer
.wsdl
, array('soap_version' => SOAP_1_2
));
$Return = $client->identification($input);
?>
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!