Returning an array to a .NET server
| From: | Mike Carter | Date: | Thu, 31 Jul 2003 10:25:36 +0000 |
| Subject: | Returning an array to a .NET server | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-900@lists.php.net to get a copy of this message | ||
Hi,
Out .NET webservice is expecting an array of 'Applicant' objects (complexTypes)
as described by its WSDL. An extract of the SDL is below...
<s:complexType name="Applicant">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Title"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Initials"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="FirstName"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Surname"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="FullName"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="AddressLines"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Town"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="County"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Country"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Postcode"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="DaytimeNumber"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="EveningNumber"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="MobileNumber"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="EmailAddress"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="AffiliateGroup"
type="s:string"/>
<s:element minOccurs="1" maxOccurs="1"
name="ChildApplicationsRequired"
type="s:int"/>
</s:sequence>
</s:complexType>
<s:complexType name="ArrayOfApplicant">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="Applicant"
nillable="true"
type="s0:Applicant"/>
</s:sequence>
</s:complexType>
The problem is on the client side (PHP) we're trying to send an array of
'Applicants' back to the server side.
To add the object to the array I use:
$AppPackRequest->ApplicantList[] = new SOAP_Value('Applicant', 'Applicant',
$App);
$App is an instance of a populate object as defined in the servers WSDL.
However the xml wire produced on the PHP client side is without the 'ns4:'
infront of name now! It should be <ns4:Applicant> surely?
<ns4:ApplicantList>
<Applicant>
<TitleId>1</TitleId>
<FirstName>Steven</FirstName>
<Surname>Fisk</Surname>
<Initials>SP</Initials>
<FullName>Steven Paul Fisk</FullName>
<AddressLines>12 Broadway Farnworth</AddressLines>
<Town>Bolton</Town>
<County>Lancashire</County>
<Country>UK</Country>
<Postcode>BL4 0HQ</Postcode>
<DaytimeNumber>0161 9272337</DaytimeNumber>
<EveningNumber>01204 391516</EveningNumber>
<MobileNumber>07789 543326</MobileNumber>
<EmailAddress>sfisk@quantiv.com</EmailAddress>
<AffiliateGroupId>1001</AffiliateGroupId>
<ChildApplicationsRequired>0</ChildApplicationsRequired>
</Applicant>
</ns4:ApplicantList>
I'm a little confused with arrays in SOAP. Help/comments appreciated.
THanks,
mc.
--
http://www.buddasworld.co.uk
----------------------------------------------
This mail sent through http://www.ukonline.net