[英]SOAP webservice connection with authentication from php
I have this wsdl: https://www.dropbox.com/s/juprwr1ywqtbry5/wsdl.xml?dl=0 我有这个wsdl: https ://www.dropbox.com/s/juprwr1ywqtbry5/wsdl.xml ? dl =0
Im trying to conect doing this: 我试图联系这样做:
$ws_params = array('usuario' => "admin", 'clave' => "123456");
$client = new SoapClient("http://ws_min.mindtec.ar/ws_cnv/wscnv.asmx?wsdl");
$header = new SoapHeader("http://tempuri.org/", 'credencialcnv', $ws_params);
$client->__setSoapHeaders($header);
$res = $client->obtenerCNV_OPS(array("sFecha"=>"20151110"));
var_dump($res);
I get this: 我得到这个:
object(stdClass)#3 (1) {
["obtenerCNV_OPSResult"]=>
object(stdClass)#4 (0) {
}
}
I get an empty object as the web service takes no authentication settings. 由于Web服务不进行身份验证设置,因此我得到了一个空对象。 On the other hand I can connect easily from Visual Basic or .net using the following: 另一方面,我可以使用以下命令从Visual Basic或.net轻松连接:
Dim ws As New wscnv.wscnv
Dim oCredencial As New wscnv.CredencialCNV
oCredencial.usuario = "usuario123"
oCredencial.clave = "clave123"
ws.CredencialCNVValue = oCredencial
Dim listCNV As Array
listCNV = ws.obtenerCNV(txtFecha.Text)
Or from C#: 或从C#:
wscnv.wscnv ws = new wscnv.wscnv();
wscnv.CredencialCNV oCredencial = new wscnv.CredencialCNV();
oCredencial.usuario = "usuario123";
oCredencial.clave = "clave123";
ws.CredencialCNVValue = oCredencial;
Array listCNV = null;
listCNV = ws.obtenerCNV(txtFecha.Text);
What am I doing wrong ? 我究竟做错了什么 ?
Try with this: 试试这个:
$client = new SoapClient("http://ws_min.mindtec.ar/ws_cnv/wscnv.asmx?wsdl");
$hdb = array( 'usuario' => 'username', 'clave' => 'password');
$header = new SoapHeader("http://tempuri.org/", 'credencialcnv', $hdb);
$client->__setSoapHeaders($header);
$fcn_param = array('sFecha' => "20151110");
$r = $client->obtenerCNV_OPS($fcn_param);
var_dump($r);
and please, tell me about the results. 请告诉我有关结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.