php使用soap连接websevice,请高手解决问题 php soap websevice 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Could not connect to host 提示你没有访问该host的权限,就是访问不到! 1 用try catch语句来处理exception, 用client->getError()捕获到详细的错误 2 连不上一般是防火墙等造成的。3 参照http://blog.csdn.net/fengye245/article/details/7847232 用C#是ok的。。 但是用php就是不行。。郁闷。。 c#的代码很简单。但是用php就是不行 String url = "http://221.12.5.98:1000/cyyfoutservice.asmx"; Hashtable ht = new Hashtable(); XmlDocument xx = WebSvcCaller.QuerySoapWebService(url, "GetCanBookInfo", ht); Console.Write(xx.OuterXml); Console.ReadKey(); 翻了以前的demo,好像php需要写一个服务器文件,这个服务器文件要去指定调用你的协议文件,并且指定暴露出去的接口(方法),LZ你坚决认为是php的问题,你还是去找找网上那些php的webservice的案例,一步步来吧!PHP访问PHP的例子,客户端:$client = new SoapClient('http://192.168.0.109:81/webService/ser2/soapserver.php?wsdl'); //链接服务器端 先做一个身份验证 $h = new SoapHeader('mynamespace', 'checkUser', 'xiebuqing'); $client->__setSoapHeaders($h); try{ //调用greet()方法 获取请求的结果 $result = $client->greet(); }catch(SoapFault $e){ echo $e->getMessage(); exit; }服务器端:/注册wsdl 这里指定暴露出去的类和函数 $server = new SoapServer('hello.wsdl'); $server->setClass("Server"); $server->handle(); 可以了,不用 WSDL 就可以$client = new SoapClient(null, array( 'location' => 'http://221.12.5.98:1000/cyyfoutservice.asmx', 'uri' => 'http://tempuri.org/', 'trace' => true, 'soap_version' => SOAP_1_2,));$p = $client->__soapCall('GetCanBookInfo',array()) ;print_r($p); <bgsound loop="0" src="flourish.mid"/>怎么用按钮停止播放声音? AJAX+JS实现窗口拖拽 请教两个站点(php/asp)共享用户信息问题? phpinfo 中--without-gd如何解决 @_@所有PHP程序员都应该知道的五个工具 写过smarty的插件的朋友帮忙解决这个问题 MYSQL问题 php新人求助 这个文件是百度编辑器的图片上传部分.我想给编辑器上传的图片加上水印..... 急!路径问题?在线等! PHP Appache配置 项目中的相对路径不对 Notice: Undefined variable: GOLBALS
2 连不上一般是防火墙等造成的。
3 参照http://blog.csdn.net/fengye245/article/details/7847232
String url = "http://221.12.5.98:1000/cyyfoutservice.asmx";
Hashtable ht = new Hashtable();
XmlDocument xx = WebSvcCaller.QuerySoapWebService(url, "GetCanBookInfo", ht);
Console.Write(xx.OuterXml); Console.ReadKey();
PHP访问PHP的例子,客户端:$client = new SoapClient('http://192.168.0.109:81/webService/ser2/soapserver.php?wsdl');
//链接服务器端 先做一个身份验证
$h = new SoapHeader('mynamespace', 'checkUser', 'xiebuqing');
$client->__setSoapHeaders($h); try{
//调用greet()方法 获取请求的结果
$result = $client->greet();
}catch(SoapFault $e){
echo $e->getMessage();
exit;
}服务器端:/注册wsdl 这里指定暴露出去的类和函数
$server = new SoapServer('hello.wsdl');
$server->setClass("Server");
$server->handle();
'location' => 'http://221.12.5.98:1000/cyyfoutservice.asmx',
'uri' => 'http://tempuri.org/',
'trace' => true,
'soap_version' => SOAP_1_2,
));
$p = $client->__soapCall('GetCanBookInfo',array()) ;
print_r($p);