Consume web service with SOAP using PHP

Asked

Viewed 199 times

0

Good afternoon, I’m trying to consume a web service on SOAP TOTVS so far I have the following code.

$soapParams = array(
'login'          => 'xxxx',
'password'       => 'xxxx',
'authentication' => SOAP_AUTHENTICATION_BASIC,
'trace'          => 1,
'exceptions'     => 0, );

$params = array();
$client = new SoapClient('https://rmws.xxxxx:8051/wsConsultaSQL/MEX?wsdl', $soapParams);

$params = array(
  'codSentenca'   => 'SOAA.004.0000002111',
  'codColigada'   => '1',
  'codSistema'    => 'S',
  'parameters'    => '?'
);

var_dump($params) . "</br></BR>";

$result = $client->ReadView($params);

echo "response:\n" . $client->__getLastResponse() . "<br><br>";
echo "<br>";
echo "REQUEST:\n" . $client->__getLastRequest() . "<br><br>";
echo "REQUEST HEADERS:\n" . $client->__getLastRequestHeaders() . "<br><br>";
echo "REQUEST HEADERS:\n" . $client->__getLastResponseHeaders() . "<br><br>";

var_dump($client->__getTypes()). "<br><br>";
var_dump($client->__getFunctions());

Return:

inserir a descrição da imagem aqui

Why doesn’t it work? I don’t get any error message either! someone can help me, By SOAPUI program works normal

UPDATE:

array(4) {
  ["codSentenca"]=>
  string(16) "SOAP.001.0000001"
  ["codColigada"]=>
  string(1) "1"
  ["codSistema"]=>
  string(1) "S"
  ["parameters"]=>
  string(1) "?"
}
response:
<br><br><br>REQUEST:
<br><br>REQUEST HEADERS:
<br><br>REQUEST HEADERS:
<br><br>array(13) {
  [0]=>
  string(21) "struct MemberInfo {
}"
  [1]=>
  string(15) "struct Type {
}"
  [2]=>
  string(33) "struct Implements {
 Type type;
}"
  [3]=>
  string(56) "struct ImplementsResponse {
 boolean ImplementsResult;
}"
  [4]=>
  string(31) "struct CheckServiceActivity {
}"
  [5]=>
  string(76) "struct CheckServiceActivityResponse {
 boolean CheckServiceActivityResult;
}"
  [6]=>
  string(26) "struct AutenticaAcesso {
}"
  [7]=>
  string(65) "struct AutenticaAcessoResponse {
 string AutenticaAcessoResult;
}"
  [8]=>
  string(109) "struct RealizarConsultaSQL {
 string codSentenca;
 int codColigada;
 string codSistema;
 string parameters;
}"
  [9]=>
  string(73) "struct RealizarConsultaSQLResponse {
 string RealizarConsultaSQLResult;
}"
  [10]=>
  string(8) "int char"
  [11]=>
  string(17) "duration duration"
  [12]=>
  string(11) "string guid"
}
array(8) {
  [0]=>
  string(53) "ImplementsResponse Implements(Implements $parameters)"
  [1]=>
  string(83) "CheckServiceActivityResponse CheckServiceActivity(CheckServiceActivity $parameters)"
  [2]=>
  string(53) "ImplementsResponse Implements(Implements $parameters)"
  [3]=>
  string(83) "CheckServiceActivityResponse CheckServiceActivity(CheckServiceActivity $parameters)"
  [4]=>
  string(68) "AutenticaAcessoResponse AutenticaAcesso(AutenticaAcesso $parameters)"
  [5]=>
  string(53) "ImplementsResponse Implements(Implements $parameters)"
  [6]=>
  string(83) "CheckServiceActivityResponse CheckServiceActivity(CheckServiceActivity $parameters)"
  [7]=>
  string(80) "RealizarConsultaSQLResponse RealizarConsultaSQL(RealizarConsultaSQL $parameters)"
}

Did not return the data by the SOAPUI client returns, see!

inserir a descrição da imagem aqui

  • Press Ctrl+u on the page and be happy. You are injecting XML into your HTML that is not being rendered by the browser.

  • I updated my question based on your answer, but I still don’t have the data!!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.