LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-07-2014, 05:26 AM   #1
sobin.babu
LQ Newbie
 
Registered: Jan 2014
Posts: 1

Rep: Reputation: Disabled
SOAP server returns array using NuSOAP Library Not Working


Hi,

I am using NuSOAP library to write a SOAP server code. I am generating a return array and I am writing the return xml to a log folder and it shows that return was null. Here is the sample code I used,

$server->wsdl->addComplexType( 'Customers' => array('name' => 'Customers', 'type' => 'tns:ArrayOfWebCustomerDto', 'minOccurs' => '0', 'maxOccurs' => '1')));

$server->wsdl->addComplexType( 'ArrayOfWebCustomerDto', 'complexType', 'struct', 'all', '', array( 'CustomerInterface' => array('name' => 'CustomerInterface', 'type' => 'tns:WebCustomerDto', 'minOccurs' => '0', 'maxOccurs' => 'unbounded', 'nillable' => 'true' )) );

$server->wsdl->addComplexType( 'WebCustomerDto', 'complexType', 'struct', 'all', '', array( 'ChangeId' => array('name' => 'ChangeId','type' => 'xsd:int', 'minOccurs' => '1', 'maxOccurs' => '1', 'nillable' => 'true'), 'Username' => array('name' => 'Username', 'type' => 'xsd:string', 'minOccurs' => '0', 'maxOccurs' => '1'), 'Email' => array('name' => 'Email', 'type' => 'xsd:string', 'minOccurs' => '0', 'maxOccurs' => '1'), 'FirstName' => array('name' => 'FirstName', 'type' => 'xsd:string', 'minOccurs' => '0', 'maxOccurs' => '1'), 'LastName' => array('name' => 'LastName', 'type' => 'xsd:string', 'minOccurs' => '0', 'maxOccurs' => '1'), 'StreetAddress' => array('name' => 'StreetAddress', 'type' => 'xsd:string', 'minOccurs' => '0', 'maxOccurs' => '1'), 'StreetAddress2' => array('name' => 'StreetAddress2', 'type' => 'xsd:string', 'minOccurs' => '0', 'maxOccurs' => '1'), 'City' => array('name' => 'City', 'type' => 'xsd:string', 'minOccurs' => '0', 'maxOccurs' => '1'), 'ZipPostalCode' => array('name' => 'ZipPostalCode', 'type' => 'xsd:string', 'minOccurs' => '0', 'maxOccurs' => '1'), 'PhoneNumber' => array('name' => 'PhoneNumber', 'type' => 'xsd:string', 'minOccurs' => '0', 'maxOccurs' => '1') ) );

Here is the result xml format needed,
<?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>
<ExchangeInterfaceDataResponse xmlns="http://test.com/">
<ExchangeInterfaceDataResult>
<Customers>
<CustomerInterface>
<ChangeId>int</ChangeId>
<Username>string</Username>
<Email>string</Email>
<FirstName>string</FirstName>
<LastName>string</LastName>
<StreetAddress>string</StreetAddress>
<StreetAddress2>string</StreetAddress2>
<City>string</City>
<ZipPostalCode>string</ZipPostalCode>
<PhoneNumber>string</PhoneNumber>
</CustomerInterface>
<CustomerInterface>
<ChangeId>int</ChangeId>
<Username>string</Username>
<Email>string</Email>
<FirstName>string</FirstName>
<LastName>string</LastName>
<StreetAddress>string</StreetAddress>
<StreetAddress2>string</StreetAddress2>
<City>string</City>
<ZipPostalCode>string</ZipPostalCode>
<PhoneNumber>string</PhoneNumber>
</CustomerInterface>
</Customers>
</ExchangeInterfaceDataResult>
</ExchangeInterfaceDataResponse>
</soap:Body>
</soap:Envelope>

This is the array I am generating,

Array
( [ExchangeInterfaceDataResult] => Array
(
[Customers] => Array
(
[CustomerInterface] => Array
(
[0] => Array
(
[ChangeId] => 1
[Username] => test1@test1.com
[Email] => test1@test1.com
[FirstName] => Test1
[LastName] => Test1
[StreetAddress] => Test 1
[StreetAddress2] =>
[City] => Test
[ZipPostalCode] => 1234
[PhoneNumber] => 123456
)

[1] => Array
(
[ChangeId] => 2
[Username] => test2@test2.com
[Email] => test2@test2.com
[FirstName] => Test2
[LastName] => Test2
[StreetAddress] => Test 2
[StreetAddress2] =>
[City] => Test
[ZipPostalCode] => 4321
[PhoneNumber] => 654321
)

)

)

)

)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
php / SOAP - is it possible to return many values in a soap request? eantoranz Programming 1 04-25-2012 03:21 PM
[SOLVED] CDemu returns error loading shared library libmirage.so.2 rohedin Linux - Software 5 09-02-2010 12:06 PM
REGEX from array, returns no matches. dr_strangelove Linux - Server 2 06-23-2010 06:30 PM
PHP SOAP server returns array using NuSOAP Library mohtasham1983 Programming 2 11-18-2007 09:27 PM
How to pass array to a function in Java so that it returns changed? kornerr Programming 1 09-19-2006 12:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration