buenos dias tengo un web service soap estruturado de la siguiente manera:

POST /3.0/ExigoApi.asmx HTTP/1.1
Host: api.exigo.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://api.exigo.com/ChangeOrderStatus"

<?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>
<ApiAuthentication xmlns="http://api.exigo.com/">
<LoginName>string</LoginName>
<Password>string</Password>
<Company>string</Company>
<Identity>string</Identity>
<RequestTimeUtc>dateTime</RequestTimeUtc>
<Signature>string</Signature>
</ApiAuthentication>
</soap:Header>
<soap:Body>
<ChangeOrderStatusRequest xmlns="http://api.exigo.com/">
<OrderID>int</OrderID>
<OrderStatus>Incomplete or Pending or CCDeclined or ACHDeclined or Canceled or CCPending or ACHPending or Accepted or Printed or Shipped or PendingInventory</OrderStatus>
<OrderKey>string</OrderKey>
</ChangeOrderStatusRequest>
</soap:Body>
</soap:Envelope>

SOAP Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?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:Body>
<ChangeOrderStatusResult xmlns="http://api.exigo.com/" />
</soap:Body>
</soap:Envelope>

y el código que estoy aplicando para consumirlo es:
ini_set("soap.wsdl_cache_enabled", "0");

$wsdl = "http://api.exigo.com/3.0/ExigoApi.asmx?WSDL";
$ns = 'http://api.exigo.com/';

$client = new SoapClient($wsdl, array(
    "trace" => 1,
    "exceptions" => 0
));

$login = 'EcuadorAPIUser';
$password = 'teoma2018';
$company = 'teoma';
$orderid = 1305266;
$orderstatus='Shipped';  

$headerBody = array('ApiAuthentication'=>array(
    'login' => $login,
    'password' => $password,
    'Company' => $company
));

$Body = array('ChangeOrderStatusRequest'=>array(
'OrderID' => $orderid,
'OrderStatus' => $orderstatus


));

$header = new SoapHeader($ns, 'ApiAuthentication', $headerBody);
$client->__setSoapHeaders($header);
$value=$soapClient->call("ChangeOrderStatusRequest", array($Body));

/ $value = $client->ChangeOrderStatusRequest($Body);/

var_dump($value);

y tengo error al utilizar la funcion call

    Sorry, I do not speak Spanish(?), but if the problem is that you are trying to send your authentication via HTTP header, using the SoapHeader will not do it. (It only adds header data to the SOAP XML.) I had to do this to send an api-key HTTP header:

    // set some other stuff in $params array, then...
    $stream = stream_context_create(array(
      'http'=>array(
        'protocol_version' => 1.1,
        'header' => "X-api-key: ".$this->getApiKey($psid, $planReviewID, $env)."\r\n" .
                    "Connection: close"
      )
    ));
    $params['stream_context'] = $stream;
    
    // then pass $params as 2nd argument to SoapClient constructor
    

    Perhaps you need to do something similar for your ApiAuthentication header?

    NogDog
    yes i have a problem with header i am not experience in use the soap

      Write a Reply...