Retrieve information from WebService

1

I have to send an access token to the webservice, this token should be send in an XML like this:

POST /webslaptime_deploy/websLapTime.asmx HTTP/1.1
Host: 187.17.175.49
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://mylaptime.com/ListarTodosOsProdutos"

<?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>
    <ValidationSoapHeader xmlns="http://mylaptime.com/">
      <DevToken>string</DevToken>
    </ValidationSoapHeader>
  </soap:Header>
  <soap:Body>
    <ListarTodosOsProdutos xmlns="http://mylaptime.com/" />
  </soap:Body>
</soap:Envelope>

I have tried in many ways, through SOAP php, through cURL sending the same typed XML and nothing. Always give this error.

DevTokeniscorrect,checkedathousandtimes.

Thesearemyunsuccessfulattempts.

UsingArray

$seg=array("Header" => array(
        "ValidationSoapHeader" => array(
          "DevToken" => "DEV TOKEN AQUI"
        ),
      ),

      "Body" => array(
        "ListarTodosOsProdutos" => array()
      )
  );

  $client = new SoapClient('http://IP/webslaptime_deploy/websLapTime.asmx?WSDL');

  $function = "ListarTodosOsProdutos";
  $options = array('location' => 'http://IP/webslaptime_deploy/websLapTime.asmx');

  $result = $client->__soapCall($function, $seg, $options);

Using OBJ

$seg = new StdClass;
  $seg->Header = new StdClass;
  $seg->Header->ValidationSoapHeader = new StdClass;
  $seg->Header->ValidationSoapHeader->DevToken = "DEV TOKEN AQUI";

  $seg->Body = new StdClass;
  $seg->Body->ListarTodosOsProdutos = new StdClass;

  $client = new SoapClient('http://IP/webslaptime_deploy/websLapTime.asmx?WSDL');

  $function = "ListarTodosOsProdutos";
  $options = array('location' => 'http://IP/webslaptime_deploy/websLapTime.asmx');

  $result = $client->__soapCall($function, $seg, $options);
    
asked by anonymous 04.04.2018 / 19:29

0 answers