2011-01-24 108 views
1

我是带有PHP(以及一般SOAP)的SOAP新手。我在SoapClient类遇到问题。它需要四个参数(请求,位置,操作,版本),但我真的不知道这些参数与我尝试使用的Web服务有关。PHP SOAP SoapClient参数

http://wiki.agemni.com/Getting_Started/APIs/Agemni_CMS_Synchttp://www.agemni.com/_anet/ADBAccess.asmx?op=getCMSTables

这是我最好的猜测:

$wsdl = 'http://www.agemni.com/_anet/ADBAccess.asmx?WSDL'; 

$action = 'http://webservice.agemni.com/getCMSTables'; 
$request = 'POST /_anet/ADBAccess.asmx HTTP/1.1 
Host: www.agemni.com 
Content-Type: text/xml; charset=utf-8 
Content-Length: 10000 
SOAPAction: "http://webservice.agemni.com/getCMSTables" 

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Body> 
    <getCMSTables xmlns="http://webservice.agemni.com/getCMSTables" /> 
    </soap:Body> 
</soap:Envelope>" 
'; 
$location = 'http://www.agemni.com/_anet/ADBAccess.asmx'; 
$version ='1'; 


$client = new SoapClient($wsdl); 
$response = $client->__doRequest($request, $location, $action, $version); 

我不要求任何人都可以帮我这个忙,但如果你能帮助澄清$ action,$ request和$ location应该是什么(非常确定$ version只是一个int 1或2)我将非常感激。

回答

1

那么,如果您不想处理请求的细节并且您拥有WSDL文件,则不需要设置这些参数。只需实例化WSDL文件的路径,它假设包含其他所有内容。在你只需要调用

$response = $client->getCMSTables(); 

参见:http://php.net/manual/en/soapclient.soapclient.php

+0

甜!谢谢。在这种特殊情况下,你不会碰巧知道如何通过看看文档证明我已经登录了吗? – timmyc 2011-01-25 00:39:28