Jump to content

PEAR SOAP debugging


nymets1104

Recommended Posts

I am attempting to implement an API on my website using WSDL through SOAP. My hosting company (fatcow) does not support PHP SOAP. They do however support PEAR SOAP 0.9.1. I have continuosly ran into the error: Server was unable to process request. --- Object reference not set to an instance of an object. I believe I am possibly forming the XML SOAP request incorrectly. The getLastRequest() method is not returning anything for debugging. The var_dump() method is returning an enormous amount of information. I am looking for some guidance in debugging this SOAP call.

 

I have included my php code below with the resulting XML SOAP request found in my var_dump.

<?php
require_once 'SOAP/Client.php';

$WSDL=new SOAP_WSDL('https://api.mindbodyonline.com/0_5/SiteService.asmx?wsdl',array(trace=>1));
$proxy=$WSDL->getProxy();

$options=array('soapaction' => 'http://clients.mindbodyonline.com/api/0_5/GetLocations');

$params = array('Request'=>array('SourceCredentials' => array('SourceName'=>'StudioSevaYoga','Password'=>'*************','siteIDs'=>array('int'=>'23661')),'XMLDetail'=>'Full','PageSize'=>'10','CurrentPageIndex'=>'0'));

$ret = $proxy->call("GetLocations",$params,$options);

var_dump($ret);
?>

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: 862
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/"
 SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<GetLocations>
<Request>
<SourceCredentials>
<SourceName xsi:type="xsd:string">StudioSevaYoga</SourceName>
<Password xsi:type="xsd:string">********************</Password>
<siteIDs>
<int xsi:type="xsd:string">23661</int></siteIDs></SourceCredentials>
<XMLDetail xsi:type="xsd:string">Full</XMLDetail>
<PageSize xsi:type="xsd:string">10</PageSize>
<CurrentPageIndex xsi:type="xsd:string">0</CurrentPageIndex></Request></GetLocations>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

WSDL: https://api.mindbodyonline.com/0_5/SiteService.asmx?wsdl

 

My php page throwing error: http://studio-seva.com/pearSoap5.php

 

Any help would be greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/276635-pear-soap-debugging/
Share on other sites

For anyone attempting to use PEAR SOAP with their Webservice, I was able to generate the proxy code for each class from the WSDL by using the PEAR SOAP method generateProxyCode() to generate PEAR SOAP compliant code that is slightly different than the standard php.
 

Example: http://stackoverflow.com/questions/16...

PEAR SOAP documentation: http://pear.php.net/package/SOAP/docs...

I was finally able to make a valid request and get a response after nearly 3 weeks of hair pulling and testing with my webservice

Link to comment
https://forums.phpfreaks.com/topic/276635-pear-soap-debugging/#findComment-1423482
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.