【发布时间】:2021-02-28 00:47:20
【问题描述】:
第三方给了我他的 web 服务文档进行测试。我尝试通过将值传递给标题和正文来连接到肥皂网络服务。
我要使用的方法是ConsultarAfiliado。
肥皂结构是:
POST /WSAutorizaciones/WSAutorizacionLaboratorio.asmx HTTP/1.1
Host: 191.97.91.43
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "https://arssenasa.gob.do/ConsultarAfiliado"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<AuthenticationHeader xmlns="https://arssenasa.gob.do/">
<Cedula>string</Cedula>
<Password>string</Password>
<Proveedo>int</Proveedo>
</AuthenticationHeader>
</soap:Header>
<soap:Body>
<ConsultarAfiliado xmlns="https://arssenasa.gob.do/">
<TipoDocumento>int</TipoDocumento>
<NumDocumento>string</NumDocumento>
</ConsultarAfiliado>
</soap:Body>
</soap:Envelope>
我试过这些代码:
$wsdl =http://191.97.91.43/WSAutorizaciones/WSAutorizacionLaboratorio.asmx?WSDL";
$client = new SoapClient($wsdl, array('trace' => 1)); // The trace param will show you errors stack
$auth =array('Cedula' => '001-0945751-5', 'Password' => 'dmfvmxm2', 'Proveedo' => '12077');
$header = new SoapHeader('NAMESPACE','AuthenticationHeader',$auth,false);
var_dump($client->__setSoapHeaders($header));
// web service input params
$request_param = array('TipoDocumento' => '2', 'NumDocumento' => '021827151');
$responce_param = null;
try {
$responce_param = $client->ConsultarAfiliado($request_param);
print_r($responce_param->ConsultarAfiliadoResponse);
} catch (Exception $e) {
echo "<h2>Exception Error!</h2>";
echo $e->getMessage();
}
我收到了这个错误:
异常错误!服务器无法处理请求。 ---> 对象引用未设置为对象的实例。
请有人帮我解决这个问题。
这是 WSDL:http://191.97.91.43/WSAutorizaciones/WSAutorizacionLaboratorio.asmx?WSDL
【问题讨论】:
-
你真的不应该在 Stackoverflow 上发布密码。
-
谢谢但有假
-
根据错误消息,这可能与以下内容重复:stackoverflow.com/questions/779091/…
-
我看到了,但无法弄清楚我的代码哪里错了。请你帮帮我,你会赢得 50 点赏金
-
请有人帮我解决这个问题
标签: php web-services soap