I am working on a webservice project where the client wants to send a complex type request to the server. We are using PHP at server and jQuery Mobile as the client.
Below is the type of SOAP request the client is sending. The client is sending 2 argument. The first argument is a string 'doLoginValidation' and the second argument is a list of parameters (key and value)
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<callServer>
<methodName>doLoginValidation</methodName>
<parameters>
<parameter>
<key>url</key>
<value>value</value>
</parameter>
<parameter>
<key>username</key>
<value>malaiselvan</value>
</parameter>
<parameter>
<key>password</key>
<value>123456</value>
</parameter>
</parameters>
</callServer>
</soap:Body>
</soap:Envelope>
I am trying to build the WSDL and got stuck on configuring the arguments. Find below the partial WSDL file
<types>
<xsd:complexType name="parameterList">
<xsd:sequence>
<xsd:element name="key" type="xsd:string"/>
<xsd:element name="value" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="parameters">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="parameter" nillable="true" type="tns:parameterList"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</types>
<message name='callServerRequest'>
<part name='methodname' type='xsd:string'/>
<part name='parameters' type='xsd:parameters'/>
</message>
<message name='callServerResponse'>
<part name='response' type='xsd:string'/>
</message>
<portType name='websitePortType'>
<operation name='callServer'>
<input message='tns:callServerRequest'/>
<output message='tns:callServerResponse'/>
</operation>
</portType>
Question 1: How to setup the methodname and parameters in the WSDL file?
Find below the PHP program
<?php
function callServer($methoName, $parmeters) {
//how to get the parameters sent from the client
return "some value";
}
ini_set("soap.wsdl_cache_enabled", "0");
$server = new SoapServer("smsmobile.wsdl");
$server->addFunction("callServer");
$server->handle();
?>
Question 2: How to receive the values sent from client inside the PHP program?