SOAP-ERROR: Encoding: Violation of encoding rules on FaxStatusEx

6 posts / 0 new
Last post
#1 Thu, 7 Apr 2016 20:54
Anonymous (not verified)

SOAP-ERROR: Encoding: Violation of encoding rules on FaxStatusEx

Hi, I'm using $client->FaxStatusEx($params) to retrieve some information from sent faxes. Using PHP 4.5, Apache, Linux (Centos 6.7).
My code was failing with the error "SOAP-ERROR: Encoding: Violation of encoding rules". So I attempted to catch the SOAP error with this.
........
$username = 'xxxxxxx'; // Enter your Interfax username here
$password = 'xxxxxxx'; // Enter your Interfax password here
$last_txid = $_POST['transactionid'];
// Enter the transaction ID for which data is to be retrieved, or "999999999" for the most recent transaction(s)
$enableResendButton = false;
$max_items = '1'; // How many transactions to return information for
/**************** Settings end ****************/
if($last_txid != '999999999') $last_txid++; // LastTransaction ID needs to be one higher than the transaction be queried for
// Retrieve information from InterFAX
$client = new SoapClient('https://ws.interfax.net/dfs.asmx?wsdl');
if (!isset($params)) $params = new stdClass();
$params->Username = $username;
$params->Password = $password;
$params->LastTransactionID = $last_txid;
$params->MaxItems = $max_items;
$params->TotalCount = '';
$params->ListSize = '';
$params->ResultCode = '';

try {
// $result = $client->fetchNews($param);
$queryResult = $client->FaxStatusEx($params);
}
catch (SoapFault $sf) {
print '<pre>';
// print the exception
print_r($sf);
print '<pre>';
// print the XML response
print $client->__getLastResponse();
}
.......
And here's the output.

SoapFault Object
(
[message:protected] => SOAP-ERROR: Encoding: Violation of encoding rules
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => /home/domain/public_html/fax_status.php
[line:protected] => 29
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => /home/domain/public_html/fax_status.php
[line] => 29
[function] => __call
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => FaxStatusEx
[1] => Array
(
[0] => stdClass Object
(
[Username] => xxxxxxx
[Password] => xxxxxxxx
[LastTransactionID] => 621743235
[MaxItems] => 1
[TotalCount] =>
[ListSize] =>
[ResultCode] =>
)
)
)
)

[1] => Array
(
[file] => /home/domain/public_html/fax_status.php
[line] => 29
[function] => FaxStatusEx
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => stdClass Object
(
[Username] => xxxxxxx
[Password] => xxxxxxxxx
[LastTransactionID] => 621743235
[MaxItems] => 1
[TotalCount] =>
[ListSize] =>
[ResultCode] =>
)
)
)
)

[previous:Exception:private] =>
[faultstring] => SOAP-ERROR: Encoding: Violation of encoding rules
[faultcode] => Client
[faultcodens] => http://schemas.xmlsoap.org/soap/envelope/
)

Error: the requested fax does not exist. Report this to the administrator. <- this is my error but the fax id does exist and is in the outbound queue.

Might this have something to do with PHP 4.5 SOAP extension? I was using PHP 5.3 previously.

Wed, 13 Apr 2016 10:17
Eyal N

Hello,
Yes - it might be an issue with the PHP version. We recommend to use PHP version 5 or above.
You mentioned that you were using PHP 5.3 before - on that version, was the same code working properly? If so, that will confirm the suspicion that this is, in fact, a version issue in PHP.

Thu, 14 Apr 2016 13:24
Mike Montgomery (not verified)

Hi, I was using PHP 5.4.45 on my old server and using the same PHP 5.4.45 on this new server. The SOAP extension works in sending faxes but not when using FaxStatusEx function. I'm stumped.

Fri, 15 Apr 2016 21:30
AlexM

Hello Mike,

I have just tested the sample on our website(https://www.interfax.net/en/dev/webservice/samples/fax_php_faxstatus) using PHP Version 5.6.16 and it works without any issues.
So it's either a version problem still (unlikely) or an implementation problem (infrastructure or code).
Can you please just copy-paste the sample on our website, and simply edit the username and password fields with your credentials and run it ?

Looking forward to hear from you.

Mon, 18 Apr 2016 00:46
Mike Montgomery (not verified)

Hi, thanks for your reply. I tested out your code and it worked on my VPS so obviously my code is to blame. Sure enough failure occurs where I convert Date & Time in order to get how long ago the fax was submitted. I've fixed up the code and everything works. Thanks again.

Wed, 27 Apr 2016 09:10
Eyal N

Hi Mike,
I am very glad to hear that you were able to resolve the issue. Please let us know if we can assist you again.

Log in or register to post comments

Contact us today

Talk to a member of our team about the benefits InterFAX can bring to your organization's communications processes.

Contact us today