Xanathos
Xanathos

Reputation: 598

How to get a Response SOAP Envelope from PHP Web Service?

This is a simple question I think. I made a simple PHP web service with SoapServer and a simple client. I test this on soapUI and I get this:enter image description here

I know is because of the var_dump() but I don't know how to make it respond a Response SOAP Envelope with the requested data.

PHP Server:

<?php

   if(!extension_loaded("soap")){

   dl("php_soap.dll");

}

   ini_set("soap.wsdl_cache_enabled","0");
   $wsdl='InterconexionTest.wsdl';
   function ejecutarTransaccionTest($input){
    return (object)array('ejecutarTransaccionTestReturn'   => '0210B22080010E80800000000000000000183550000000000000000221150711577994022106520900                  000056    0000023041902000002     111111     REC     784 0117507902             MARINA DE GUERRA DEL01000000000682001000003          3000          REC604S                                                                                 00103FFFFFRECT001-0062563    17507902        200204220000000000000000021277RECT001-0076270    17507902        200205220000000000000000022225RECT001-0097858    17507902        200206220000000000000000008796                                                                                                                                                                                                                ');
   }
   $server = new SoapServer($wsdl);
   $server->AddFunction("ejecutarTransaccionTest");
   $server->handle();
?>

PHP Client:

<?php
try{

    $wsdl='InterconexionTest.wsdl';
    $sClient = new SoapClient($wsdl);
    $response = $sClient->ejecutarTransaccionTest("Input");
    var_dump($response);

} catch(SoapFault $e){
    var_dump($e);
}
?>

Can someone tell me how?

Upvotes: 0

Views: 767

Answers (1)

Xanathos
Xanathos

Reputation: 598

Just to add ?wsdl at the endpoint solves this issue, and to use the servidor.php instead of cliente (servidor = server in English. The SoapServer)

Upvotes: 1

Related Questions