Нужно отправлять WSDL клиенту два параметра Result и Comments в виду ответа через WSDL сервера
WSDL файл stockquote1.wsdl:
<?xml version ='1.0' encoding ='UTF-8' ?>
<definitions name='StockQuote'
targetNamespace='http://example.org/StockQuote'
xmlns:tns=' http://example.org/StockQuote '
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>
<message name='getQuoteRequest'>
<part name="Data" type="xs:string"/>
<part name="Signature" type="xs:string"/>
<part name="PublicCert" type="xs:string"/>
<part name="SignDate" type="xs:dateTime"/>
</message>
<message name='getQuoteResponse'>
<part name='Result' type='xsd:float'/>
<part name="Comments" type="xs:string"/>
</message>
<portType name='StockQuotePortType'>
<operation name='getQuote'>
<input message='tns:getQuoteRequest'/>
<output message='tns:getQuoteResponse'/>
</operation>
</portType>
<binding name='StockQuoteBinding' type='tns:StockQuotePortType'>
<soap:binding style='rpc'
transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='getQuote'>
<soap:operation soapAction='urn:xmethods-delayed-quotes#getQuote'/>
<input>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</input>
<output>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</output>
</operation>
</binding>
<service name='StockQuoteService'>
<port name='StockQuotePort' binding='StockQuoteBinding'>
<soap:address location='http://localhost/wsdl1/server1.php'/>
</port>
</service>
</definitions>
Server1.php:
global $quotes1;
class QuoteService {
private $quotes1 = array("ok" => 1, 'error'=>0);
function getQuote($Data, $Signature, $PublicCert, $SignDate) {
global $quotes1;
if (isset($Data)) {
return $quotes1['ok'];
}
}
}
$server = new SoapServer("stockquote1.wsdl",array(
"exceptions" => 1,
'style' => SOAP_DOCUMENT,
'use' => SOAP_LITERAL,
'soap_version' => SOAP_1_2,
'encoding' => 'UTF-8'
));
$server->setClass("QuoteService");
$server->handle();
Client1.php:
$ibm = array('Data'=>array('adress'=>'Tashkent', 'house'=>74), 'Signature'=>'Signature', 'PublicCert'=>'PublicCert', 'SignDate'=>date('d-m-Y'));
$client = new SoapClient("stockquote1.wsdl",array(
"trace" => 1,
"exceptions" => 1,
'style' => SOAP_DOCUMENT,
'use' => SOAP_LITERAL,
'soap_version' => SOAP_1_2,
'encoding' => 'UTF-8'
)
);
print($client->__call('getQuote', $ibm));
print "<pre>\n";
print "Запрос :\n".htmlspecialchars($client->__getLastRequest()) ."\n";
print "Ответ:\n".htmlspecialchars($client->__getLastResponse())."\n";
print "</pre>";