Problem with sending Parameters Nusoap PHP to SAP

0

I have a problem when doing a PHP integration (nusoap) with SAP, the connection responds 200 OK but returns a NULL value, I think the error is in how the parameters pass, this is the code:

    $client = new nusoap_client($wsdl, true);
    $client->setCredentials($usuario,$pass);
    $client->setEndpoint($endpoint); 
    $client->soap_defencoding = 'UTF-8';
    $client->http_encoding='gzip,deflate';
    $client->namespaces = array(
 'soapenv' => "http://schemas.xmlsoap.org/soap/envelope/",
 'tg' => "http://www.rutadeltg.com/xml/tgweb",
 'asi' => "http://rutadelasi/asi/");
  $person = array('CedulaCliente' =>    $cedula,'CanalDistribucion'=>$canal,'TipoPedido'=>$tipopedido);
  $result = $client->call('SI_Get_Order', $person, 'urn:VentaDirecta:modelo:sap','http://sap.com/xi/WebService/soap1.1'); 
    
asked by Hernán Rendón 06.07.2017 в 22:06
source

1 answer

0

This works for me ... although it is a webservice that sends me XML, if yours does not send xml .. then do not use the line: $ test = simplexml_load_string ($ data-> SI_Get_OrderResult-> any);

and at the end try it with "echo print_r ($ data);" instead of "echo print_r ($ test);"

ini_set('soap.wsdl_cache_enabled', 0);
ini_set('soap.wsdl_cache_ttl', 900);
ini_set('default_socket_timeout', 15);

$params = array('CedulaCliente'=>$cedula, 'CanalDistribucion'=>$canal, 'TipoPedido'=>$tipopedido); 

$wsdl = 'http://URL.asmx?wsdl';

$options = array(
  'uri'=>'http://schemas.xmlsoap.org/soap/envelope/',
  'style'=>SOAP_RPC,
  'use'=>SOAP_ENCODED,
  'soap_version'=>SOAP_1_1,
  'cache_wsdl'=>WSDL_CACHE_NONE,
  'connection_timeout'=>15,
  'trace'=>true,
  'encoding'=>'UTF-8',
  'exceptions'=>true,
);
try {
 $soap = new SoapClient($wsdl, $options);
 $data = $soap->SI_Get_Order($params);
 $test = simplexml_load_string($data->SI_Get_OrderResult->any);
}
 catch(Exception $e) {
 die($e->getMessage());
}

echo print_r($test);
    
answered by 07.09.2017 в 00:32