I need to make a query on a SOAP webservice using PHP, but I need to send this "authentication". How do I make this request?
Url of webservice: http://externo.detran.es.gov.br/WSBioHMLG/Monitoramento/WsAulasPraticas.svc?wsdl
Documentation:
//Assinatura
ConsultarSituacaoInstrutorPraticoRetorno ConsultaSituacaoInstrutorPratico(
ConsultarSituacaoInstrutorPraticoEnvio model, UsuarioModel usuario)
Parâmetros de Envio
Classe com as informações para pesquisa da situação do Instrutor Prático
class ConsultarSituacaoInstrutorPraticoEnvio : ConsultarSituacaoDadosEnvio
{
CPF do instrutor/ Obrigatório
decimal CpfInstrutor
}
Classe base de dados de pesquisa de situação
class ConsultarSituacaoDadosEnvio : MonitoramentoAulaPraticaBase
{
//CNPJ do CFC / Obrigatório
decimal CnpjCfc
}
class MonitoramentoAulaPraticaBase
{
//Login e senha da empresa de monitoramento credenciada.
//Consiste de um campo de login e senha / Obrigatório
MonitAulaPraticaHeader UsuarioProdest
}
I call the method :
$requestParams = array(
'model' => array(
'Categoria' => "A",
'CpfInstrutor' => 123456789
),
'usuario' => array(
'Login' => "User",
'Senha' => "******"
)
);
$result = $client->__soapCall('ConsultaSituacaoInstrutorPratico', array($requestParams));
But return "login/password is missing".
Ps.: Sorry my English, I used the translator.
Ps. 2: I'm using PHP SOAPClient.
Where I have doubts:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.datacontract.org/2004/07/Biometria.MonitoramentoAulasPraticas" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/Biometria.MonitoramentoAulasPraticas">
<xs:import namespace="http://schemas.datacontract.org/2004/07/System.ComponentModel"/>
<xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
<xs:complexType name="MonitAulaPraticaHeader">
<xs:sequence>
<xs:element xmlns:q1="http://schemas.datacontract.org/2004/07/System.ComponentModel" name="PropertyChanged" nillable="true" type="q1:PropertyChangedEventHandler"/>
<xs:element xmlns:q2="http://schemas.microsoft.com/2003/10/Serialization/Arrays" name="anyAttrField" nillable="true" type="q2:ArrayOfArrayOfanyType"/>
<xs:element name="loginField" nillable="true" type="xs:string"/>
<xs:element name="senhaField" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="MonitAulaPraticaHeader" nillable="true" type="tns:MonitAulaPraticaHeader"/>
</xs:schema>
First you have to create the client connection:
$wsdl = "http://externo.detran.es.gov.br/WSBioHMLG/Monitoramento/WsAulasPraticas.svc?wsdl";
// SOAP connector config
$soap_config = array(
'soap_version' => SOAP_1_1,
'authentication' => SOAP_AUTHENTICATION_BASIC,
'login' => 'username',
'password' => 'password',
);
// Connect to soap interface
$soap = new SoapClient($wsdl, $soap_config);
And then you can call the SOAP method:
$requestParams = array(
'model' => array(
'Categoria' => "A",
'CpfInstrutor' => 123456789
),
'usuario' => array(
'Login' => "User",
'Senha' => "******"
)
);
$result = $soap->ConsultaSituacaoInstrutorPratico($requestParams);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.