pear soap xml request

Gardarika

New Member
I am attempting to communicate with an API through PEAR SOAPI am able to create a SOAP request with the following code, but it is not complete.\[code\] <?php require_once 'SOAP/Client.php'; $client = new SOAP_Client('https://api.mindbodyonline.com/0_5/SiteService.asmx? wsdl',true); $options = array('namespace' => 'http://schemas.xmlsoap.org/soap/envelope/', 'trace' => 1, 'SOAPAction' => 'http://clients.mindbodyonline.com/api/0_5/GetLocations', 'Host'=> 'clients.mindbodyonline.com' ); $ret = $client->call( 'GetLocations', array( 'Request'=>array('SourceCredentials' => array('SourceName'=>'*****','Password'=>'*****************','siteIDs'=> array('int'=>'23661'))),'XMLDetail'=>'Full','PageSize'=>'10','CurrentPageIndex'=>'0') ,$options); echo '<pre>'.htmlspecialchars($client->getLastRequest()).'</pre>'; ?>\[/code\]This results in the following SOAP Request:\[code\] POST /0_5/SiteService.asmx HTTP/1.0 User-Agent: PEAR-SOAP @version@-beta Host: api.mindbodyonline.com Content-Type: text/xml; charset=UTF-8 Content-Length: 464 SOAPAction: "http://clients.mindbodyonline.com/api/0_5/GetLocations" Connection: close <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4="http://clients.mindbodyonline.com/api/0_5"> <SOAP-ENV:Body> <ns4:GetLocations> <Request>Array</Request></ns4:GetLocations> </SOAP-ENV:Body> </SOAP-ENV:Envelope>\[/code\]When it needs to be in this format:\[code\] POST http://clients.mindbodyonline.com/api/0_5/SiteService.asmx HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: text/xml;charset=UTF-8 SOAPAction: "http://clients.mindbodyonline.com/api/0_5/GetLocations" Host: clients.mindbodyonline.com Content-Length: 795 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <GetLocations xmlns="http://clients.mindbodyonline.com/api/0_5"> <Request> <SourceCredentials> <SourceName>{SourceName}</SourceName> <Password>{Password}</Password> <SiteIDs> <int>{SiteID}</int> </SiteIDs> </SourceCredentials> <XMLDetail>Bare</XMLDetail> <PageSize>10</PageSize> <CurrentPageIndex>0</CurrentPageIndex> <Fields> <string>Locations.Name</string> <string>Locations.City</string> </Fields> </Request> </GetLocations> </soapenv:Body> </soapenv:Envelope>\[/code\]Maybe I need a fresh set of eyes to look at this as I have been toying with it for MANY hours. Any input or suggestions would be appreciated.WSDL link is: https://api.mindbodyonline.com/0_5/SiteService.asmx?wsdl
 
Back
Top