SOAP Body Formation
| From: | Vandegrift, Ken | Date: | Tue, 27 Jun 2006 00:55:55 +0000 |
| Subject: | SOAP Body Formation | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-2337@lists.php.net to get a copy of this message | ||
Hello to all,
I am trying to get my head around building a SOAP request that activates
and adds a purchased amount to a gift card for online orders. I am using
the built-in extension to PHP 5.1.2
The SOAP body that is required for this operation is as follows:
<header-info>
<merchant-id>1234</merchant-id>
<store-code>myStore</store-code>
<agent-name>ABC 123</agent-name>
<terminal-id>0</terminal-id>
<pos-transaction-id>999</pos-transaction-id>
<datetime>2006-06-26T14:18:51</datetime>
</header-info>
<card-info>
<swipe-flag>false</swipe-flag>
<printed-card-number>1234561234561234</printed-card-number>
</card-info>
<add-wallet-content>
<item-type>5</item-type>
<item-id>444</item-id>
<quantity>25.00</quantity>
</add-wallet-content>
Code example:
$client = new SoapClient('path/to/wsdl', array('login' => 'login',
'password' => 'pwd'));
At this point, I have initiated my connection handle and I can view SOAP
methods ($client->__getFunctions();)
The method I need for this service is:
activate-add(activate-add-request $body)
the 'activate-add-request' is the xml fragment above. Now, when I try
to use this method as $client->activate-add($request), I get errors from
PHP stating that SoapClient::$activate property is undefined and
SoapClient::$add is undefined. Is there additional setup that needs to
be done by my script to access these methods?
Do I need to build this request with SoapParam or SoapVar or do I build
the xml as a string and pass it to this method?
I'm new with SOAP so any suggestions are always appreciated.
Thanks.
Ken Vandegrift