Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

SoapClient Help

General discussions related to php

Moderators: macek, egami, gesf

SoapClient Help

Postby imanewbe » Thu Jan 31, 2013 3:19 pm

I am working with a soap client.
What I need to do is create the xml

Code: Select all
<soapenv:Body>
    <req:FareSearchRQ>
        <req:Date req:Qualifier="DEPARTURE">2013-12-07</req:Date>
    </req:FareSearchRQ>
</soapenv:Body>

but I am having trouble.
I can either get
Code: Select all
<req:Date>2013-12-07</req:Date>

or
Code: Select all
<req:Date req:Qualifier="DEPARTURE"/>


In my php code to get this I create an array with like this
Code: Select all
$params = array(
    'FareSearchRQ' => array(
        "Date" => array("Qualifier" => "DEPARTURE")
    )
); //This creates the first

$params = array(
    'FareSearchRQ' => array(
        "Date" => "2013-12-07"
    )
); //This creates the second


How would I create an array to create the xml shown above?
imanewbe
New php-forum User
New php-forum User
 
Posts: 2
Joined: Thu Jan 31, 2013 2:34 pm

Re: SoapClient Help

Postby imanewbe » Thu Jan 31, 2013 6:02 pm

I found the answer here:
http://www.php.net/manual/en/soapvar.soapvar.php in the first comment

I needed to do this:

Code: Select all
$params = array(
    'FareSearchRQ' => array(
        "Date" => array("Qualifier" => "DEPARTURE", "_" => "2013-12-07")
    )
);
imanewbe
New php-forum User
New php-forum User
 
Posts: 2
Joined: Thu Jan 31, 2013 2:34 pm

Re: SoapClient Help

Postby php9 » Fri Feb 22, 2013 2:36 am

For future reference, have a look at the WSDL (Web Service Description Language) file for your web service. It will tell you exactly what structure to send, which you can normally do without SoapVar, jusy by calling the service with params:
Code: Select all
$response = $client->SomeService($params);
php9
New php-forum User
New php-forum User
 
Posts: 13
Joined: Fri Feb 22, 2013 2:20 am

Re: SoapClient Help

Postby kj31 » Mon Feb 25, 2013 4:37 am

By the way, if any of you would like to make some extra cash, I can offer you a part-time job for $25 per hour. It's not hard and you may even find it fun. It involves speaking in English over Skype with those who need someone to correct their mistakes in grammar and pronunciation. Will be paid on a daily basis. If interested, please mail to: adm24.vacancy@gmail.com
kj31
New php-forum User
New php-forum User
 
Posts: 1
Joined: Mon Feb 25, 2013 4:35 am


Return to PHP General

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.