复制代码 代码如下:
<?php
$client = new SoapClient('http://www.aa.net/SearchService.asmx?WSDL');//这个SOAP地址要换成你自己的
$client->soap_defencoding = 'utf-8';
$client->decode_utf8 = false;
$client->xml_encoding = 'utf-8';
$param = array('param1'=>'01', 'param2'=>'02');
//$param["param1"]="01";
//$param["param2"]="02";
//$result = $client->__soapCall("GetArticle", array( $param ));
$result = $client->__Call("GetArticle", array( $param ));
if (is_soap_fault($result))
{
trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})", E_USER_ERROR);
}
else
{
$data = $result->GetArticleResult; //这里返回的是类,必须使用->得到元素的值
print_r($data);
}
?>
复制代码 代码如下:
POST /SearchService.asmx HTTP/1.1
Host: 202.105.183.61
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetTrafficViolationInfo"
<?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>
<GetArticle xmlns="http://tempuri.org/">
<param1>string</param1>
<param2>string</param2>
</GetArticle>
</soap:Body>
</soap:Envelope>
新闻热点
疑难解答