ScottBaxter Posted March 15, 2013 Share Posted March 15, 2013 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"?> 02 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 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. Quote Link to comment https://forums.phpfreaks.com/topic/275689-xml-to-array-soapclient/ Share on other sites More sharing options...
gristoi Posted March 15, 2013 Share Posted March 15, 2013 a litle quick cheat to convert an xml string into a php array: $phpArray = json_decode(json_encode($xmlString)); if you do that then look at the outputted array it should point you in the right direction Quote Link to comment https://forums.phpfreaks.com/topic/275689-xml-to-array-soapclient/#findComment-1418798 Share on other sites More sharing options...
ScottBaxter Posted March 15, 2013 Author Share Posted March 15, 2013 Thanks - I think i know what I need to do. I need to assign some attributes to the ApprovedServices instead of an array... Thanks Quote Link to comment https://forums.phpfreaks.com/topic/275689-xml-to-array-soapclient/#findComment-1418803 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.