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); php的urlencode问题 php new COM用法? 为什么不用addslashes 或者htmlspecialchars 新手问题:何为句柄 写sesion文件时出错,请高手帮助!!在线等!! 这个最常见的CGI Error是什么原因造成的? 如果一个论坛这样设计…… 有关PDO防sql注入问题 我想用C语言开发PHP框架,请问要学多久? tinkphp二维码生成之后怎么跟图片合成? 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);