名站网址导航为大家免费提供关于网站编程方面的知识。
JS正则表达式匹配域名、网址、url
- 本篇文章的具体介绍如下请大家仔细看
1.WSDL模式:
$soap = new SoapClient("http://192.168.6.69:8899/Service1.asmx?wsdl"); $result2 = $soap->helloWorld(array( 'myName'=>'aaa', 'youName'=>'bbb' )); print_r($result2); |
2.non-WSDL模式:
2.1使用SoapParam传递参数:
$ns = 'http://www.mzdh.net/'; $soap = new SoapClient(null,array('location'=>'http://192.168.6.72:8036/Service1.asmx','uri'=>$ns)); $result2 = $soap->__soapCall("helloWorld", array(new SoapVar("AAA", XSD_STRING, null, $ns, "myName", $ns), new SoapVar("GBBB", XSD_STRING, null, $ns, "youName", $ns)), array('soapaction'=>'http://phpabc.cn/helloWorld')); print_r($result2); |
3.添加安全header
$soap = new SoapClient(null,array('location'=>'http://192.168.6.47/onvif/device_service' ,'uri'=>'http://www.onvif.org/ver10/device/wsdl/')); //ws $ns_wsse = "http://docs.oasis-open.org/wss/2004/01/ oasis-200401-wss-wssecurity-secext-1.0.xsd";//WS-Security namespace $ns_wsu = "http://docs.oasis-open.org/wss/2004/01/ oasis-200401-wss-wssecurity-utility-1.0.xsd";//WS-Security namespace $userT = new SoapVar('admin', XSD_STRING, NULL, $ns_wsse, NULL, $ns_wsse); $passwT = new SoapVar('NnYZe7oD81Kd8QRS4tUMze/2CUs=', XSD_STRING, NULL, $ns_wsse, NULL, $ns_wsse); $createdT = new SoapVar(time(), XSD_DATETIME, NULL, $ns_wsu, NULL, $ns_wsu); class UsernameT1 { private $Username; //Name must be identical to corresponding XML tag in SOAP header private $Password; // Name must be identical to corresponding XML tag in SOAP header private $Created; function __construct($username, $password, $created) { $this->Username=$username; $this->Password=$password; $this->Created=$created; } } $tmp = new UsernameT1($userT, $passwT, $createdT); $uuT = new SoapVar($tmp, SOAP_ENC_OBJECT, NULL, $ns_wsse, 'UsernameToken', $ns_wsse); class UserNameT2 { private $UsernameToken; //Name must be identical to corresponding XML tag in SOAP header function __construct ($innerVal){ $this->UsernameToken = $innerVal; } } $tmp = new UsernameT2($uuT); $userToken = new SoapVar($tmp, SOAP_ENC_OBJECT, NULL, $ns_wsse, 'UsernameToken', $ns_wsse); $secheaderValue=new SoapVar($userToken, SOAP_ENC_OBJECT, NULL, $ns_wsse, 'Security', $ns_wsse); $secheader = new Soapheader($ns_wsse, 'Security', $secheaderValue); $result2 = $soap->__soapCall("GetDeviceInformation",array(),null,$secheader); echo $result2; |
关于网站编程方面的知识就说道这里了,希望能够对大家有作用。,php,调用,webservice,的,几种,方法,