Actually... let me try to be a little more useful to start. I really should start a blog with stuff like this... Let me give you an example of a SOAP client and a SOAP server.
SOAP client:
Code: Select all
$client = new SoapClient("https://localhost/OrderService.php?WSDL");
$send = array(
'batchID' => '',
'customerRequestID' => $FILE_NAME,
'orderStatus' => '',
'orders' => $t,
'password' => $password,
'username' => $username,
);
$res = $client->__soapCall("OrderEntry", array(array('Request' => $send)) );
// your could also do $res = $client->OrderEntry(array('Request' => $send)); but I still do it the old way
return ( $res->OrderEntryReturn->orderStatus == 10 );
Dummy SOAP server:
function OrderEntry($data){
$data = $data->Request;
$pwd = $data->password;
$uname = $data->username;
$batchId = $data->batchID;
$custID = $data->customerRequestID;
$ostat = $data->orderStatus;
$return->batchID = 'batch this';
$return->customerRequestID = 'some string 2';
$return->orderStatus = 10;
$response->OrderEntryReturn = $return;
return $response;
}
function Noop($data){
$data = $data->Noop;
$response->NoopResponse->NoopReturn = 'I Can Haz Cheezburger?';
return $response;
}
// this is a hack, there is some kung fu going on here which I don't want you to understand, but trust me
$server = new SoapServer('OrderEntrService.wsdl');
$server->addFunction('OrderEntry');
$server->addFunction('Noop');
$server->handle();
And now an example WSDL file for that...
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="
http://soap.service.com" xmlns:apachesoap="
http://xml.apache.org/xml-soap" xmlns:impl="
http://soap.service.pitney.com" xmlns:intf="
http://soap.service.com" xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="
http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="
http://soap.service.com" xmlns="
http://www.w3.org/2001/XMLSchema">
<element name="OrderEntry">
<complexType>
<sequence>
<element name="Request" type="impl:Request"/>
</sequence>
</complexType>
</element>
<complexType name="Request">
<sequence>
<element name="batchID" nillable="true" type="xsd:string"/>
<element name="customerRequestID" nillable="true" type="xsd:string"/>
<element name="orderStatus" nillable="true" type="xsd:string"/>
<element name="password" nillable="true" type="xsd:string"/>
<element name="username" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<element name="OrderEntryResponse">
<complexType>
<sequence>
<element name="OrderEntryReturn" type="impl:OrderEntryReturn"/>
</sequence>
</complexType>
</element>
<complexType name="OrderEntryReturn">
<sequence>
<element name="batchID" nillable="true" type="xsd:string"/>
<element name="customerRequestID" nillable="true" type="xsd:string"/>
<element name="orderStatus" nillable="true" type="xsd:string"/>
<element name="orders" nillable="true" type="impl:ArrayOfOrder"/>
</sequence>
</complexType>
<element name="Noop">
<complexType>
<sequence>
<element name="Noop" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="NoopResponse">
<complexType>
<sequence>
<element name="NoopReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="NoopResponse">
<wsdl:part element="impl:NoopResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="NoopRequest">
<wsdl:part element="impl:Noop" name="parameters"/>
</wsdl:message>
<wsdl:message name="OrderEntryResponse">
<wsdl:part element="impl:OrderEntryResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="OrderEntryRequest">
<wsdl:part element="impl:OrderEntry" name="parameters"/>
</wsdl:message>
<wsdl:portType name="OrderEntrServicePortType">
<wsdl:operation name="OrderEntry">
<wsdl:input message="impl:OrderEntryRequest" name="OrderEntryRequest"/>
<wsdl:output message="impl:OrderEntryResponse" name="OrderEntryResponse"/>
</wsdl:operation>
<wsdl:operation name="Noop">
<wsdl:input message="impl:NoopRequest" name="NoopRequest"/>
<wsdl:output message="impl:NoopResponse" name="NoopResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="OrderEntrServiceBinding" type="impl:OrderEntrServicePortType">
<wsdlsoap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="OrderEntry">
<wsdlsoap:operation soapAction="OrderEntry"/>
<wsdl:input name="OrderEntryRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="OrderEntryResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Noop">
<wsdlsoap:operation soapAction="Noop"/>
<wsdl:input name="NoopRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="NoopResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="OrderEntrServiceService">
<wsdl:port binding="impl:OrderEntrServiceBinding" name="OrderEntrServicePort">
<wsdlsoap:address location="
https://localhost/OrderService.php"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Admittedly... I had to cut this down, but it should help you out.