tags:

views:

890

answers:

2

hey there

I'm trying to use a webservice which only allows SOAP request

as far as I know I must create a request that looks like this

<?xml version="1.0" encoding="utf-8"?>
<SessionCreateRQ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
  <POS>
    <Source PseudoCityCode="SECRET_CODE" />
  </POS>
</SessionCreateRQ>

however while adding the parameter to SessionCreateRQ method I don't know how to add the POS parameter called Source and have no clue on how to set the attribute for that parameter

im trying the following in php

  $body = array(
        'POS' => array('source' => 'PseudoCityCode:SECRET_CODE'));

    try
    {
        $result = $c->SessionCreateRQ($body);
    }

but no luck, does anyone has a clue on how should I construct this call properly ?

thanks !

A: 

It doesn't directly answer the question you were asking, but PHP has built-in functions for handling SOAP, both from the perspective of a server and a client. You should be able to find what you need in the SoapClient functions.

Chad Birch
Not really what im asking, I already understand the behavior of those but how the parameters are constructed is not very clear
PERR0_HUNTER
+1  A: 

Firstly you need WSDL definition for this service (online or in local file). Any not bad SOAP service provide WSDL to users.

Secondly you need translate WSDL service definition to PHP-code. Try wsdl2php generator. Its generate file with classes, that making calls to web-services.

Your example will be approximately as follows:

require_once 'GeneratedTypes.php';
$client = new SOAPService();
$res = $client->SessionCreateRQ(SECRET_CODE);

p.s. wsdl2php not ideal but it is working :)

drnk