Search code examples
phpweb-servicesnusoapwebservices-client

How to set a namespace with NuSOAP (client side)


I asked a question like this some months ago but the problem was that the WebService was not working right. Now it is working perfectly and I'm still having problems making a simple request. First of all, I tried it with http://www.validwsdl.com/ The WS is http://amibcertifica.amib.com.mx:9090/axis2/services/JpaWebServicesAmib?wsdl You can try it yourselves. It works just fine with that website. Now I'm trying to make a request with NuSOAP and I get the this error: namespace mismatch require http://ws.mobius.amib found http://tempuri.org

You can check the whole error here: http://dev.etic.com.mx/bmv/test.php

My code is the following:

<?php 
require_once('nusoap/lib/nusoap.php');

$url = "http://amibcertifica.amib.com.mx:9090/axis2/services/JpaWebServicesAmib?wsdl";


try
{
    $client = new nusoap_client($url);
    $err = $client->getError();
if ($err) {
    // Display the error
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
    // At this point, you know the call that follows will fail
}
    $result = $client->call('findAllComprobanteOperacion');
}
catch (SoapFault $e)
{
    echo 'Error0'.$e->getMessage() . "\n";
}

echo '<pre>';print_r( $result );
echo $client->debug_str;
?>

NuSOAP version: $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $

I've been looking all around the web on how to do this and I'm completely clueless, so any help is really appreciated. Thanks in advance.


Solution

  • It was simpler than I thought. I just had to set the second parameter of nusoap_client to TRUE (because it's FALSE by default). So, it's $client = new nusoap_client($url, TRUE); That's it. Thanks anyway.