php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45025 Encoding: Violation of encoding rules
Submitted: 2008-05-16 20:48 UTC Modified: 2008-05-19 06:59 UTC
From: ol777 at oldi dot ru Assigned:
Status: Closed Package: SOAP related
PHP Version: 5.2.6 OS: Windows2000
Private report: No CVE-ID: None
 [2008-05-16 20:48 UTC] ol777 at oldi dot ru
Description:
------------
I have "Encoding: Violation of encoding rules", when I try get object (<m:ErrorCode>0</m:ErrorCode><m:ErrorMessage>no</m:ErrorMessage> <m:ErrorDebugMessage>no</m:ErrorDebugMessage>) as result from SOAP server. 

When SOAP server return result as object:
--------
... <m:return xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <m:ErrorCode>0</m:ErrorCode> <m:ErrorMessage>no</m:ErrorMessage> <m:ErrorDebugMessage>no</m:ErrorDebugMessage> </m:return> ... )
---------
 - I have "Encoding: Violation of encoding rules"

But, when SOAP server return result as plain string ("Test"): 
---------
... <m:return xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Test</m:return> ... 
---------
 - there is no error.

On PHP 5.2.5 I have same error and my Apache 2.2 has crash, on PHP 5.2.6 I only have error

Reproduce code:
---------------
<?
    $parameters = array("ID_Client"=>"1", "CardNumber"=>"q", "DateFrom"=> "20080421000000", "DateTo"=>q);
try {
    $soap = new SoapClient( "http://10.0.0.1/ws/mysoap.1cws?wsdl" , array(
       "login"      => "mylogin",
       "password"   => "mypass",
       "trace"      => 1,
       "exceptions" => 1)
    );
    $result = $soap->GetOrders($parameters);
} catch (SoapFault $fault){
    echo "faultcode: ".$fault->faultcode.", faultstring: ".iconv('utf-8', 'windows-1251',$fault->faultstring)."<br>";

    echo =  '<h2>Request:</h2>
    ' . htmlspecialchars(iconv('utf-8', 'windows-1251',$soap->__getLastRequest()), ENT_QUOTES) . '
    <h2>Answer:</h2>
    ' . htmlspecialchars(iconv('utf-8', 'windows-1251',$soap->__getLastResponse()), ENT_QUOTES) . '<br>';
?>

Actual result:
--------------
faultcode: Client, faultstring: SOAP-ERROR: Encoding: Violation of encoding rules

Request:
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost/ws/myoldi"><SOAP-ENV:Body><ns1:GetOrders><ns1:ID_Client>1</ns1:ID_Client><ns1:CardNumber>q</ns1:CardNumber><ns1:DateFrom>20080421000000</ns1:DateFrom><ns1:DateTo>q</ns1:DateTo></ns1:GetOrders></SOAP-ENV:Body></SOAP-ENV:Envelope> 

Answer:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header/> <soap:Body> <m:GetOrdersResponse xmlns:m="http://localhost/ws/myoldi"> <m:return xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <m:ErrorCode>0</m:ErrorCode> <m:ErrorMessage>no</m:ErrorMessage> <m:ErrorDebugMessage>no</m:ErrorDebugMessage> </m:return> </m:GetOrdersResponse></soap:Body> </soap:Envelope>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-19 06:50 UTC] ol777 at oldi dot ru
Error in wsdl. Not right return type in wsdl.
 [2008-05-19 06:59 UTC] ol777 at oldi dot ru
Sorry for inconvenience
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC