Hi

After hitting a brick wall using php's soapclient, i'm attempting to use NuSoap. I pass it an array of data, but when I look at the request, there's no data in there whatsoever. Where has it gone ?! Any help would be much appreciated.


$authenticate = array( 
'Country' => 'GBR', 
'Engine' => array ('_' => 'Authenticate', 'Flatten' => true, 'PromptSet' => 'Default'), 
'Layout' => '< Default >', 
'SearchSpec' => array( 
  array('_' => 'Yes', 'Key' => 'CTRL_SEARCHCONSENT'), 
  array('_' => 'MR', 'Key' => 'NAME_TITLE'), 
  array('_' => 'Zuzu', 'Key' => 'NAME_FORENAME'), 
  array('_' => '', 'Key' => 'NAME_INITIALS'), 
  array('_' => 'Zuzu', 'Key' => 'NAME_SURNAME'), 
  array('_' => '12/12/1956', 'Key' => 'NAME_DATEOFBIRTH'), 
  array('_' => 'M', 'Key' => 'NAME_SEX'), 
  array('_' => '', 'Key' => 'ADDR_FLAT'), 
  array('_' => '', 'Key' => 'ADDR_HOUSENAME'), 
  array('_' => '27', 'Key' => 'ADDR_HOUSENUMBER'), 
  array('_' => 'Manor Road', 'Key' => 'ADDR_STREET'), 
  array('_' => 'Alresford', 'Key' => 'ADDR_DISTRICT'), 
  array('_' => 'Zuzuchester', 'Key' => 'ADDR_TOWN'), 
  array('_' => '', 'Key' => 'ADDR_COUNTY'), 
  array('_' => 'CO4 4LT', 'Key' => 'ADDR_POSTCODE') 
  ) 
); 


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

$wsdlfile = "authenticate.wsdl";

$client = new nusoap_client ($wsdlfile,'wsdl');

$repsonse = $client->call('DoSearch',$authenticate);

and when I do $client->request, I get:

REQUEST :
POST / HTTP/1.0 Host: Sbsswhapp006:2021 User-Agent: NuSOAP/0.7.3 (1.114)
Content-Type: text/xml; charset=ISO-8859-1 SOAPAction: "http://www.qas.com/web-2005-10/DoSearch" Content-Length: 414 <?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns6316="http://tempuri.org">
<SOAP-ENV:Body>
<QASearch xmlns="http://www.qas.com/web-2005-10"/>

!! Surely DATA SHOULD BE HERE!!

</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

ANy ideas what's happening here. I'm having a SOAP nightmare, five days I've been trying to get a request sent!

