Page 1 of 1

PHP SOAP Newbie

Posted: Wed Sep 08, 2010 11:34 am
by lazybones51
Hi everybody

I need some help with creating a script which can query a clients XML Web service, the problem is I have never used SOAP before and after spending all day going around in circle am admitting defeat and asking for help :oops:

This is the request I need to create in PHP SOAP

Code: Select all

SOAP 1.0
XML IN (example):

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>

      <tem:AuthHeader>

         <tem:username>12345</tem:username>

         <!--Optional:-->

         <tem:password>12345</tem:password>

      </tem:AuthHeader>

   </soap:Header>

   <soap:Body>

      <tem:PremiumSeats>

         <tem:DateBegins>2009-11-10</tem:DateBegins>

         <tem:DateEnds>2009-11-18</tem:DateEnds>

         <!--Optional:-->

         <tem:OneShowCode>phantom</tem:OneShowCode>

      </tem:PremiumSeats>

   </soap:Body>
</SOAP-ENV:Envelope>
If anybody can help it would be most appreciated.

Re: PHP SOAP Newbie

Posted: Wed Sep 08, 2010 12:18 pm
by ell0bo
Um... do have a WSDL you're working from?

But, I would recommend you get Eclipse with the PHP plug in from http://www.eclipse.org/pdt/

Using that, you can go to http://www.eclipse.org/webtools/jst/com ... lorer.html (I'm pretty sure that's in the PDT, but i don't have a copy in front of me).

I highly recommend that utility to test web services and what not.

Re: PHP SOAP Newbie

Posted: Thu Sep 09, 2010 3:33 am
by lazybones51
I do have a WSDL file, unfortunately due to fire wall restrictions I can not access it from this machine :banghead:

I have install Eclipse, but I do not have the option to "Launch the Web Services Explorer" , do I need to install an extra plugin ?

Re: PHP SOAP Newbie

Posted: Fri Oct 01, 2010 3:25 am
by lazybones51
Sorry to drag this up ,have been away.

I have now got SOAP request returning from the Service Server using the PHP SOAP client, turns out there firewall was causing the issues I was having.

The new issue I have is that all of the results returned are in one object element, I think I am just being a bit thick and need some guidance, this is the response part from one of the functions in the WSDL file.

Code: Select all

  <s:element name="ShowBasicsResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="ShowBasicsResult>
              <s:complexType>
                <s:sequence>

                  <s:element ref="s:schema" />
                  <s:any />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element> 
output

Code: Select all

 
stdClass Object ( [schema] =>  [any] => 1051552MAM " 


You can see that the SOAP response is complextype, can anybody tell me how this should be displaying as I am currently getting one massive string of text which is useless to me . Thanks

Re: PHP SOAP Newbie

Posted: Fri Oct 01, 2010 6:18 am
by lazybones51
Sorted this one myself :D