Re: [SOAP] Need help figuring out what I'm doing wrong accessing this Web Service
[email protected] (newcoder) Thu, 30 Dec 2010 10:29:47 -0800 (PST)
| Newsgroups | php.soap |
|---|---|
| Message-ID | <[email protected]> |
RQuadling wrote:
>
> Can you var_dump($service->__getLastResponse()) to show EXACTLY what
> is returned?
>
> It is entirely possible to create a class which matches the response
> type and add that class to the soapclient classmap. That way, you will
> get a decoded object as the result rather than a junk string.
>
>
OK, well, I var_dump($agLogin->__getLastResponse()) // the client for their
login soap server
then I var_dump($agDataClient->__getLastResponse()) // the client for the
actual data access service
Both return NULL
I've reworked the code, it's as follows:
<?php
// Connect to agwebservice/AgemniLogin
$agLogURL = "https://www.agemni.com/_snet/AgemniLogin.asmx?WSDL";
$myLogin->dn = "myDN";
$myLogin->username = "myUserName";
$myLogin->password = "myPassword";
$agLogin = new SoapClient($agLogURL);
$agLoginResults = $agLogin->aglogin($myLogin);
echo '<h2> AgemniLogin Connection: </h2>';
echo '<p style="color:red"> $agLogin { soap client - agemni session login
} </p>';
echo '<p style="color:blue"> print_r: </p>';
print_r($agLogin);
echo '<p style="color:blue"> var_dump: </p>';
var_dump($agLogin);
echo '<hr>';
// get cookie information from $agLogin session
$agCookie = $agLogin->_cookies;
echo '<p style="color:red"> $agCookie = $agLogin->_cookies</p>';
echo '<p style="color:blue"> print_r: </p>';
print_r($agCookie);
echo '<p style="color:blue"> var_dump: </p>';
var_dump($agCookie);
echo '<hr>';
$agSession = $agCookie[AGSESSION];
echo '<p style="color:red"> $agSession = $agCookie[AGSESSION]</p>';
echo '<p style="color:blue"> print_r: </p>';
print_r($agSession);
echo '<p style="color:blue"> var_dump: </p>';
var_dump($agSession);
echo '<p style="color:green"> $agSession[0] = ';
echo $agSession[0];
echo '</p>';
echo '<p style="color:green"> $agSession[1] = ';
echo $agSession[1];
echo '</p>';
echo '<p style="color:green"> $agSession[2] = ';
echo $agSession[2];
echo '</p>';
echo '<hr>';
// now connect to agwebservice/ADBAccess
echo '<h2> Connect to Agemni Data Access Service ADBAccess</h2>';
$agDataURL = "http://www.agemni.com/_anet/ADBAccess.asmx?WSDL";
$agDataClient = new SoapClient($agDataURL);
echo '<p style="color:red"> $agDataClient { soap client - agemni Data
Connection } </p>';
echo '<p style="color:blue"> print_r: </p>';
print_r($agDataClient);
echo '<p style="color:blue"> var_dump: </p>';
var_dump($agDataClient);
echo '<hr>';
// set cookie information for $agDataClient
echo '<p style="color:green"> try setting cookies -
$agDataClient->_cookies = $agCookie </p>';
$agDataClient->_cookies = $agCookie;
echo '<p style="color:green"> then look at contents of $agDataClient again
</p>';
echo '<p style="color:red"> $agDataClient { soap client - agemni Data
Connection } </p>';
echo '<p style="color:blue"> print_r: </p>';
print_r($agDataClient);
echo '<p style="color:blue"> var_dump: </p>';
var_dump($agDataClient);
echo '<hr>';
echo '<p style="color:red"> $agDataSet =
$agDataClient->getCMSData($agDataParams) </p>' ;
$agDataParams->opName = 'appointment';
$agDataParams->startDate = '12/29/2010 12:01:00 AM';
$agDataParams->endDate = '12/29/2010 4:00:00 PM';
$agDataSet = $agDataClient->getCMSData($agDataParams);
echo '<p style="color:blue"> print_r($agDataSet) </p>';
print_r($agDataSet);
echo '<p style="color:blue"> var_dump($agDataSet) </p>';
var_dump($agDataSet);
echo '<hr>';
$agDataResult = $agDataSet->getCMSDataResult;
echo '<p style="color:red"> $agDataResult = $agDataSet->getCMSDataReult
</p>';
echo '<p style="color:blue"> print_r($agDataResult)</p>';
print_r($agDataResult);
echo '<p style="color:blue"> var_dump($agDataResult)</p>';
var_dump($agDataResult);
echo '<hr>';
// do var_dump of $agLogin->__getLastResponse
echo '<p style="color:green"> var_dump($agLogin->__getLastResponse())
</p>';
var_dump($agLogin->__getLastResponse());
// do var_dump of $agDataClient->__getLastResponse
echo '<p style="color:green"> var_dump($agDataClient->__getLastResponse())
</p>';
var_dump($agDataClient->__getLastResponse());
?>
Below you will find the resulting output:
AgemniLogin Connection:
$agLogin { soap client - agemni session login }
print_r:
SoapClient Object ( [_soap_version] => 1 [sdl] => Resource id #4
[httpsocket] => Resource id #5 [_use_proxy] => 0 [httpurl] => Resource id #6
[_cookies] => Array ( [AGSESSION] => Array ( [0] =>
AW1GerFHiTjs7kCPrE++rZE/ATSCqFLaUqeR6HNzzVIEBV3jF2MO6A== [1] => / [2] =>
www.agemni.com ) ) )
var_dump:
object(SoapClient)#2 (6) { ["_soap_version"]=> int(1) ["sdl"]=> resource(4)
of type (Unknown) ["httpsocket"]=> resource(5) of type (stream)
["_use_proxy"]=> int(0) ["httpurl"]=> resource(6) of type (Unknown)
["_cookies"]=> array(1) { ["AGSESSION"]=> array(3) { [0]=> string(56)
"AW1GerFHiTjs7kCPrE++rZE/ATSCqFLaUqeR6HNzzVIEBV3jF2MO6A==" [1]=> string(1)
"/" [2]=> string(14) "www.agemni.com" } } }
$agCookie = $agLogin->_cookies
print_r:
Array ( [AGSESSION] => Array ( [0] =>
AW1GerFHiTjs7kCPrE++rZE/ATSCqFLaUqeR6HNzzVIEBV3jF2MO6A== [1] => / [2] =>
www.agemni.com ) )
var_dump:
array(1) { ["AGSESSION"]=> array(3) { [0]=> string(56)
"AW1GerFHiTjs7kCPrE++rZE/ATSCqFLaUqeR6HNzzVIEBV3jF2MO6A==" [1]=> string(1)
"/" [2]=> string(14) "www.agemni.com" } }
$agSession = $agCookie[AGSESSION]
print_r:
Array ( [0] => AW1GerFHiTjs7kCPrE++rZE/ATSCqFLaUqeR6HNzzVIEBV3jF2MO6A== [1]
=> / [2] => www.agemni.com )
var_dump:
array(3) { [0]=> string(56)
"AW1GerFHiTjs7kCPrE++rZE/ATSCqFLaUqeR6HNzzVIEBV3jF2MO6A==" [1]=> string(1)
"/" [2]=> string(14) "www.agemni.com" }
$agSession[0] = AW1GerFHiTjs7kCPrE++rZE/ATSCqFLaUqeR6HNzzVIEBV3jF2MO6A==
$agSession[1] = /
$agSession[2] = www.agemni.com
Connect to Agemni Data Access Service ADBAccess
$agDataClient { soap client - agemni Data Connection }
print_r:
SoapClient Object ( [_soap_version] => 1 [sdl] => Resource id #9 )
var_dump:
object(SoapClient)#5 (2) { ["_soap_version"]=> int(1) ["sdl"]=> resource(9)
of type (Unknown) }
try setting cookies - $agDataClient->_cookies = $agCookie
then look at contents of $agDataClient again
$agDataClient { soap client - agemni Data Connection }
print_r:
SoapClient Object ( [_soap_version] => 1 [sdl] => Resource id #9 [_cookies]
=> Array ( [AGSESSION] => Array ( [0] =>
AW1GerFHiTjs7kCPrE++rZE/ATSCqFLaUqeR6HNzzVIEBV3jF2MO6A== [1] => / [2] =>
www.agemni.com ) ) )
var_dump:
object(SoapClient)#5 (3) { ["_soap_version"]=> int(1) ["sdl"]=> resource(9)
of type (Unknown) ["_cookies"]=> array(1) { ["AGSESSION"]=> array(3) { [0]=>
string(56) "AW1GerFHiTjs7kCPrE++rZE/ATSCqFLaUqeR6HNzzVIEBV3jF2MO6A==" [1]=>
string(1) "/" [2]=> string(14) "www.agemni.com" } } }
$agDataSet = $agDataClient->getCMSData($agDataParams)
print_r($agDataSet)
stdClass Object ( [getCMSDataResult] => stdClass Object ( [any] =>
12/29/2010 12:01:00 AM12/29/2010 4:00:00 PM ) )
var_dump($agDataSet)
object(stdClass)#7 (1) { ["getCMSDataResult"]=> object(stdClass)#8 (1) {
["any"]=> string(296) "12/29/2010 12:01:00 AM12/29/2010 4:00:00 PM" } }
$agDataResult = $agDataSet->getCMSDataReult
print_r($agDataResult)
stdClass Object ( [any] => 12/29/2010 12:01:00 AM12/29/2010 4:00:00 PM )
var_dump($agDataResult)
object(stdClass)#8 (1) { ["any"]=> string(296) "12/29/2010 12:01:00
AM12/29/2010 4:00:00 PM" }
var_dump($agLogin->__getLastResponse())
NULL
var_dump($agDataClient->__getLastResponse())
NULL
it should be returning data somewhere in $agDataSet or $agDataResult, but
there is no data except what I submitted. I'm not certain I'm setting the
cookies right, or what I might be doing wrong here.
Again, the documentation for their webservice is here:
http://wiki.agemni.com/Getting_Started/APIs/Agemni_CMS_Sync
http://wiki.agemni.com/Getting_Started/APIs/Agemni_CMS_Sync
Near the bottom is an example of how to access the service using vb.net and
at the bottom is an example given in Python. Not sure if they provide any
additional insight, I don't do python or VB.Net so they are little help to
me.
Any help would be greatly appreciated.
--
View this message in context: http://old.nabble.com/Need-help-figuring-out-what-I%27m-doing-wrong-accessing-this-Web-Service-tp30552173p30559168.html
Sent from the Php - Soap mailing list archive at Nabble.com.