php soap服务器-从客户端到服务器的复杂类型
我想向我的服务器发送一份文章编号列表,并获取回复列表 因此,我编写了一个服务器来捕获请求 我的服务器目前非常简单,因为我被困在参数上:php soap服务器-从客户端到服务器的复杂类型,php,web-services,soap,parameters,Php,Web Services,Soap,Parameters,我想向我的服务器发送一份文章编号列表,并获取回复列表 因此,我编写了一个服务器来捕获请求 我的服务器目前非常简单,因为我被困在参数上: $SOAPServer = new SoapServer("testws.wsdl"); $SOAPServer->addFunction('getArticleInfoList'); $SOAPServer->handle(); function getArticleInfoList($parameters) { $fd = fopen(".
$SOAPServer = new SoapServer("testws.wsdl");
$SOAPServer->addFunction('getArticleInfoList');
$SOAPServer->handle();
function getArticleInfoList($parameters)
{
$fd = fopen("./___log.dat", "w+");
fwrite($fd, print_r($parameters,1)."\n");
fclose($fd);
// ...
return $returnval;
}
在我的客户机中,我调用以下函数:
// client-connection is ok !
$arts[] = array('articleid'=>'4711');
$arts[] = array('articleid'=>'0815');
$params = array(
'parameters' => array('userid'=>$userid,'articlelist'=>$arts)
);
$params = array('userid'=>$userid,'articlelist'=>$arts);
$result = $client3->__soapCall("getArticleInfoList",array("parameters" =>$params) );
echo $client3->__getLastRequest();
echo $client3->__getLastResponse();
wsdl文件如下所示:
<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://server.de/ws/testws" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testws" targetNamespace="http://server.de/ws/testws">
<wsdl:types>
<xsd:schema targetNamespace="http://server.de/ws/testws/" elementFormDefault="qualified">
<xsd:complexType name="Article">
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="articleid" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="getArticleInfoListInput">
<xsd:sequence>
<xsd:element name="userid" type="xsd:string" minOccurs="1" maxOccurs="1"></xsd:element>
<xsd:element name="articlelist" type="tns:Article[]" minOccurs="0" maxOccurs="unbounded"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="getArticleInfoListOutput">
<xsd:sequence>
<xsd:element name="articleid" type="xsd:string"></xsd:element>
<xsd:element name="price" type="xsd:decimal"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getArticleInfoListSoapIn">
<wsdl:part element="tns:getArticleInfoListInput" name="parameters" />
</wsdl:message>
<wsdl:message name="getArticleInfoListSoapOut">
<wsdl:part element="tns:getArticleInfoListOutput" name="parameters"/>
</wsdl:message>
<wsdl:portType name="testwsSoap">
<wsdl:operation name="getArticleInfoList">
<wsdl:input message="tns:getArticleInfoListSoapIn"/>
<wsdl:output message="tns:getArticleInfoListSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="testwsSoapHttpBinding" type="tns:testwsSoap">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getArticleInfoList">
<soap:operation soapAction="http://server.de/ws/testws/"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ShopService">
<wsdl:documentation>TEST</wsdl:documentation>
<wsdl:port binding="tns:testwsSoapHttpBinding" name="ShopServiceSOAP11prt_HTTP">
<soap:address location="http://server.de/ws/testws/testws.php5"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
为什么这是一个这样的结构
我只想让用户id和文章id的列表
我希望有人能帮我解决这个问题。有同样的问题。到目前为止有什么解决办法吗?
stdClass Object
(
[item] => Array
(
[0] => stdClass Object
(
[key] => userid
[value] => F37BF361-7873-7741-2545-532F22D30781
)
[1] => stdClass Object
(
[key] => articlelist
[value] => stdClass Object
(
[Map] => Array
(
[0] => stdClass Object
(
[item] => stdClass Object
(
[key] => articleid
[value] => 4711
)
)
[1] => stdClass Object
(
[item] => stdClass Object
(
[key] => articleid
[value] => 0815
)
)
)
)
)
)
)