WSF/PHP with doc-lit bare WSDLs

Wednesday, April 16, 2008

You may use doc-lit bare WSDL to send a web service request with just one simple parameter in the message, like this.

In order to prepare this message with wsdl mode in WSF/PHP you can directly input the parameter value without instantiate any wrapper classes. Just take look at the following doc-lit bare WSDL and the corresponding WSDL-mode client to have an idea how easy it is.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl=""


xmlns:soap="" targetNamespace="">

<xs:schema xmlns:tns=""
elementFormDefault="qualified" targetNamespace="">

<xs:element name="echoInt" type="xs:int"/>
<xs:element name="echoIntResponse" type="xs:int"/>

<wsdl:message name="echoIntRequest">
<wsdl:part name="parameters" element="ns0:echoInt"/>

<wsdl:message name="echoIntResponse">
<wsdl:part name="parameters" element="ns0:echoIntResponse"/>

<wsdl:portType name="EchoServicePortType">
<wsdl:operation name="echoInt">

<wsdl:input message="ns0:echoIntRequest" wsaw:Action="urn:echoInt"/>
<wsdl:output message="ns0:echoIntResponse" wsaw:Action="urn:echoIntResponse"/>

<wsdl:binding name="EchoServiceSOAP12Binding" type="ns0:EchoServicePortType">

<soap12:binding transport="" style="document"/>
<wsdl:operation name="echoInt">

<soap12:operation soapAction="urn:echoInt" style="document"/>
<soap12:body use="literal"/>

<soap12:body use="literal"/>

<wsdl:service name="EchoService">
<wsdl:port name="EchoServiceSOAP12port_http" binding="ns0:EchoServiceSOAP12Binding">

<soap:address location="http://localhost:8080/dyn/codegen/demo/services/EchoService"/>

And the client is simple as this

// the background work for create wsclient and the proxy
$client = new WSClient(array ("wsdl" =>"echo.wsdl"));

$proxy = $client->getProxy();

// you directly input the request parameter
$response = $proxy->echoInt(3);

echo $response;

So in a case where you just need to send only one parameter for the service operation, this form of messages make your web service call more efficient and more easy to implement.

No comments: