Hi.

I'm stuck.

I have a requirement for a specific namespace within a soap request. I had previously been using soap client, and it worked well, but now I need to specify an alternate namespace, but I can't work out how to use soapClient in non-WSDL mode.

My requirement is to build the following soap request:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:qas="http://www.qas.com/web-2005-10">
<SOAP-ENV:Body>
<qas:QASearch>
<qas:Country>GBR</qas:Country>
<qas:Engine Flatten="true" PromptSet="Default">Authenticate</qas:Engine>
<qas:Layout>&lt;Default&gt;</qas:Layout>
<qas:SearchSpec>
  ..... DATA IN HERE [removed to make things easier]
</qas:SearchSpec>
</qas:QASearch>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

What I'm currently doing is using sending an arry to soapClient, but it forms it like this:

<?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>&lt;Default&gt;</ns1:Layout>
<ns1:SearchSpec>
 .... DATA REMOVED to make things easier
</ns1:SearchSpec>
</ns1:QASearch>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Note the ns1: namespace at the front of the tags.

THIS IS THE PROBLEM!

I either need to removed the ns1: altogther, or change to qas:

Now, I think you can build you're own header like this:

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

but I can find no decent documentation!

What is the location file. what is the uri link ?

Does anyone know if I can build and send a SOAP request as per the first bit of code ??

Thanks if you've got down this far ... HELP!

    darkgr33n,

    First things first, please space out your posts (seeing you posted one on the 3rd).

    However, I looked into QAS.COM, and it seems as if you are a buying customer, they provide PHP Source Code Examples?

    Have you thought of contacting them to see if they can provide them to you? Since this is a commercial product, they should be able to give you at least basic support, and on their address search page, they do say source code example provided for various languages, including PHP.

    I believe that is your best bet.

      Hi

      Thanks for your reply.

      Apologies for the other post, as you can see, I'm struggling with this and trying two different methods, so I thought two separate posts would be in order, as they are different questions [although they are regarding the same problem].

      You're right, we are a buying customer, however, we have not purchased the coding help!

      I've seen one PHP example, but it concerning PHP classes, and as a front-end developer, they seemed a little too deep for the timescale required.

      I spoke with QAS, who suggested the WSDL method.

      Using soapClient, I can complete the address check using this method, but the next bit, authenticate, is the bit causing problems. I spoke with them and they suggested removing the ns1: namespace from the tags, which nusoap is now doing, but I'm still getting the same error, so now I'm wondering if the headers are wrong somewhere.

      I'm new to SOAP, WSDL, and XML and am currently wishing I'd taken up another career!

      I am planning on going back to them, but am just researching and trying everything I can find, in the vain hope it will help!

      All the best

        darkgr33n,

        A Career in programming can be very rewarding!

        If they have provided you a PHP class, take a look if they have provided you any examples.

        Perhaps you can find out what portions of the class you can post to get help, maybe even just the function names (and parameter list) so that we can get you going with that.

        I would imagine it can't be that much harder than dealing with the heartache of a non-working system.

        I have little experience with SOAP clients myself and am getting deeper in (because of a project) but I am unsure of using a custom namespace.

        let me know what you are allowed to show us, and I can try to decipher the class to at least get this working.

          ha-ha, yes, can be, but not at the moment!

          thanks, I appreciate that.

          I've gone back to QAS asking for help doing it this way, will see what happens. If I have to tackle the classes, then I'll be back, thanks!

          nusoap has helped me construct a request to exactly match that required - albeit by using xml as a variable, still can't get it to take an array, see other post - but even with the correct looking request, I'm still getting an invalid parameters error, but of course, its not remotely helpful, like giving a line number or anything specific, so could be anywhere!

          cheers for taking an interest big.nerd, I do appreciate it.

            Write a Reply...