<?php
/* ini_set(‘display_errors’,1); //错误信息
ini_set(‘display_startup_errors’,1); //php启动错误信息
error_reporting(-1); //打印出所有的 错误信息
ini_set(‘error_log’, dirname(__FILE__) . ‘/error_log.txt’); //将出错信息输出到一个文本文件 */
header(‘Content-Type: text/html; charset=utf-8’);
$s = new SoapClient(“http://名/WebService.asmx?wsdl”);
//$s =new SoapClient(“http://名/WebService.asmx?wsdl”, array(‘proxy_host’ => “http://名”,
// ‘proxy_port’ => 35749));
//var_dump( simplexml_load_string(file_get_contents(‘http://lxfamn.vicp.cc:35749/WebService.asmx?wsdl’)));
/*
*SoapHeader参数说明如下所示:
*’http://tempuri.org/’ namespace(命名空间可省略)
*’MySoapHeader’ SoapHeader头的类名
*’array(…)’ 存放标识身份的字符串参数
*’true’ 是否必须处理该header
*/
echo 123457;
$u = new SoapHeader(‘http://名/webservice/’,’MySoapHeader’,array(‘UserName’=>”,’PassWord’=>”),true);
//添加soapheader
$s->__setSoapHeaders($u);
//var_dump($s->__doRequest(simplexml_load_string(file_get_contents(‘http://lxfamn.vicp.cc:35749/WebService.asmx?wsdl’)), ‘http://lxfamn.vicp.cc:35749/WebService.asmx’, ‘myprivatestart’,1));
//$s->__doRequest(simplexml_load_string(file_get_contents(‘http://lxfamn.vicp.cc:35749/WebService.asmx?wsdl’)), ‘http://lxfamn.vicp.cc:35749/WebService.asmx’, ‘myprivatestart’,1);
var_dump($u);
//调取需要的webservice方法
//var_dump( $s->myprivatestart(array()));
//$suc = $s->myprivatestart(array());
//端口映射后将该位置设置
$s->__setLocation(‘http://域名/webservice.asmx’);
$suc=$s->__soapcall(‘myprivatestart’,array());
echo $suc->myprivatestartResult;
var_dump( get_object_vars($suc));
?>