Jump to content

Posting array to WSDL with read only properties


grib

Recommended Posts

My PHP is a little rusty so I could just be overlooking something simple. I'm trying to write a client for webservice, the WSDL is available here. I used wsdl2php to create a list of functions and classes which allows me to read and write data through the web portal. One of the functions, AddNewCustomer, requires an instance of the class TIntactCustomer to be passed as an array, normally this would work, but on the portal the Balance property is set to Read-Only and the function returns an error.

 

The developers of the portal have suggested I remove Balance from the array,  which gives me this error; Fatal error: Uncaught SoapFault exception: [sOAP-ENV:Server] '' is not a valid floating point value.

If I remove Balance from the class also, I get this error Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object hasn't 'Balance' property in /Applications/xampp/xamppfiles/htdocs/intact/lib/IIntactservice.php:685

 

Has anyone any idea?

 

Thanks

Andrew

 

 

 

require_once 'IIntactservice.php';
$customer = new IIntactservice();


$newcustomer = new TIntactCustomer();

$newcustomer->Code = "ALED001";
$newcustomer->Name = "Customer Name";
$newcustomer->Address1 = "365 Old Road";
$newcustomer->Address2 = "Lisburn";
$newcustomer->Address3 = "";
$newcustomer->Address4 = "";
$newcustomer->Address5 = "";
$newcustomer->PostCode = "BT26 6TH";
$newcustomer->Balance = 0;
$newcustomer->OnOrder = 0;
$newcustomer->Unbilled = 0;
$newcustomer->UnAllocated = 0;
$newcustomer->CreditLimit = 0;
$newcustomer->Phone1 = "02854339047";
$newcustomer->Phone2 = "";
$newcustomer->Fax = "";
$newcustomer->EMail = "aled@email.co.uk";
$newcustomer->YTDNetTurnover = 0;
$newcustomer->DeliveryAddress1 = "";
$newcustomer->DeliveryAddress2 = "";
$newcustomer->DeliveryAddress3 = "";
$newcustomer->DeliveryAddress4 = "";
$newcustomer->DeliveryAddress5 = "";
$newcustomer->DefaultVATRate = 2;
$newcustomer->HoCode = "";
$newcustomer->IsHo = False;



	$result = $customer->AddNewCustomer($newcustomer);
	print_r($result);

Link to comment
Share on other sites

By the sounds of it you're not using floating point values, hence the error. What you ARE supplying it integers.

Thus I suggest you change:

 

$newcustomer->Balance = 0;

to

$newcustomer->Balance = 0.00;

 

This may be the case for other variables you are setting also, so check your documentation.

You could also cheat if you find PHP is sending 0 instead of 0.00 (as it does like to do naughty things), by giving it a string instead. I'm guessing that it's being sent as XML so it shouldn't matter if it's a string or float so long as it has the .00 on the end, as xml is 1 big string anyway.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.