calling GetOrdersEx() from PHP

Former Member
Former Member $organization

I am trying to call GetOrdersEx() from PHP, but it's throwing an exception:

SoapFault exception: [soap:Server] System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Tessitura.WebAPI.Tessitura.GetOrdersEx(String sWebSessionId, Int32 iOrderNumber, String sPhoneNumber, Char cPrint, String dtStartDate, String dtEndDate, Int32 iSeason, Int32 iCustomerNumber, Int32 iMos, Char cRenewals, Int32 iDeliveryMethod)

My function call looks like this:

$results = $tessClient->GetOrdersEx(array(
            'sWebSessionID'   => $_SESSION['tessSessionKey'],
            'iOrderNumber'    => 0,
            'sPhoneNumber'    => "",
            'cPrint'          => "N",
            'dtStartDate'     => date("n/j/Y"),
            'dtEndDate'       => "",
            'iSeason'         => 0,
            'iCustomerNumber' => $_SESSION['customerNumber'],
            'iMos'            => 0,
            'cRenewals'       => "N",
            'iDeliveryMethod' => 0));

$tessClient, $_SESSION['tessSessionKey'], and $_SESSION['customerNumber'] are all properly defined and work in the same context to call other Tessitura API functions.

Thanks for your help.

Parents
  • Hi Bryan, 

    I'm not an expert PHP coder - I work in .NET, so nothing is jumping out at me about the syntax of your code. Have you tried performing that method call manually through the .asmx API web service page (with all of the same parameters of course)? If it works manually then you'll know it's not the API causing the trouble.

     In my experience - 'object reference not set to an instance of an object' generally means there is either something wrong with the syntax of the code itself (which, again, I'm not totally qualified to make a judgement on but it looks ok) or one of the parameters being passed is incorrect (or cast improperly). 

    Good luck to you,

  • Former Member
    Former Member $organization in reply to Nathan Campbell

    Nathan,

    Thanks for your input.

    GetOrdersEx() works if I call the method directly from the ASMX page using the same parameters.

    In PHP, variables are loosely typed, so I've tried explicitly casting the variables that are passed to the SOAP call, but this doesn't change anything.  In fact, even if I cast variables wrongly into other method calls, such as GetPerforancesEx4(), those methods still work properly.

    I suppose this means that a parameter gets interpreted incorrectly during the SOAP call, itself, perhaps as a result of a quirky rule in the WSDL definition.  This is just conjecture, though.  If this were the case, I'm not sure how I could figure out what I'm doing wrong.

    Bryan

Reply
  • Former Member
    Former Member $organization in reply to Nathan Campbell

    Nathan,

    Thanks for your input.

    GetOrdersEx() works if I call the method directly from the ASMX page using the same parameters.

    In PHP, variables are loosely typed, so I've tried explicitly casting the variables that are passed to the SOAP call, but this doesn't change anything.  In fact, even if I cast variables wrongly into other method calls, such as GetPerforancesEx4(), those methods still work properly.

    I suppose this means that a parameter gets interpreted incorrectly during the SOAP call, itself, perhaps as a result of a quirky rule in the WSDL definition.  This is just conjecture, though.  If this were the case, I'm not sure how I could figure out what I'm doing wrong.

    Bryan

Children
No Data