webdude12 Posted August 12, 2008 Share Posted August 12, 2008 Ok, this is my first adventure in SOAP and WSDL at all. Everything I have done via an API to date has been using XML and CURL.... I will say that the tutorials on the web, are very basic and not very helpful when it comes to useful info about SOAP. Here is my code so far: <?PHP $wsdl="http://apps.xora.com/xoraapps/services/XoraTimeTrackLocationServices40?wsdl"; $client = new SoapClient("$wsdl", array('trace' => 1,'exceptions' => 0)); $creds = array("accountId"=>"xxxxx", "username"=>"admin", "password"=>"xxxxxx" ); $locations = array( "numberOfLocations"=>"1", "userId"=>"7834" ); $result = $client->getLatestLocation( new SoapParam(Credential, "$creds"), new SoapParam(LatestLocationDetailCriteria, "$locations") ); if (is_soap_fault($result)) { echo "Error Code <br />"; echo "---------- <br />"; $err_cd = $result->faultcode; $error_code = explode(":", $err_cd); echo "$error_code[1] <br />"; echo "$result->faultstring <br /><br />"; } var_dump($client->__getFunctions()); ?> and here is what I get back: Error Code ---------- Server Error. 3501 array(5) { [0]=> string(98) "ArrayOf_tns2_LandmarkStatus deleteLandmarks(Credential $credential, ArrayOf_xsd_string $landmarks)" [1]=> string(118) "GeofenceActivity40 getGeofenceActivity(Credential $credential, DateTimeRange $dateTimeRange, PageRequest $pageRequest)" [2]=> string(151) "LocationEntry40 getLocationEntries(Credential $credential, DateTimeRange $dateTimeRange, string $userId, string $eventFilter, PageRequest $pageRequest)" [3]=> string(115) "ArrayOf_tns2_LandmarkStatus createLandmarks(Credential $credential, Scope $scope, ArrayOf_tns2_Landmark $landmarks)" [4]=> string(160) "ArrayOf_tns2_LatestLocationDetails getLatestLocation(Credential $credential, LatestLocationDetailCriteria $locationDetailCriteria, SelectOptions $selectOptions)" } I am assuming my SoapClient is making connection, because I am getting back the function list. What I think is happening, is my values of my variables arent being set correctly. Maybe cause I am not setting Namespace??? Like I said, I have not found much help out on the web, if someone can point in the right direction, I do want to learn why and how to make this work, but right now, just appear to be running in circles. Quote Link to comment https://forums.phpfreaks.com/topic/119268-php5-soap-help/ Share on other sites More sharing options...
ignace Posted August 12, 2008 Share Posted August 12, 2008 have you tried the zend_services components from zend?, they also support SOAP and use an easier interface Quote Link to comment https://forums.phpfreaks.com/topic/119268-php5-soap-help/#findComment-614579 Share on other sites More sharing options...
webdude12 Posted August 12, 2008 Author Share Posted August 12, 2008 It appears to me that the Zend framework is the same commands as the PHP5 framework. Or maybe I am missing reading something... LOL Quote Link to comment https://forums.phpfreaks.com/topic/119268-php5-soap-help/#findComment-614770 Share on other sites More sharing options...
webdude12 Posted August 12, 2008 Author Share Posted August 12, 2008 Ok, I have narrowed it down to the variables for credential and locationDetailCriteria being sent Request : <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws40.xora.com" xmlns:ns2="http://timetrack.xora.com/TimeTrackServices40/common/type/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns3="http://timetrack.xora.com/TimeTrackServices40/location/type/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:getLatestLocation> <credential xsi:type="ns2:Credential"/> <locationDetailCriteria xsi:type="ns3:LatestLocationDetailCriteria"/> <selectOptions xsi:nil="true" xsi:type="ns2:SelectOptions"/> </ns1:getLatestLocation> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Quote Link to comment https://forums.phpfreaks.com/topic/119268-php5-soap-help/#findComment-614775 Share on other sites More sharing options...
webdude12 Posted August 12, 2008 Author Share Posted August 12, 2008 Ok, this is most A** backwards thing in php, but I have figured out my problem. new SoapParam(Credential, "$creds"), Has to be: new SoapParam($creds, Credential), Hopefully that will help someone else. :-) Quote Link to comment https://forums.phpfreaks.com/topic/119268-php5-soap-help/#findComment-614838 Share on other sites More sharing options...
webdude12 Posted August 12, 2008 Author Share Posted August 12, 2008 Ok, a little more help. I need to be able to set a type of: type="impl:ArrayOf_xsd_string" I use the following: $location->userId = new SoapVar("$user_id", XSD_STRING, 'ArrayOf_xsd_string', "http://www.w3.org/2001/XMLSchema"); but I get the following: <userId xsi:type="xsd:ArrayOf_xsd_string">7834</userId> I need the change the xsd: to impl: but I can not find an encoding type that will do so. Anyone have any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/119268-php5-soap-help/#findComment-615019 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.