No query is made in SOAP php, does not respond WS

0

Good morning, I have tried to connect to a WS that works with soap, but I do not know if I am writing the code wrong or it is badly formulated that does not consume me at all.

This is how the server indicates that the xml should be:

POST /servicios/estadocarros.asmx HTTP/1.1
Host: www.carritosonline.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://100.8.97.00/webservices/estadocarros"

<?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>
    <AuthHeader xmlns="http://100.8.97.00/webservices/">
      <Username>string</Username>
      <Password>string</Password>
      <Empresa>string</Empresa>
    </AuthHeader>
  </soap:Header>
  <soap:Body>
    <estadocarros xmlns="http://100.8.97.00/webservices/">
      <empresa>string</empresa>
      <listaMatriculas>
        <string>string</string>
        <string>string</string>
      </listaMatriculas>
    </estadocarros>
  </soap:Body>
</soap:Envelope>

But the code I write throws this at me:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://100.8.97.00/webservices/">
<SOAP-ENV:Header>
<ns1:AuthHeader>
<ns1:Username>username</ns1:Username>
<ns1:Password>password</ns1:Password>
<ns1:Empresa>empresa</ns1:Empresa>
</ns1:AuthHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:estadocarros/>
<empresa>empresa</empresa>
<listaMatriculas>
<string>placa vehiculo</string>
</listaMatriculas>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

And my php is this:

<?php
ini_set("soap.wsdl_cache_enabled", "0");

$wsdl = "http://www.carrosonline.com/servicios/estadocarros.asmx?WSDL"; 
$ns = "http://100.8.97.00/webservices/";

$soapClient = new SoapClient($wsdl, array("trace" => 1));

$authentication = new stdClass();
$authentication->Username = "username";
$authentication->Password = "password";
$authentication->Empresa  = "empresa";

$header = new SoapHeader($ns, "AuthHeader", $authentication);
$soapClient->__setSoapHeaders($header);

$data = null;
@$data->string = 4000;

echo "<pre>";

$soapParams=array(null,
            new SoapParam('mei', 'empresa'),
            new SoapParam($data, 'listaMatriculas'));

$respuesta = $soapClient->__soapCall("estadocarros", $soapParams);


echo "<h2>Consulta al servidor:</h2>\n" . htmlentities(str_ireplace("><", ">\n<", $soapClient->__getLastRequest())) . "\n";

echo "<h2>Respuesta del servidor:</h2>\n" . htmlentities(str_ireplace("><", ">\n<", $soapClient->__getLastResponse())) . "\n";

echo "\n<br><hr><br><h2>WS:</h2>";
var_dump($soapClient->__getFunctions()); 
echo "<br><hr><br>";
var_dump($soapClient->__getTypes()); 
    
asked by David Salinas 24.04.2018 в 16:08
source

0 answers