如何在PHP的此WebService(https://pje.tjba.jus.br/pje-web/intercomunicacao?wsdl)中使用“ consultarProcesso”功能?我可以在SoapUI中使用它而不会出现问题,但是我不知道如何在PHP中执行此操作。我知道我必须传递3个参数:“与会者ID”,“与会者密码”和“进程”。
这是SoapUI上的xml:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.cnj.jus.br/servico-intercomunicacao-2.2.2/" xmlns:tip="http://www.cnj.jus.br/tipos-servico-intercomunicacao-2.2.2">
<soapenv:Header/>
<soapenv:Body>
<ser:consultarProcesso>
<tip:idConsultante>LOGIN</tip:idConsultante>
<tip:senhaConsultante>PASSWORD</tip:senhaConsultante>
<tip:numeroProcesso>8000358-12.2019.8.05.0141</tip:numeroProcesso>
<!--Optional:-->
<tip:dataReferencia>?</tip:dataReferencia>
<!--Optional:-->
<tip:movimentos>?</tip:movimentos>
<!--Optional:-->
<tip:incluirCabecalho>?</tip:incluirCabecalho>
<!--Optional:-->
<tip:incluirDocumentos>?</tip:incluirDocumentos>
<!--Zero or more repetitions:-->
<tip:documento>?</tip:documento>
</ser:consultarProcesso>
</soapenv:Body>
</soapenv:Envelope>
已编辑
好,我有以下代码:
require_once'lib/nusoap.php';
$client = new nusoap_client('https://pje.tjba.jus.br/pje-web/intercomunicacao?wsdl', 'wsdl');
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
exit();
}
$client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = false;
$dados = array(
'idConsultante'=>'LOGIN',
'senhaConsultante'=>'SENHA',
'numeroProcesso'=>'8000358-12.2019.8.05.0141'
);
$result = $client->call('consultarProcesso', array('consultarProcesso' => $dados));
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
$err = $client->getError();
if ($err) {
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
echo '<h2>Result</h2><pre>';
// Decode the result: it so happens we sent Latin-1 characters
if (isset($result['return'])) {
$result1 = utf8_decode($result['return']);
} elseif (!is_array($result)) {
$result1 = utf8_decode($result);
} else {
$result1 = $result;
}
print_r($result1);
echo '</pre>';
}
}
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
echo '<h1>Agora</h1>';
echo htmlspecialchars($client->response);
它返回以下错误:
XML error parsing SOAP payload on line 1: Not well-formed (invalid token)
这是使用Nusoap。当我尝试使用SoapClient时,会出现相同的错误消息。