API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Product_GetData SOAP encoding violation!


Hi I am getting this error on one server, but works fine on another. What is the violation that I am making in the request? where can I get the information of e-conomic SOAP encoding rules? Thanks for any help!


product number: wooeco-99
could not create product: SOAP-ERROR: Encoding: Violation of encoding rules
POST /secure/api1/EconomicWebservice.asmx HTTP/1.1
Host: api.e-conomic.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.5.22
Content-Type: text/xml; charset=utf-8
Content-Length: 316
Cookie: ASP.NET_SessionId=dy0fug2gdwfak445wu0wty55;
This is the XML posted
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://e-conomic.com">
created Feb 26, 2015 by alvinrosario
73% Accept Rate

edited Feb 26, 2015 by alvinrosario
Q 11 A 0 C 14
I had the same errors after upgrade to php 5.6. The solution was to delete all wsdl cache files (std. /tmp/wsdl-*). (my problem was calling CurrentInvoice_GetPdf)

1 Answer

Best answer
Hi Alvin


Your SKU (product name) is not a handle.

You will need to first look up the Product Handle using: Product_FindByNumber



The fault you're getting is because the SOAP server is expecting an integer and not a string.


Stack overflow thread on the same issue:



It looks like you have a type mismatch somewhere, either while assembling your request (one of the parameters is not of type string), or the server returns something other than an int (violating the WSDL response definition and thus causing the client to consider the response invalid, as it expects something else).
answered Mar 5, 2015 by olej
Hi olej,

I am getting this error off and on randomly

Below is a SOAP request and response when the error happen.

SOAP-ERROR: Encoding: Violation of encoding rules
POST /secure/api1/EconomicWebservice.asmx HTTP/1.1
Host: api.e-conomic.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.5.28
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://e-conomic.com/Product_GetData"
Content-Length: 316
Cookie: ASP.NET_SessionId=vzooyzujb1esw145zb1b5i22;

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://e-conomic.com"><SOAP-ENV:Body><ns1:Product_GetData><ns1:entityHandle><ns1:Number>wp16-1001</ns1:Number></ns1:entityHandle></ns1:Product_GetData></SOAP-ENV:Body></SOAP-ENV:Envelope>

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><Product_GetDataResponse xmlns="http://e-conomic.com"><Product_GetDataResult><Handle><Number>wp16-1001</Number></Handle><Number>wp16-1001</Number><ProductGroupHandle><Number>1</Number></ProductGroupHandle><Name>Woo Album #1</Name><SalesPrice>0.00</SalesPrice><CostPrice>0.00</CostPrice><RecommendedPrice>0.00</RecommendedPrice><IsAccessible>false</IsAccessible><Volume>0.00</Volume><InStock>0</InStock><OnOrder>0</OnOrder><Ordered>0</Ordered><Available>0</Available><LastUpdated>2015-08-29T13:33:00</LastUpdated></Product_GetDataResult></Product_GetDataResponse></soap:Body></soap:Envelope>
------Debugging ends------

If you check the reponse <LastUpdated>2015-08-29T13:33:00</LastUpdated>

it should be dateTime format, do you confirm this returned data is correct? why is this data type returned? what is going wrong?

Same setup works fine on another domain.

Thanks for your answer.
Visma e-conomic A/S