PHP_u_soapCall参数
我有一个用PHP编写并使用此WSDL的SoapServerPHP_u_soapCall参数,php,web-services,soap,Php,Web Services,Soap,我有一个用PHP编写并使用此WSDL的SoapServer <?xml version="1.0" encoding="utf-8" ?> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://myserver.net" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w
<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://myserver.net" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="myService" targetNamespace="http://myserver.net">
<wsdl:types>
<xsd:element name="getArticleStockInput">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="articleid" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getArticleStockOutput">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="stock" type="xsd:float"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</wsdl:types>
<wsdl:message name="getArticleStockRequest">
<wsdl:part element="tns:getArticleStockInput" name="parameters"/>
</wsdl:message>
<wsdl:message name="getArticleStockResponse">
<wsdl:part element="tns:getArticleStockOutput" name="parameters"/>
</wsdl:message>
<wsdl:portType name="myServiceSoap">
<wsdl:operation name="getArticleStock">
<wsdl:input message="tns:getArticleStockRequest"/>
<wsdl:output message="tns:getArticleStockResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="myServiceSoapHttpBinding" type="tns:myServiceSoap">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getArticleStock">
<soap:operation soapAction="http://myserver.net/getArticleStock"/>
<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:port binding="tns:myServiceSoapHttpBinding" name="ShopServiceSOAP11prt_HTTP">
<soap:address location="http://myserver.net/ws.php5"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
还是像这样
ini_set("soap.wsdl_cache_enabled", "0");
$url="http://myserver.net/wsdl.wsdl";
$client3 = new SoapClient($url);
$parray = array("articleid" => "150");
$result = $client3->__soapCall("getArticleStock", $parray);
正确的使用方法是什么
再见此PHP代码片段取自PHP函数手册,它演示了函数的正确用法:
<?php
$client = new SoapClient("some.wsdl");
$client->SomeFunction($a, $b, $c);
$client->__soapCall("SomeFunction", array($a, $b, $c));
$client->__soapCall("SomeFunction", array($a, $b, $c), NULL, new SoapHeader(), $output_headers);
$client = new SoapClient(null, array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/"));
$client->SomeFunction($a, $b, $c);
$client->__soapCall("SomeFunction", array($a, $b, $c));
$client->__soapCall("SomeFunction", array($a, $b, $c), array('soapaction' => 'some_action', 'uri' => 'some_uri'));
?>
非常感谢,但我一直都在读这篇文章。我认为这取决于wsdl文件和可能的复杂类型。
<?php
$client = new SoapClient("some.wsdl");
$client->SomeFunction($a, $b, $c);
$client->__soapCall("SomeFunction", array($a, $b, $c));
$client->__soapCall("SomeFunction", array($a, $b, $c), NULL, new SoapHeader(), $output_headers);
$client = new SoapClient(null, array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/"));
$client->SomeFunction($a, $b, $c);
$client->__soapCall("SomeFunction", array($a, $b, $c));
$client->__soapCall("SomeFunction", array($a, $b, $c), array('soapaction' => 'some_action', 'uri' => 'some_uri'));
?>