__PHP_Incomplete_Class Object question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

victorsk
Forum Commoner
Posts: 43
Joined: Thu Apr 19, 2007 6:55 pm

Post by victorsk »

Hi,

I need $this->client->getProxy() call because it loads $client object with ASP.NET_SessionId cookie which is required to make other API calls.

Thanks,
Victor.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

From what I've seen it "only" creates a stub class that extends SOAP_Client. It doesn't handle session cookies any differnt than SOAP_Client.

e.g. for

Code: Select all

$conn = new SOAP_WSDL('http://www.compkarori.com/wsdl/discordian.wsdl');
$client = $conn->getProxy();
it creates the class

Code: Select all

class WebService_Discordian_DiscordianPort extends SOAP_Client
{
    function WebService_Discordian_DiscordianPort($path = 'http://www.compkarori.com/cgi-local/discordian.r')
    {
        $this->SOAP_Client($path, 0);
    }
    function &Discordian($year, $month, $day)
    {
        $result = $this->call('Discordian',
                              $v = array('year' => $year, 'month' => $month, 'day' => $day),
                              array('namespace' => 'http://tempuri.org/message/',
                                    'soapaction' => '',
                                    'style' => 'rpc',
                                    'use' => 'encoded'));
        return $result;
    }
}
victorsk
Forum Commoner
Posts: 43
Joined: Thu Apr 19, 2007 6:55 pm

Post by victorsk »

Hi,

I have been comparing the two objects created using SOAP_WSDL() getProxy() and SOAP_CLIENT() and while they appear to have the same object's contents, the one created through getProxy() is actually able to have an array of cookies while the other one is blank...that is the crucial difference:


created through $this->client-getProxy()

Code: Select all

[headers] => Array
                (
                    [User-Agent] => PEAR-SOAP 0.10.1-beta
                    [Host] => cws.globaltsg.com
                    [Content-Type] => text/xml; charset=UTF-8
                    [Content-Length] => 806
                    [SOAPAction] => "http://ws.globaltsg.com/TSGWebServices/Login"
                    [Cookie] => ASP.NET_SessionId=ylimgpm0kew0vd45m0kanmib
                )

            [cookies] => Array
                (
                    [ASP.NET_SessionId] => ylimgpm0kew0vd45m0kanmib
                )
Now with Soap_Client()

Code: Select all

