访问我的SOAP Web服务时遇到问题。
senario: 我称之为fAction getAccountInfos
private function getAccountInfos($authKey){
$wsdlAccount = $this->container->getParameter('wsdlAccounts');
$clientWC = new \SoapClient($wsdlAccount, array('cache_wsdl' => WSDL_CACHE_MEMORY));
$r = $clientWC->getAcctInformations($authKey);
if (isset($r["data"]))
$acctId = $r["data"]["Id"];
else
$acctId = "0";
return $acctId;
}
当我想调用getAcctInformations($ authKey)时,我得到了这个异常:
Uncaught PHP Exception SoapFault: "Not Found" at C:\wamp\www\apishop\src\Apitic\IntranetBundle\Controller\HomeController.php line 548
这是var_dump:
var_dump($wsdlAccount) :
string 'http://api.web-caisse.dev/wsdl/accounts.wsdl' (length=44)
var_dump($clientWC->__getFunctions()) :
array (size=8)
...
1 => string 'UNKNOWN getAcctInformations(string $authKey)' (length=44)
...
这里是我的accounts.wsdl:
<?xml version ='1.0' encoding ='UTF-8' ?>
<definitions name='AccountsList'
targetNamespace='http://api.web-caisse.dev/wsdl/accounts.wsdl'
xmlns:tns='http://api.web-caisse.dev/wsdl/accounts.wsdl'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>
...
<message name='getAcctInformationsRequest'>
<part name='authKey' type='xsd:string'/>
</message>
<message name='getAcctInformationsResponse'>
<part name='Result' type='xsd:array'/>
</message>
...
<portType name='AccountsListPortType'>
...
<operation name='getAcctInformations'>
<documentation>Returns the account information.</documentation>
<input message='tns:getAcctInformationsRequest'/>
<output message='tns:getAcctInformationsResponse'/>
</operation>
...
</portType>
<binding name='AccountsListBinding' type='tns:AccountsListPortType'>
<soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
...
<!-- getAcctInformations -->
<operation name='getAcctInformations'>
<soap:operation soapAction='urn:xmethods-delayed-quotes#getAccounts'/>
<input />
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
<output>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</output>
</operation>
...
</binding>
<service name='AccountsList'>
<port name='AccountsList' binding='tns:AccountsListBinding'>
<soap:address location='http://api.web-caisse.dev/wsdl/accounts.wsdl'/>
</port>
</service>
和我的vHost:
# api.web-caisse.dev
<VirtualHost 127.0.0.1>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header set Access-Control-Allow-Headers "SOAPAction, content-type"
DocumentRoot C:/wamp/www/webcaisse/apioffice
ServerName api.web-caisse.dev
</VirtualHost>
我的主人:
127.0.0.1 api.web-caisse.dev
我不明白为什么我有这个异常,因为我的wsdl服务的url与我的var_dump和SOAP客户端知道fAction getAcctInformations($ authKey)相同......
非常感谢您的帮助。