我正在开发一个Web服务项目,客户端希望向服务器发送复杂类型的请求。我们在服务器上使用PHP,在客户端使用jQuery Mobile。
以下是客户端发送的SOAP请求的类型。客户端发送2个参数。第一个参数是字符串'doLoginValidation',第二个参数是参数列表(键和值)
<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>
我正在尝试构建WSDL并且无法配置参数。在下面找到部分WSDL文件
<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>
问题1 :如何在WSDL文件中设置methodname和parameters?
在下面找到PHP程序
<?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();
?>
问题2 :如何在PHP程序中接收客户端发送的值?