Jump to content

SOAP Envelope amend namespace HELP!


darkgr33n

Recommended Posts

Hi All.

 

I'm struggling with my SOAP request, and am really at a dead-end. I am not in control of the wsdl file I am referencing, just trying to format my request correctly. I am using the same wsdl file for other requests, which all work, but this one has me stumped.

 

The reason is, I have been told I need to amend the namespace on the Request, but I have no idea how to do that, as I don't explicitly set them anywhere.

 

Can I amend the namespace ?

 

Here's how I make my request:

 

$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') 
  ) 
); 

$response_doAuthenticate = $client->DoSearch($authenticate);

 

 

 

and this is what I get when I grab getLastRequest:

 

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.qas.com/web-2005-10">
<SOAP-ENV:Body>
<ns1:QASearch>
<ns1:Country>GBR</ns1:Country>
<ns1:Engine Flatten="true" PromptSet="Default">Authenticate</ns1:Engine>
<ns1:Layout><Default></ns1:Layout>
<ns1:SearchSpec>
<ns1:SearchTerm Key="CTRL_SEARCHCONSENT">Yes</ns1:SearchTerm>
<ns1:SearchTerm Key="NAME_TITLE">MR</ns1:SearchTerm>
<ns1:SearchTerm Key="NAME_FORENAME">Zuzu</ns1:SearchTerm>
<ns1:SearchTerm Key="NAME_INITIALS"></ns1:SearchTerm>
<ns1:SearchTerm Key="NAME_SURNAME">Zuzu</ns1:SearchTerm>
<ns1:SearchTerm Key="NAME_DATEOFBIRTH">12/12/1956</ns1:SearchTerm>
<ns1:SearchTerm Key="NAME_SEX">M</ns1:SearchTerm>
<ns1:SearchTerm Key="ADDR_HOUSENUMBER">27</ns1:SearchTerm>
<ns1:SearchTerm Key="ADDR_STREET">Manor Road</ns1:SearchTerm>
<ns1:SearchTerm Key="ADDR_DISTRICT">Alresford</ns1:SearchTerm>
<ns1:SearchTerm Key="ADDR_TOWN">Zuzuchester</ns1:SearchTerm>
<ns1:SearchTerm Key="ADDR_POSTCODE">CO4 4LT</ns1:SearchTerm>
</ns1:SearchSpec>
</ns1:QASearch>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

BUT I have been told that the ns1: on all tags, is causing an error - but only on one line, here:

 

<ns1:Engine Flatten="true" PromptSet="Default">Authenticate</ns1:Engine>

 

I need this to construct is as here:

 

<qas:Engine Flatten="true" PromptSet="Default">Authenticate</qas:Engine>

 

or with no namespace at all:

 

<Engine Flatten="true" PromptSet="Default">Authenticate</Engine>

 

Is this possible ??

 

Perhaps I shouldn't be using soapClient.

 

Any ideas ?!

 

Thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/180102-soap-envelope-amend-namespace-help/
Share on other sites

I'd like to change it but I can't as it's automatically created from the soapClient call, I seem to have no control over it. I wish I did. I'd like to say URI = "qas" or something, but I've searched for what seems like days, and can see no way of doing it. I've come across a few posts that call this a PHP bug, but I'm not sure.

 

I wonder if the WSDL file is at fault ?

 

I have no idea how these things work yet, but if it helps, here are the first few lines of the WSDL file in question:

 

<?xml version="1.0" encoding="utf-8" ?> 
- <definitions name="QAS" targetNamespace="http://www.qas.com/web-2005-10" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:qas="http://www.qas.com/web-2005-10">
- <types>
- <xs:schema elementFormDefault="qualified" targetNamespace="http://www.qas.com/web-2005-10" xmlns="http://www.w3.org/2001/XMLSchema">

 

Does anyone know how to build a SOAP request using non-wsdl soap client ?

 

It looks like it may achieve what I'm after, but I'm not sure what to put in location or uri

 

It works something like:

 

$client = new SoapClient(null, array('location' => "http://localhost/soap.php",
                                     'uri'      => "http://test-uri/",
                                     'style'    => SOAP_DOCUMENT,
                                     'use'      => SOAP_LITERAL));

 

And then I think you can add XML in the form of a variable.

 

Anyone have any experience sending custom SOAP Requests like this ??

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.