thanks

    I've made a LITTLE progress. I am now constructing a SOAP Request, with data.

    If I construct the XML as a variable, and send with nusoap, the SOAP Request looks well formed. Some progress.

    Not sure if that's the correct way to do it or not, but its totally different from the PHP soapclient, which requires an array.

    Anyway, I'm still getting an error in my SOAP Response, and I wonder if it's down to the nusoap naming of the tags, specifically SOAP-ENV.

    The example Request I have been given as what the WSDL file is expecting, has the tags named as soapenv:

    Does anyone know if :

    a) that's going to cause an error
    b) if I can tell nusoap to format my tags with soapenv, not SOAP-ENV

    Also, the nusoap Request adds this line:

    xmlns:ns6316="http://tempuri.org">

    I can effect the namespace to one of my own, but where does it get :ns6316. According to the example given to me, that tag shouldn't be there.

    Here's what I'm trying to replicate:

    <?xml version="1.0" encoding="UTF-8" ?> 
    <soapenv:Envelope 
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
    <QASearch xmlns="http://www.qas.com/web-2005-10">
    <Country>GBR</Country> 
    <Engine Flatten="true">Authenticate</Engine> 
    <Layout>< Default ></Layout> 
    <QAConfig /> 
    <SearchSpec>
    <SearchTerm Key="CTRL_SEARCHCONSENT">Yes</SearchTerm> 
    <SearchTerm Key="NAME_TITLE" /> 
    <SearchTerm Key="NAME_FORENAME">john</SearchTerm> 
    <SearchTerm Key="NAME_INITIALS" /> 
    <SearchTerm Key="NAME_SURNAME">smith</SearchTerm> 
    <SearchTerm Key="NAME_DATEOFBIRTH">01/01/1999</SearchTerm> 
    <SearchTerm Key="NAME_SEX" /> 
    <SearchTerm Key="ADDR_FLAT" /> 
    <SearchTerm Key="ADDR_HOUSENAME">George West House</SearchTerm> 
    <SearchTerm Key="ADDR_HOUSENUMBER">2-3</SearchTerm> 
    <SearchTerm Key="ADDR_STREET">Clapham Common North Side</SearchTerm> 
    <SearchTerm Key="ADDR_DISTRICT" /> 
    <SearchTerm Key="ADDR_TOWN">LONDON</SearchTerm> 
    <SearchTerm Key="ADDR_COUNTY" /> 
    <SearchTerm Key="ADDR_POSTCODE">SW4 0QL</SearchTerm> 
    </SearchSpec>
    </QASearch>
    </soapenv:Body>
    </soapenv:Envelope>
    

    And this is what nusoap is producing:

    <?xml version="1.0" encoding="UFT-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:ns9310="http://tempuri.org">
    
    <SOAP-ENV:Body>
    <QASearch xmlns="http://www.qas.com/web-2005-10"> 
    <Country>GBR</Country> 
    <Engine Flatten="true" PromptSet="Default">Authenticate</Engine> 
    <Layout>< Default ></Layout> 
    <QAConfig /> 
    <SearchSpec> 
    <SearchTerm Key="CTRL_SEARCHCONSENT">Yes</SearchTerm>
    <SearchTerm Key="NAME_TITLE" />
    <SearchTerm Key="NAME_FORENAME">john</SearchTerm>
    <SearchTerm Key="NAME_INITIALS" />
    <SearchTerm Key="NAME_SURNAME">smith</SearchTerm>
    <SearchTerm Key="NAME_DATEOFBIRTH">01/01/1999</SearchTerm>
    <SearchTerm Key="NAME_SEX" />
    <SearchTerm Key="ADDR_FLAT" />
    <SearchTerm Key="ADDR_HOUSENAME">George West House</SearchTerm>
    <SearchTerm Key="ADDR_HOUSENUMBER">2-3</SearchTerm>
    <SearchTerm Key="ADDR_STREET">Clapham Common North Side</SearchTerm>
    <SearchTerm Key="ADDR_DISTRICT" />
    <SearchTerm Key="ADDR_TOWN">LONDON</SearchTerm>
    <SearchTerm Key="ADDR_COUNTY" />
    <SearchTerm Key="ADDR_POSTCODE">SW4 0QL</SearchTerm>
    </SearchSpec> 
    </QASearch>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    and this is the error I'm getting back:

    RESPONSE:
    HTTP/1.0 200 OK Content-Length: 349 Content-Type: text/xml 
    <?xml version="1.0"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body>
    <soap:Fault>
    <faultcode>soap:Server</faultcode>
    <faultstring>-4600</faultstring>
    <detail>Failed to parse or validate XML against the schema; invalid parameters</detail>
    </soap:Fault>
    </soap:Body>
    </soap:Envelope> 
    

    I thought previously that the < > in the Layout tag were causing a problem, but that was wrong, and lost me two days.

    Initially, I used the PHP soapclient to attempt this, but came across the same error. The difference was the PHP client was producing tags like <ns1:SearchTerm>. I was told, that was the cause of the error, however, nusoap is now producing tags without this namespace: and I'm still getting the error.

    could it be the soapenv / SOAP-ENV difference ?

    HELP ?! Anybody ?!

      hmm, I thought it may be the complex array that was causing me problems, but turns out, even the simplest array falls over. I just don't understand why its so difficult to get anything out of nusoap. i must be missing something fundamental here. Look:

      
      require_once ('../nusoap/lib/nusoap.php'); 
      $client = new nusoap_client("authenticate.wsdl", 'wsdl'); 
      $response_doCanSearch = $client->call('DoCanSearch',array('Country'=>'GBR')); 
      
      echo("<br />REQUEST :<br />" . htmlspecialchars($client->request,ENT_QUOTES) . "<br />"); 
      
      

      gives absolutely no data between the body tags. I seem to be going backwards!

      
      REQUEST : 
      POST / HTTP/1.0 Host: xxxxxxx:2021 User-Agent: NuSOAP/0.7.3 (1.114) Content-Type: text/xml; charset=UFT-8 SOAPAction: "http://www.qas.com/web-2005-10/DoCanSearch" Content-Length: 412 <?xml version="1.0" encoding="UFT-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4543="http://tempuri.org"><SOAP-ENV:Body><QACanSearch xmlns="http://www.qas.com/web-2005-10"/></SOAP-ENV:Body></SOAP-ENV:Envelope> 
      
      

      Any ideas ? This must be simpler that this, surely!

      Thanks

        Write a Reply...