2013-11-21 124 views
3
The following is a sample SOAP 1.1 request and response.: 
POST /atservices/1.5/atws.asmx HTTP/1.1 
Host: webservices2.autotask.net 
Content-Type: text/xml; charset=utf-8 
Content-Length: length 
SOAPAction: "http://autotask.net/ATWS/v1_5/getZoneInfo" 

<?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> 
    <getZoneInfo xmlns="http://autotask.net/ATWS/v1_5/"> 
    <UserName>string</UserName> 
    </getZoneInfo> 
</soap:Body> 
</soap:Envelope> 

想打電話給使用自動任務肥皂的Web服務在php.can我們得到例如它 我們應該怎麼稱呼SOAP客戶端。我們如何調用使用SOAP Web服務在PHP

Its output should be like this : 

HTTP/1.1 200 OK 內容類型:文本/ XML;字符集= UTF-8 的Content-Length:長度

<?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> 
<getZoneInfoResponse xmlns="http://autotask.net/ATWS/v1_5/"> 
    <getZoneInfoResult> 
    <URL>string</URL> 
    <ErrorCode>int</ErrorCode> 
    <DataBaseType>string</DataBaseType> 
    <CI>int</CI> 
    </getZoneInfoResult> 
</getZoneInfoResponse> 
</soap:Body> 
</soap:Envelope> 

回答

2

使用PHP自身SoapClient隨着服務的WSDL,像這樣:

$atservices_wsdl = "https://www.autotask.net/atservices/1.5/atws.wsdl"; 
$atservices_client = new SoapClient($atservices_wsdl); 

$zone_info = $atservices_client->getZoneInfo("SomeUserName"); 

print_r($zone_info); // review the returned object converted from SOAP response. 

echo $zone_info->DataBaseType; // this might work if it's not behind a Response object. 
1

最起碼,你應該瞄準的東西喜歡這個。更多可以發現here.

$soap = new SoapClient('link/to/.wsdl'); 
$result = $soap->__soapCall('getZoneInfo', array('UserName' => $username)); 
var_dump($result);