For anyone reading this and attempting to help this noob (me), I appreciate it.

I'm writing a soap call to update some information. The issue I have is....

When attempting to make the call, it is giving me an error "SOAP-ERROR: Encoding: object hasn't 'billingAccountNumber' property"

In the WSDL (snippit Below) , I can pass either the pair of

<xxxx:billingAccountNumber>?</xxxx:billingAccountNumber>
<!--Optional:-->
<xxxx:billingMarket>

or

<xxxx:mdn>?</xxxx:mdn>
<!--Optional:-->
<xxxx:BillingAccountInformation>

For this, I attempting to use the MDN/BillingAccountInformation pair. I build the call as below. I get the error. And I attempt to capture the request/response only to have all attempts come up as NULL.

If I modify my request for the first pairing, I get business rule errors (as I should) but I can capture the request/response.

What I'm asking is.... I'm building the soap structure properly (from what I can see in the dump that comes back as an object) but I can't view the request response. (and I have trace enabled.) What am I doing incorrectly or what can I do to actually capture the request? Or how does PHP SoapClient deal with Optional triggers in the WSDL?

<?php

ob_start();



##  Variables for IRB Header creation
$hdheadns = "http://xxx.xxxx.com/ESP/Namespaces/Container/Public/MessageHeader.xsd";
$hdvers = 'v1';
$hdmessid = 'batch-0622-0903';
$hdttl = '120';
$hdusername = 'xxx';
$hdpassword = 'xxx(xxx)';
$hdseqnum = '1';
$hdtotseq = '1';

##  IRB WSDL for INQUIRE ACCT
$ua_wsdl = "http://xxxx.xxxxxx.com/CustomWSDLRequest?serviceName=UpdateDevice";

## End point for Inquire Account call
$ua_ep = "http://xxxx.xxxxx.com/Services/UpdateDevice";


##  Calling head_date function to get date_time stamp for header
$hddts = head_date();

##  Creating a class for the header to feed into the soap call.
$UpdateAccount= new StdClass;
$UpdateAccount->TrackingMessageHeader->version = $hdvers;
$UpdateAccount->TrackingMessageHeader->messageId = $hdmessid;
$UpdateAccount->TrackingMessageHeader->timeToLive = $hdttl;
$UpdateAccount->TrackingMessageHeader->dateTimeStamp = $hddts;
$UpdateAccount->SecurityMessageHeader->userName = $hdusername;
$UpdateAccount->SecurityMessageHeader->userPassword = $hdpassword;
$UpdateAccount->SequenceMessageHeader->sequenceNumber = $hdseqnum;
$UpdateAccount->SequenceMessageHeader->totalInSequence = $hdtotseq;

## Setting up soap connection
$clparams = array('location' => $ua_ep,'userName' => $hdusername,'userPassword' => $hdpassword,"trace" => 1);
#$clparams = array("trace" => 1);
$ua_client = new SoapClient($ua_wsdl,$clparams);

##  Forcing header setup
$header = new SoapHeader($hdheadns,'MessageHeader',$UpdateAccount);
$ua_client->__setSoapHeaders($header);

## Setting up the parameters for the IRB Account Lookup

$ban = "BAN";
$effDate = "2011-08-03";
$rcid = "9999";
$portstatus = "Port In";
$locid = "8626";
$repid = "xxxx team";
$salech = "xxx-xxx";
$transtype = "xxx";

$tmpmdn = "xxxxxxxxx";
$actype = "x";
$acct = "xxxxxxxxxx";
$custrefer ="xxxxxxxxx";
$needmdn = "xxxxxxxxx";
$needmin ="xxxxxxxxx";


$UpdateDev = new StdClass;
$UpdateDev->AccountSubscriberSelector->mdn = $tmpmdn;
$UpdateDev->AccountSubscriberSelector->BillingAccountInformation->billingAccountNumber = $acct;
$UpdateDev->AccountSubscriberSelector->BillingAccountInformation->accountType = $actype;
$UpdateDev->AccountSubscriberSelector->BillingAccountInformation->customerId = $custrefer;
$UpdateDev->OrderInfo->transactionType = $transtype;
$UpdateDev->effectiveDate = $effDate;
$UpdateDev->NewMdnInfo->rateCenterId = $rcid;
$UpdateDev->NewMdnInfo->mdn = $needmdn;
$UpdateDev->NewMdnInfo->portStatus = $portstatus;
$UpdateDev->Device->min = $needmin;
$UpdateDev->Comission->locationId = $locid;
$UpdateDev->Comission->salesRepresentative = $repid;
$UpdateDev->Comission->salesChannel = $salech;



## Making soap call to IRB
try{
    $ua_results = $ua_client->UpdateDevice($UpdateDev);
    $ua_order = $ua_results->OrderInfo->orderId;
    print "Order ID: ".$ua_order."\r\n";
    print $ua_results;
    $mystring = ob_get_contents(); // retrieve all output thus far
    ob_end_clean ();               // stop buffering
    log($mystring);                // log it 
    echo $mystring;                // now send it

$soap_request = $ua_client->__getLastRequest();
$soap_response = $ua_client->__getLastResponse();

echo "SOAP Success request:\n".$soap_request."\n\r";
echo "SOAP Success response:\n".$soap_response."\n\r";



}
catch (SoapFault $ua_results){

   echo("\nDumping client object:\n");
   var_dump($ua_client);

   echo("\nDumping client object functions:\n");
   var_dump($ua_client->__getFunctions());


   echo("\nDumping request headers:\n" 
      .$ua_client->__getLastRequestHeaders());

   echo("\nDumping request:\n".$ua_client->__getLastRequest());

   echo("\nDumping response headers:\n"
      .$ua_client->__getLastResponseHeaders());

   echo("\nDumping response:\n".$ua_client->__getLastResponse());


}

?>

WSDL Portion.

<upd:AccountSubscriberSelector>
            <!--You have a CHOICE of the next 2 items at this level-->
            <xxxx:billingAccountNumber>?</xxxx:billingAccountNumber>
            <!--Optional:-->
            <xxxx:billingMarket>
               <xxxx:id>?</xxxx:id>
               <!--Optional:-->
               <xxxx:name>?</xxxx:name>
               <!--Optional:-->
               <xxxx:description>?</xxxx:description>
               <!--Optional:-->
               <xxxx:effectiveDate>?</xxxx:effectiveDate>
               <!--Optional:-->
               <xxxx:companyCode>?</xxxx:companyCode>
            </xxxx:billingMarket>
            <xxxx:mdn>?</xxxx:mdn>
            <!--Optional:-->
            <xxxx:BillingAccountInformation>
               <xxxx:billingAccountNumber>?</xxxx:billingAccountNumber>
               <!--Optional:-->
               <xxxx:accountType>?</xxxx:accountType>
               <!--Optional:-->
               <xxxx:customerId>?</xxxx:customerId>
               <!--Optional:-->
               <xxxx:billingMarket>
                  <xxxx:id>?</xxxx:id>
                  <!--Optional:-->
                  <xxxx:name>?</xxxx:name>
                  <!--Optional:-->
                  <xxxx:description>?</xxxx:description>
                  <!--Optional:-->
                  <xxxx:effectiveDate>?</xxxx:effectiveDate>
                  <!--Optional:-->
                  <xxxx:companyCode>?</xxxx:companyCode>
               </xxxx:billingMarket>
            </xxxx:BillingAccountInformation>
         </upd:AccountSubscriberSelector>

MOD EDIT: [noparse]

..

and

..

[/noparse] bbcode tags added; please use these tags in the future as they make your code much easier to read and analyze.

    Write a Reply...