SOAP_Client Object
{

...
[_soap_transport] => SOAP_Transport_HTTP Object
                                                (
                                                    [headers] => Array
                                                        (
                                                            [User-Agent] => PEAR-SOAP 0.10.1-beta
                                                            [Host] => cws.globaltsg.com
                                                            [Content-Type] => text/xml; charset=UTF-8
                                                            [Content-Length] => 917
                                                            [SOAPAction] => "http://ws.globaltsg.com/TSGWebServices/Login"
                                                        )

                                                    [cookies] => Array
                                                        (
                                                        )

...
}
Notice that in the second option there is no Cookies obtained. That is the crucial difference. I actually tried using getProxy() call, extract cookie, then re-create object using Soap_Client() and insert a cookie into it but it didn't work.

I am quite new to PHP so I don't even know which approach to take. Will it work if I try to change the contents of object obtained through Soap_Client() and try to insert a cookie value into it?

Thanks,
Victor.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Compare the SOAPAction entries of both objects. It seems to me you didn't call Login() through the SOAP_Client object but you did with the getProxy() object. In fact you did nothing with the SOAP_Client object. No big wonder it has no cookies set.

this is the class SOAP_WSDL creates for http://cws.globaltsg.com/TSGWebServices ... .asmx?WSDL

Code: Select all

class WebService_WebService_WebServiceSoap extends SOAP_Client
{
    function WebService_WebService_WebServiceSoap($path = 'http://cws.globaltsg.com/TSGWebServices/WebService.asmx')
    {
        $this->SOAP_Client($path, 0);
    }
    function &Login($request)
    {
        $Login =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}Login', false, $v = array('request' => $request));
        $result = $this->call('Login',
                              $v = array('Login' => $Login),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/Login',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &AddProduct($request)
    {
        $AddProduct =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}AddProduct', false, $v = array('request' => $request));
        $result = $this->call('AddProduct',
                              $v = array('AddProduct' => $AddProduct),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/AddProduct',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &RemoveProduct($request)
    {
        $RemoveProduct =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}RemoveProduct', false, $v = array('request' => $request));
        $result = $this->call('RemoveProduct',
                              $v = array('RemoveProduct' => $RemoveProduct),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/RemoveProduct',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &RemoveAllProducts()
    {
        $result = $this->call('RemoveAllProducts',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/RemoveAllProducts',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &RetrieveItinerary()
    {
        $result = $this->call('RetrieveItinerary',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/RetrieveItinerary',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &RetrieveItineraryFromList($request)
    {
        $RetrieveItineraryFromList =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}RetrieveItineraryFromList', false, $v = array('request' => $request));
        $result = $this->call('RetrieveItineraryFromList',
                              $v = array('RetrieveItineraryFromList' => $RetrieveItineraryFromList),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/RetrieveItineraryFromList',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &RetrieveItineraryList()
    {
        $result = $this->call('RetrieveItineraryList',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/RetrieveItineraryList',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &ResetItinerary()
    {
        $result = $this->call('ResetItinerary',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/ResetItinerary',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &RetrieveAgentList()
    {
        $result = $this->call('RetrieveAgentList',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/RetrieveAgentList',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SetItineraryAgent($request)
    {
        $SetItineraryAgent =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SetItineraryAgent', false, $v = array('request' => $request));
        $result = $this->call('SetItineraryAgent',
                              $v = array('SetItineraryAgent' => $SetItineraryAgent),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SetItineraryAgent',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SetItineraryBookingDetails($request)
    {
        $SetItineraryBookingDetails =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SetItineraryBookingDetails', false, $v = array('request' => $request));
        $result = $this->call('SetItineraryBookingDetails',
                              $v = array('SetItineraryBookingDetails' => $SetItineraryBookingDetails),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SetItineraryBookingDetails',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SetProductBookingDetails($request)
    {
        $SetProductBookingDetails =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SetProductBookingDetails', false, $v = array('request' => $request));
        $result = $this->call('SetProductBookingDetails',
                              $v = array('SetProductBookingDetails' => $SetProductBookingDetails),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SetProductBookingDetails',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &InitializeItineraryBookingDetails()
    {
        $result = $this->call('InitializeItineraryBookingDetails',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/InitializeItineraryBookingDetails',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SaveItinerary()
    {
        $result = $this->call('SaveItinerary',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SaveItinerary',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &ValidateItinerary()
    {
        $result = $this->call('ValidateItinerary',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/ValidateItinerary',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &BookItinerary($request)
    {
        $BookItinerary =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}BookItinerary', false, $v = array('request' => $request));
        $result = $this->call('BookItinerary',
                              $v = array('BookItinerary' => $BookItinerary),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/BookItinerary',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &CreateProfile($request)
    {
        $CreateProfile =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}CreateProfile', false, $v = array('request' => $request));
        $result = $this->call('CreateProfile',
                              $v = array('CreateProfile' => $CreateProfile),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/CreateProfile',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &CreateProfileWithCorporate($request)
    {
        $CreateProfileWithCorporate =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}CreateProfileWithCorporate', false, $v = array('request' => $request));
        $result = $this->call('CreateProfileWithCorporate',
                              $v = array('CreateProfileWithCorporate' => $CreateProfileWithCorporate),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/CreateProfileWithCorporate',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &LoadProfile($request)
    {
        $LoadProfile =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}LoadProfile', false, $v = array('request' => $request));
        $result = $this->call('LoadProfile',
                              $v = array('LoadProfile' => $LoadProfile),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/LoadProfile',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SaveProfile($request)
    {
        $SaveProfile =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SaveProfile', false, $v = array('request' => $request));
        $result = $this->call('SaveProfile',
                              $v = array('SaveProfile' => $SaveProfile),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SaveProfile',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &ChangeProfilePassword($request)
    {
        $ChangeProfilePassword =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}ChangeProfilePassword', false, $v = array('request' => $request));
        $result = $this->call('ChangeProfilePassword',
                              $v = array('ChangeProfilePassword' => $ChangeProfilePassword),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/ChangeProfilePassword',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &UnloadProfile()
    {
        $result = $this->call('UnloadProfile',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/UnloadProfile',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SearchAirProviders($request)
    {
        $SearchAirProviders =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SearchAirProviders', false, $v = array('request' => $request));
        $result = $this->call('SearchAirProviders',
                              $v = array('SearchAirProviders' => $SearchAirProviders),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SearchAirProviders',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &StartSearchAirLowFare($request)
    {
        $StartSearchAirLowFare =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}StartSearchAirLowFare', false, $v = array('request' => $request));
        $result = $this->call('StartSearchAirLowFare',
                              $v = array('StartSearchAirLowFare' => $StartSearchAirLowFare),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/StartSearchAirLowFare',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetAirLevelRecommendations($request)
    {
        $GetAirLevelRecommendations =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetAirLevelRecommendations', false, $v = array('request' => $request));
        $result = $this->call('GetAirLevelRecommendations',
                              $v = array('GetAirLevelRecommendations' => $GetAirLevelRecommendations),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetAirLevelRecommendations',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetAirFinalProduct($request)
    {
        $GetAirFinalProduct =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetAirFinalProduct', false, $v = array('request' => $request));
        $result = $this->call('GetAirFinalProduct',
                              $v = array('GetAirFinalProduct' => $GetAirFinalProduct),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetAirFinalProduct',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetAirDetailedRulesFromItinerary($request)
    {
        $GetAirDetailedRulesFromItinerary =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetAirDetailedRulesFromItinerary', false, $v = array('request' => $request));
        $result = $this->call('GetAirDetailedRulesFromItinerary',
                              $v = array('GetAirDetailedRulesFromItinerary' => $GetAirDetailedRulesFromItinerary),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetAirDetailedRulesFromItinerary',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetAirDetailedRulesFromSelection()
    {
        $result = $this->call('GetAirDetailedRulesFromSelection',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetAirDetailedRulesFromSelection',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetAirSeatMap($request)
    {
        $GetAirSeatMap =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetAirSeatMap', false, $v = array('request' => $request));
        $result = $this->call('GetAirSeatMap',
                              $v = array('GetAirSeatMap' => $GetAirSeatMap),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetAirSeatMap',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &StartSearchCarCompanyAvailabilities($request)
    {
        $StartSearchCarCompanyAvailabilities =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}StartSearchCarCompanyAvailabilities', false, $v = array('request' => $request));
        $result = $this->call('StartSearchCarCompanyAvailabilities',
                              $v = array('StartSearchCarCompanyAvailabilities' => $StartSearchCarCompanyAvailabilities),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/StartSearchCarCompanyAvailabilities',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &StartSearchSingleCarCompanyAvailabilities($request)
    {
        $StartSearchSingleCarCompanyAvailabilities =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}StartSearchSingleCarCompanyAvailabilities', false, $v = array('request' => $request));
        $result = $this->call('StartSearchSingleCarCompanyAvailabilities',
                              $v = array('StartSearchSingleCarCompanyAvailabilities' => $StartSearchSingleCarCompanyAvailabilities),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/StartSearchSingleCarCompanyAvailabilities',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetCarCompanyAvailabilitiesResults()
    {
        $result = $this->call('GetCarCompanyAvailabilitiesResults',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetCarCompanyAvailabilitiesResults',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetNextCarCompanyAvailabilitiesResults()
    {
        $result = $this->call('GetNextCarCompanyAvailabilitiesResults',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetNextCarCompanyAvailabilitiesResults',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SelectCar($request)
    {
        $SelectCar =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SelectCar', false, $v = array('request' => $request));
        $result = $this->call('SelectCar',
                              $v = array('SelectCar' => $SelectCar),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SelectCar',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetCarCompanyLocation($request)
    {
        $GetCarCompanyLocation =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetCarCompanyLocation', false, $v = array('request' => $request));
        $result = $this->call('GetCarCompanyLocation',
                              $v = array('GetCarCompanyLocation' => $GetCarCompanyLocation),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetCarCompanyLocation',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SearchHotelProperties($request)
    {
        $SearchHotelProperties =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SearchHotelProperties', false, $v = array('request' => $request));
        $result = $this->call('SearchHotelProperties',
                              $v = array('SearchHotelProperties' => $SearchHotelProperties),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SearchHotelProperties',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetHotelPropertiesResults()
    {
        $result = $this->call('GetHotelPropertiesResults',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetHotelPropertiesResults',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetNextHotelPropertiesResults()
    {
        $result = $this->call('GetNextHotelPropertiesResults',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetNextHotelPropertiesResults',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SearchHotelPropertyRooms($request)
    {
        $SearchHotelPropertyRooms =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SearchHotelPropertyRooms', false, $v = array('request' => $request));
        $result = $this->call('SearchHotelPropertyRooms',
                              $v = array('SearchHotelPropertyRooms' => $SearchHotelPropertyRooms),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SearchHotelPropertyRooms',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SearchHotelPropertyInformation($request)
    {
        $SearchHotelPropertyInformation =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SearchHotelPropertyInformation', false, $v = array('request' => $request));
        $result = $this->call('SearchHotelPropertyInformation',
                              $v = array('SearchHotelPropertyInformation' => $SearchHotelPropertyInformation),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SearchHotelPropertyInformation',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SelectRoom($request)
    {
        $SelectRoom =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SelectRoom', false, $v = array('request' => $request));
        $result = $this->call('SelectRoom',
                              $v = array('SelectRoom' => $SelectRoom),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SelectRoom',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SearchTourPackages($request)
    {
        $SearchTourPackages =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SearchTourPackages', false, $v = array('request' => $request));
        $result = $this->call('SearchTourPackages',
                              $v = array('SearchTourPackages' => $SearchTourPackages),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SearchTourPackages',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &StartSearchTourPackages($request)
    {
        $StartSearchTourPackages =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}StartSearchTourPackages', false, $v = array('request' => $request));
        $result = $this->call('StartSearchTourPackages',
                              $v = array('StartSearchTourPackages' => $StartSearchTourPackages),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/StartSearchTourPackages',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetSearchTourPackagesStatus()
    {
        $result = $this->call('GetSearchTourPackagesStatus',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetSearchTourPackagesStatus',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetNextSearchTourPackagesResults()
    {
        $result = $this->call('GetNextSearchTourPackagesResults',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetNextSearchTourPackagesResults',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &CheckTourAvailability($request)
    {
        $CheckTourAvailability =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}CheckTourAvailability', false, $v = array('request' => $request));
        $result = $this->call('CheckTourAvailability',
                              $v = array('CheckTourAvailability' => $CheckTourAvailability),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/CheckTourAvailability',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SearchTourAlternateDates($request)
    {
        $SearchTourAlternateDates =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SearchTourAlternateDates', false, $v = array('request' => $request));
        $result = $this->call('SearchTourAlternateDates',
                              $v = array('SearchTourAlternateDates' => $SearchTourAlternateDates),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SearchTourAlternateDates',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetTourCacheOrigins($request)
    {
        $GetTourCacheOrigins =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetTourCacheOrigins', false, $v = array('request' => $request));
        $result = $this->call('GetTourCacheOrigins',
                              $v = array('GetTourCacheOrigins' => $GetTourCacheOrigins),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetTourCacheOrigins',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetTourCacheDestinations($request)
    {
        $GetTourCacheDestinations =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetTourCacheDestinations', false, $v = array('request' => $request));
        $result = $this->call('GetTourCacheDestinations',
                              $v = array('GetTourCacheDestinations' => $GetTourCacheDestinations),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetTourCacheDestinations',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetTourCacheDepartureDates($request)
    {
        $GetTourCacheDepartureDates =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetTourCacheDepartureDates', false, $v = array('request' => $request));
        $result = $this->call('GetTourCacheDepartureDates',
                              $v = array('GetTourCacheDepartureDates' => $GetTourCacheDepartureDates),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetTourCacheDepartureDates',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetTourCacheDurations($request)
    {
        $GetTourCacheDurations =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetTourCacheDurations', false, $v = array('request' => $request));
        $result = $this->call('GetTourCacheDurations',
                              $v = array('GetTourCacheDurations' => $GetTourCacheDurations),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetTourCacheDurations',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetTourCacheHotels($request)
    {
        $GetTourCacheHotels =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetTourCacheHotels', false, $v = array('request' => $request));
        $result = $this->call('GetTourCacheHotels',
                              $v = array('GetTourCacheHotels' => $GetTourCacheHotels),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetTourCacheHotels',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SearchCruise($request)
    {
        $SearchCruise =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SearchCruise', false, $v = array('request' => $request));
        $result = $this->call('SearchCruise',
                              $v = array('SearchCruise' => $SearchCruise),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SearchCruise',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetCruiseFinalProduct($request)
    {
        $GetCruiseFinalProduct =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetCruiseFinalProduct', false, $v = array('request' => $request));
        $result = $this->call('GetCruiseFinalProduct',
                              $v = array('GetCruiseFinalProduct' => $GetCruiseFinalProduct),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetCruiseFinalProduct',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetCruiseGeoRegionAvailable()
    {
        $result = $this->call('GetCruiseGeoRegionAvailable',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetCruiseGeoRegionAvailable',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetCruiseMonthAvailable($request)
    {
        $GetCruiseMonthAvailable =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetCruiseMonthAvailable', false, $v = array('request' => $request));
        $result = $this->call('GetCruiseMonthAvailable',
                              $v = array('GetCruiseMonthAvailable' => $GetCruiseMonthAvailable),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetCruiseMonthAvailable',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetCruiseAudienceAvailable($request)
    {
        $GetCruiseAudienceAvailable =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetCruiseAudienceAvailable', false, $v = array('request' => $request));
        $result = $this->call('GetCruiseAudienceAvailable',
                              $v = array('GetCruiseAudienceAvailable' => $GetCruiseAudienceAvailable),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetCruiseAudienceAvailable',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetCruiseAvailableOccupancies($request)
    {
        $GetCruiseAvailableOccupancies =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetCruiseAvailableOccupancies', false, $v = array('request' => $request));
        $result = $this->call('GetCruiseAvailableOccupancies',
                              $v = array('GetCruiseAvailableOccupancies' => $GetCruiseAvailableOccupancies),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetCruiseAvailableOccupancies',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetInsuranceOptions()
    {
        $result = $this->call('GetInsuranceOptions',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetInsuranceOptions',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &AddInsuranceProduct($request)
    {
        $AddInsuranceProduct =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}AddInsuranceProduct', false, $v = array('request' => $request));
        $result = $this->call('AddInsuranceProduct',
                              $v = array('AddInsuranceProduct' => $AddInsuranceProduct),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/AddInsuranceProduct',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetAgencyFunctionalities()
    {
        $result = $this->call('GetAgencyFunctionalities',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetAgencyFunctionalities',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &ResetSession()
    {
        $result = $this->call('ResetSession',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/ResetSession',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &KeepSessionAlive()
    {
        $result = $this->call('KeepSessionAlive',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/KeepSessionAlive',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &Ping()
    {
        $result = $this->call('Ping',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/Ping',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &Pro_Login($request)
    {
        $Pro_Login =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}Pro_Login', false, $v = array('request' => $request));
        $result = $this->call('Pro_Login',
                              $v = array('Pro_Login' => $Pro_Login),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/Pro_Login',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &Pro_Logoff()
    {
        $result = $this->call('Pro_Logoff',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/Pro_Logoff',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &Pro_GetAgencyRawReport($request)
    {
        $Pro_GetAgencyRawReport =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}Pro_GetAgencyRawReport', false, $v = array('request' => $request));
        $result = $this->call('Pro_GetAgencyRawReport',
                              $v = array('Pro_GetAgencyRawReport' => $Pro_GetAgencyRawReport),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/Pro_GetAgencyRawReport',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &Pro_GetProfileList($request)
    {
        $Pro_GetProfileList =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}Pro_GetProfileList', false, $v = array('request' => $request));
        $result = $this->call('Pro_GetProfileList',
                              $v = array('Pro_GetProfileList' => $Pro_GetProfileList),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/Pro_GetProfileList',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &Pro_LoadProfile($request)
    {
        $Pro_LoadProfile =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}Pro_LoadProfile', false, $v = array('request' => $request));
        $result = $this->call('Pro_LoadProfile',
                              $v = array('Pro_LoadProfile' => $Pro_LoadProfile),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/Pro_LoadProfile',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &Pro_SaveProfile($request)
    {
        $Pro_SaveProfile =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}Pro_SaveProfile', false, $v = array('request' => $request));
        $result = $this->call('Pro_SaveProfile',
                              $v = array('Pro_SaveProfile' => $Pro_SaveProfile),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/Pro_SaveProfile',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SearchTourism($request)
    {
        $SearchTourism =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SearchTourism', false, $v = array('request' => $request));
        $result = $this->call('SearchTourism',
                              $v = array('SearchTourism' => $SearchTourism),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SearchTourism',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &SearchTourismDetails($request)
    {
        $SearchTourismDetails =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}SearchTourismDetails', false, $v = array('request' => $request));
        $result = $this->call('SearchTourismDetails',
                              $v = array('SearchTourismDetails' => $SearchTourismDetails),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/SearchTourismDetails',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetTourismAvailableGeoRegion()
    {
        $result = $this->call('GetTourismAvailableGeoRegion',
                              $v = null,
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetTourismAvailableGeoRegion',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetTourismAvailableDepartDate($_request)
    {
        $GetTourismAvailableDepartDate =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetTourismAvailableDepartDate', false, $v = array('_request' => $_request));
        $result = $this->call('GetTourismAvailableDepartDate',
                              $v = array('GetTourismAvailableDepartDate' => $GetTourismAvailableDepartDate),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetTourismAvailableDepartDate',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetTourismAvailableDuration($_request)
    {
        $GetTourismAvailableDuration =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetTourismAvailableDuration', false, $v = array('_request' => $_request));
        $result = $this->call('GetTourismAvailableDuration',
                              $v = array('GetTourismAvailableDuration' => $GetTourismAvailableDuration),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetTourismAvailableDuration',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetTourismAvailableAudience($_request)
    {
        $GetTourismAvailableAudience =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetTourismAvailableAudience', false, $v = array('_request' => $_request));
        $result = $this->call('GetTourismAvailableAudience',
                              $v = array('GetTourismAvailableAudience' => $GetTourismAvailableAudience),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetTourismAvailableAudience',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetTourismAvailableProductCategory($_request)
    {
        $GetTourismAvailableProductCategory =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetTourismAvailableProductCategory', false, $v = array('_request' => $_request));
        $result = $this->call('GetTourismAvailableProductCategory',
                              $v = array('GetTourismAvailableProductCategory' => $GetTourismAvailableProductCategory),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetTourismAvailableProductCategory',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
    function &GetTourismAvailableOccupancy($_request)
    {
        $GetTourismAvailableOccupancy =& new SOAP_Value('{http://ws.globaltsg.com/TSGWebServices}GetTourismAvailableOccupancy', false, $v = array('_request' => $_request));
        $result = $this->call('GetTourismAvailableOccupancy',
                              $v = array('GetTourismAvailableOccupancy' => $GetTourismAvailableOccupancy),
                              array('namespace' => 'http://ws.globaltsg.com/TSGWebServices',
                                    'soapaction' => 'http://ws.globaltsg.com/TSGWebServices/GetTourismAvailableOccupancy',
                                    'style' => 'document',
                                    'use' => 'literal'));
        return $result;
    }
}
There's no code for cookie handling in it, only representations of the methods and their parameters.

Which version of php do you use?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

btw: if you want a dirty hack you can save the class WebService_WebService_WebServiceSoap code to a file, e.g. TSGWebServices.class.php, and include this file prior to session_start().
victorsk
Forum Commoner
Posts: 43
Joined: Thu Apr 19, 2007 6:55 pm

Post by victorsk »

Hi Volka,

All I can say is "wow". I am so impressed with your reply and I am really learning a lot about PHP from you...thank you.

I am using PHP Version 5.0.4. At this point I feel bad asking for more advice, but I think it would be better for me to understand completely what is happening to get the most from your response.

So, what I think should be done is:

1. create an instance of an object WebService_WebService_WebServiceSoap.
2. use the functions of that variable to make soap requests locally.

I'm just not sure what to put in the $request parameter as some functions like Login, requires a passing of Array of login information like so:

Code: Select all

$params = Array(
                         'agencyId'=> new Soap_Value( 'agencyId', 'string', "XXX" ),
                         'userName'=> new Soap_Value( 'userName', 'string', 'XXXXX'),
                         'userPassword'=> new Soap_Value( 'userPassword', 'string', 'XXXXXXXXX')
                        );
then in my original implemenation I used:

Code: Select all

$client->Login( new SOAP_Value( 'request', "object", $params ) );

Should I then say?

Code: Select all

$request = new Soap_Value('request', "object", $params);
$webservices_object->Login($request);
In any case, I will send you the complete login information into this webservice so you are free to test it any way you wish.

Thank you again for your awesome assistance.
Victor.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

The more I think about simply saving class WebService_WebService_WebServiceSoap the more I like it. A service definition shouldn't change therefore a "static" class that implements the stub should do. This has another advantage: As far as I can see the PEAR::SOAP implementation has no chache for the wsdl files. Each time you create a new SOAP_Client/_WSDL object it requests the wsdl from the net (may be there is a cache setting but I haven't found it yet ;)) If you keep the class there's no need for this extra request. Might speed up your application a bit. The getProxy() method is prepared for this, it checks if the classname is already used.
Maybe you want to implement some automagic checking that requests the wsdl once day and compares the generated class definitinon to to stored class.
btw php5 has its own soap extension, see http://de2.php.net/soap
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Code: Select all

<?php
require_once 'SOAP/Client.php';
$classfile = 'TSGWebServices.stub.php';
	
$wsdl = new SOAP_WSDL('http://cws.globaltsg.com/TSGWebServices/WebService.asmx?WSDL');
if ( !is_null($wsdl->fault) ) {
	echo "unable to create valid SOAP_WSDL object<br />\n";
	echo 'message: ', $wsdl->fault->getMessage(), "<br />\n";
	echo 'debug info: ', $wsdl->fault->getDebugInfo(), "<br />\n";
	die();
}
		
$wsdl_def = $wsdl->generateAllProxies(null, 'TSGWebService');

$wsdl_def = '<?php ' . $wsdl_def;
$current_def = is_file($classfile) ? file_get_contents($classfile) : '-';

if ( $wsdl_def != $current_def ) {
	file_put_contents($classfile, $wsdl_def, LOCK_EX);
	fwrite(STDERR, 'notice: TSGWebServices.class.php has been changed');
}
?>
writes the proxy code for all ports to TSGWebServices.stub.php
You might want to run this as a cronjob every once in a while. If the definition changes the script prints a message via STDERR.
There are currently two ports in the wsdl, you probably want the SOAP 1.2 (the more recent) version. The generated class for this port is called WebService_WebService_WebServiceSoap12.

Code: Select all

<?php
// foo.class.php
require_once 'SOAP/Client.php';
require_once 'SOAP/Transport.php';
require_once 'SOAP/Transport/HTTP.php';
require_once 'TSGWebServices.stub.php';

class foo {
        public $client;
        public $resp;

        function __construct($parameters)
        {
                require 'loginparams.php'; // login data, defines $param
                $this->client = new WebService_WebService_WebServiceSoap12;   
                $this->client->setDefaultNamespace("http://ws.globaltsg.com/TSGWebServices" );
               
                $loginResp = $this->client->Login( new SOAP_Value('request', "object", $params ) );       
                if ( SOAP_Client::isError($loginResp) ) {
                        echo __FILE__, ':', __LINE__, ' # login failed';
                }

                $this->resp = $this->client->GetAgencyFunctionalities();
        }
}

Code: Select all

<?php // test.php
require_once 'foo.class.php';

$f = new foo(array());

session_start();
$_SESSION['remoteservice'] = $f;

echo '<a href="test2.php">klick</a>';

Code: Select all

<?php // test2.php
require_once 'foo.class.php';
session_start();

echo 'remote: ', get_class($_SESSION['remoteservice']), "<br />\n";
echo 'client: ', get_class($_SESSION['remoteservice']->client), "<br />\n";
victorsk
Forum Commoner
Posts: 43
Joined: Thu Apr 19, 2007 6:55 pm

Post by victorsk »

Thank you Volka. A great help indeed.
HcSpartacus
Forum Newbie
Posts: 1
Joined: Thu Jun 14, 2007 9:08 am

Thank you...

Post by HcSpartacus »

I am new to php and through your conversation I was able to resolve my problem of the Incomplete class object error...

Note to self: includes must come before session_start();

Thank you!
Post Reply