简单的来说,SOAP就是一个相对标准数据接口。百度解释如下:
SOAP(Simple ob
虽然这四个部分都作为SOAP的一部分,作为一个整体定义的,但他们在功能上是相交的、彼此独立的。特别的,信封和编码规则是被定义在不同的xm
SOAP的两个主要设计目标是简单性和可扩展性。这就意味着有一些传统消息系统或分布式对象系统中的某些性质将不是SOAP规范的一部分。比如:分布式垃圾收集 (Distributed garbage collection)、成批传送消息(Boxcarring or batching of messages)、对象引用 (ob
二、PHP怎么使用SOAP
2.1 PHP环境准备
打开PHP.ini 大约在300行左右,找到“extension=php_soap.dll” 取消前面的注释,重启PHP环境即可。
2.2 怎么也得敲两个代码
//请注意$xmldata必须在同一行,因为演示,我换格多行了。
$xmldata='<?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>
<GetFileByAsrFid xmlns="http://tempuri.org/">
<asr_code>123</asr_code>
<asr_fid>123</asr_fid>
</GetFileByAsrFid></soap:Body></soap:Envelope>';
header("text/xml; charset=utf-8");
$wsdl = 'http://url/us.asmx?wsdl';
try{
$client = new \SoapClient($wsdl);
$result = $client->__doRequest($xmldata,$wsdl,'http://tempuri.org/us',1,0);//发送xml必须使用__doRequest
$xml=simplexml_load_string($result);//xml格式化
$res = $xml->children('http://schemas.xmlsoap.org/soap/envelope/')->children('http://tempuri.org/');
return $res;
}catch (SoapFault $e){
echo $e->getMessage();
}catch(Exception $e){
echo $e->getMessage();
}
2.3 敢于尝试,你就成功了。欢迎访问新博客:http://www.cojz8.com/article/24
最佳答案
