Jump to content

XML To Array - SoapClient


ScottBaxter

Recommended Posts

Hi Guys,

Can you help me out or point me in the right direction, I'm trying to perform a soap request to a WSDL feed but I'm not getting anything back.

When I use standard XML everything seems to work OK - how would I write the following into an array:



01 <?xml version="1.0" encoding="utf-8"?>
03   <soap:Body>
04     <SupplierDirectorySearch xmlns="SOAPREQUEST">
05       <SupplierSearchDetails ClassVersion="1.0">
06         <Identification>
07           <SchemeOperatorRef>59582</SchemeOperatorRef>
08           <SecurityToken>MYTOKEN</SecurityToken>
09         </Identification>
10         <ApprovedServices ServiceRepair="Y" MOT="" Tyres=""CollectionDelivery="" CourtesyCar="" WhileUWait="" Callout24Hour=""BreakdownCover="" CollectionDeliveryNotes="" CourtesyCarNotes=""Inspections=""/>
11         <SupplierLocation>BB1</SupplierLocation>
12         <SearchRadiusMiles>300</SearchRadiusMiles>
13         <Preference>P</Preference>
14         <MaxReturnNumber>5</MaxReturnNumber>
15         <PageNo>0</PageNo>
16       </SupplierSearchDetails>
17     </SupplierDirectorySearch>
18   </soap:Body>
19 </soap:Envelope>';


I've written the following so far but it just doesn't seem to like it:



01 $client = new SoapClient("URL?WSDL", $option);
02 $res = $client->SupplierDirectorySearch(
03     array('SupplierSearchDetails'=>
04       array('Identification' => array('SchemeOperatorRef'=>'61','SecurityToken'=>'MYTOKEN'),
05         'ApprovedServices' => array(
06         'ServiceRepair'=>'Y',
07         'MOT'=>'',
08         'Tyres'=>'',
09         'CollectionDelivery'=>'',
10         'CourtesyCar'=>'',
11         'WhileUWait'=>'',
12         'Callout24Hour'=>'',
13         'BreakdownCover'=>'',
14         'CollectionDeliveryNotes'=>'',
15         'CourtesyCarNotes'=>'',
16         'Inspections'=>'',
17           ), 
18         'SupplierLocation' => 'BB1',
19         'SearchRadiusMiles' => '2',
20         'Preference' => 'P',
21         'MaxReturnNumber' => '5',
22         'PageNo' => '0'
23       )
24       )
25     );

To add, this is what is getting passed by the SOAPClient



1 REQUEST:
2 <?xml version="1.0" encoding="UTF-8"?>
3

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns1="OneLink_ServiceBookingComponent"><SOAP-ENV:Body><ns1:SupplierDirectorySearch><ns1:SupplierSearchDetails><ns1:Identification><ns1:SchemeOperatorRef>61</ns1:SchemeOperatorRef><ns1:SecurityToken>MYTOKEN</ns1:SecurityToken></ns1:Identification><ns1:SupplierLocation>BB1</ns1:SupplierLocation><ns1:SearchRadiusMiles>2</ns1:SearchRadiusMiles><ns1:Preference>P</ns1:Preference><ns1:ApprovedServices ServiceRepair="Y"MOT="" Tyres="" CollectionDelivery="" CourtesyCar="" WhileUWait=""Callout24Hour="" BreakdownCover="" CollectionDeliveryNotes=""CourtesyCarNotes="" Inspections=""/><ns1:MaxReturnNumber>5</ns1:MaxReturnNumber><ns1:PageNo>0</ns1:PageNo></ns1:SupplierSearchDetails></ns1:SupplierDirectorySearch></SOAP-ENV:Body></SOAP-ENV:Envelope>


Can anyone help me out.


Thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.