NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
help constructing arrays for XML call


Joined: 21 Aug 2007
Posts: 11
Reply with quote
Hi All.

I am using nusoap and its pretty decent. I however need to construct the correct arrays to be sent to the webservice and having some problems.
See below:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SubscriptionSignUp xmlns="http://localhost/">
<ISPID>yy</ISPID>
<ISPPassword>xx</ISPPassword>
<ISPUserID>XX0fgfgg3</ISPUserID>
<PackageList>
<Package>
<ISPSKU xmlns="param:scssParamClass">123451234512345</ISPSKU>
<PackageQty xmlns="param:scssParamClass">1</PackageQty>
</Package>
</PackageList>
<ClientReference> </ClientReference>
<SiteName> </SiteName>
</SubscriptionSignUp>
</soap:Body>
</soap:Envelope>


I have done the following:

//wsdl file declared above in script and is correct....
$client=new soapclient($wsdlfile, 'wsdl'); //, true);

$client->soap_defencoding = 'utf-8';

$err = $client->getError();
if ($err) {
// Display the error
echo '<p><b>Constructor error: ' . $err . '</b></p>';
// At this point, you know the call that follows will fail
}

$param = array('ISPID' => "yy", 'ISPPassword' => "xx", 'ISPUserID'=>"XX0fgfgg3", 'ISPSKU'=>"123123123123134,0010451,123123123134567");

$result = $client->call('SubscriptionSignUp', array('parameters' => $param));


But im not sure how to get the PackageList and Package part into the array? Also the SubscriptionSignUp comes up twice in the XML request to the webservice.

Are there any pointers?most examples I have seen are quite simple.

Thanks in advance.

--
------------------------------------------------------------------------
Angelo Zanetti
Systems developer
------------------------------------------------------------------------

*Telephone:* +27 (021) 552 9799
*Mobile:* +27 (0) 72 441 3355
*Fax:* +27 (0) 86 681 5885
*

*E-Mail:* angelo@zlogic.co.za <mailto:angelo@zlogic.co.za>
View user's profileFind all posts by zlogicSend private message


Joined: 26 Jul 2007
Posts: 14
Reply with quote
Have you considered doing it this way:

1. create an array for your input data
2. pass the array to your client call

i.e.

<SubscriptionSignUp xmlns="http://localhost/">
<ISPID>yy</ISPID>
<ISPPassword>xx</ISPPassword>
<ISPUserID>XX0fgfgg3</ISPUserID>
<PackageList>
<Package>
<ISPSKU xmlns="param:scssParamClass">123451234512345</ISPSKU>
<PackageQty xmlns="param:scssParamClass">1</PackageQty>
</Package>
</PackageList>
<ClientReference> </ClientReference>
<SiteName> </SiteName>
</SubscriptionSignUp>


would be something like:
Code:

$Request = array(
'SubscriptionSignUp'=>array(
     'ISPID' => 'yy',
     'ISPPassword' => 'xx',
     'ISPUserID'=>'XX0fgfgg3',
     'PackageList'=> array(
          'Package' => array(
               'ISPSKU'=>'123451234512345',
               'PackageQty'=>'1'
          )
     ),
     'ClientReference'=>'',
     'SiteName'=>'',
)
)


and then you'd use it like this:

Code:
$result = $client->call('SubscriptionSignUp', $Request)
View user's profileFind all posts by addisonpSend private message
Construct the XML Request message for web service


Joined: 28 Apr 2008
Posts: 1
Reply with quote
Can any body help me out in passing below written xml request as an array to client script:

<s:Envelope>
<s:Body>
<EVRN_UnitDescriptiveInfoRQ TransactionIdentifier="72196cc1-db31-48b7-a4d8-cf28b3db65db" EchoToken="request" Version="1.0">
<POS>
<Source>
<RequestorID ID="Username" MessagePassword="Password"/>
</Source>
</POS>
<UnitDescriptiveInfos>
<UnitDescriptiveInfo UnitCode="1243-21426">
<UnitInfo/>
</UnitDescriptiveInfo>
</UnitDescriptiveInfos>
</EVRN_UnitDescriptiveInfoRQ>
</s:Body>
</s:Envelope>
View user's profileFind all posts by shilpiSend private message
help constructing arrays for XML call
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic