You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by "D. Gopala Krishna Murthy" <go...@6dtech.co.in> on 2007/02/28 10:27:47 UTC

Client XML Parsing Problem

Hi,
I am using xmlrpc-2.0.1.jar and am getting this exception when i try to connect to a server.  Please find my client code below the exception:
I am using a server which is xmlrpc-1.2.jar


Fatal error parsing XML: org.xml.sax.SAXParseException: invalid Character Entitiy
org.apache.xmlrpc.XmlRpcClientE xception: Error decoding XML-RPC response
        at org.apache.xmlrpc.XmlRpcClientR esponseProcessor.decodeResponse(XmlRpcClientResponseProcessor .java:80)
        at org.apache.xmlrpc.XmlRpcClientW orker.execute(XmlRpcClientWorker.java:73)
        at org.apache.xmlrpc.XmlRpcClient .execute(XmlRpcClient.java:194)
        at com.sixdee.rpc.RpcRequest .sendRequest(RpcRequest.java:41)
        at com.sixdee.rpc.XmlRpcClientInte rface.sendRpcRequest(XmlRpcClientInterface.java:42)
        at  com.sixdee.rpc.ClientMain .GetAccountDetailsT(ClientMain.java:153)
         at com.sixdee.rpc.ClientMain .GetAccountDetailsT(ClientMain.java:223)
        at com.sixdee.ETopupObject .performINOperation(ETopupObject.java:1326)
        at com.sixdee.ETopupObject .processDealerRecharge(ETopupObject.java:640)
        at com.sixdee.ETopupObject .processESMEMessage(ETopupObject.java:318)
        at com.sixdee.ESMEHandler.run(ESMEHandler.java:272)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.StringIndexOutOfBound sException: String index out of range: 255
        at java.lang.String.charAt(String.java:558)
        at uk.co.wilson.xml.MinML.parse(MinML.java:371)
        at uk.co.wilson.xml.MinML.parse(MinML.java:487)
        at org.apache.xmlrpc.XmlRpc.parse(XmlRpc.java:472)
        at org.apache.xmlrpc.XmlRpcClientR  esponseProcessor.decodeResponse(XmlRpcClientResponseProcessor .java:68)
         ... 11 more

XmlRpcClient client = new XmlRpcClient(url);
        CommonsXmlRpcTransport transport = new CommonsXmlRpcTransport(new URL(url));
        HashMap result=new HashMap();
        Hashtable resultData = new Hashtable();
        Vector args = new Vector();
        args.add(hm);
        String username= "abc";
        String password = "xyz";
transport.setBasicAuthentication(username,password);
        transport.setHttp11(true);
        transport.setUserAgent("UGw Server/2.0/1.0");
XmlRpcRequest req=new XmlRpcRequest(command,args);
         try
        {
         Object obj=(Hashtable)client.execute(req,transport);
        System.out.println("The Type of Object returned:"+obj.getClass().getName());
        resultData=(Hashtable)obj;
        System.out.println("Converted to HashTable");
}
        catch(Exception e)
        {
            e.printStackTrace();
            System.out.println("Error occured while execution");
            throw e;
        }

Thankx in Advance,

Gopal

Re: Client XML Parsing Problem

Posted by "D. Gopala Krishna Murthy" <go...@6dtech.co.in>.
Thanks for your Suggestions, 
Hope i will resolve this soon, 

Thanks a lot.

Gopal

Jochen Wiedmann <jo...@gmail.com> wrote: On 2/28/07, D. Gopala Krishna Murthy  wrote:

> The same code is working perfectly fine on Windows but not on Linux.

You did not understand the problem.

The response is rejected *by the XML parser* (not by the XML-RPC
client), because the server sends invalid XML. Depending on the XML
parser, it may very well happen, that some XML parser barks, some
other doesn't.

The problem's reason is most possibly, that you are sending a string
which contains invalid characers (like ASCII 0, for example). That's
something you must fix on the server side. If you are actually sending
binary data (where ASCII 0 is perfectly valid), then the server should
send the data as a byte array and not as a string.

Jochen


-- 
Emacs 22 will support MacOS and CygWin. It is not yet decided, whether
these will be used to run Emacs or the other way round.

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlrpc-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: xmlrpc-dev-help@ws.apache.org



Re: Client XML Parsing Problem

Posted by Jochen Wiedmann <jo...@gmail.com>.
On 2/28/07, D. Gopala Krishna Murthy <go...@6dtech.co.in> wrote:

> The same code is working perfectly fine on Windows but not on Linux.

You did not understand the problem.

The response is rejected *by the XML parser* (not by the XML-RPC
client), because the server sends invalid XML. Depending on the XML
parser, it may very well happen, that some XML parser barks, some
other doesn't.

The problem's reason is most possibly, that you are sending a string
which contains invalid characers (like ASCII 0, for example). That's
something you must fix on the server side. If you are actually sending
binary data (where ASCII 0 is perfectly valid), then the server should
send the data as a byte array and not as a string.

Jochen


-- 
Emacs 22 will support MacOS and CygWin. It is not yet decided, whether
these will be used to run Emacs or the other way round.

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlrpc-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: xmlrpc-dev-help@ws.apache.org


Re: Client XML Parsing Problem

Posted by "D. Gopala Krishna Murthy" <go...@6dtech.co.in>.
Hi,

The same code is working perfectly fine on Windows but not on Linux.
I am using a Tomcat with a XmlRpcServlet for Handling requests in windows XP, and I am running the client in Eclipse, the communication is happening as expected, but the same prebuilt request is giving error when run on Linux.
Only the Server IP and Port number are changed, which ideally should give no problems.....

please help....

Thankx in Advance

Gopal

Georg Sauer-Limbach <gs...@gslweb.de> wrote: Hi,

the XML you are trying to parse is not well-formed, it
contains an invalid Character Entity. These are these
constructs like   or   . The first is the decimal
form, the latter the hex form. Be sure to include only
allowed digits (hex may be upper- and lowercase) and
to conclude the entity with a semicolon. The number
must be the Unicode code point of the character that
you want to represent.

Georg

D. Gopala Krishna Murthy wrote:
> Hi,
> I am using xmlrpc-2.0.1.jar and am getting this exception when i try to connect to a server.  Please find my client code below the exception:
> I am using a server which is xmlrpc-1.2.jar
>
>
> Fatal error parsing XML: org.xml.sax.SAXParseException: invalid Character Entitiy
> org.apache.xmlrpc.XmlRpcClientE xception: Error decoding XML-RPC response
>         at org.apache.xmlrpc.XmlRpcClientR esponseProcessor.decodeResponse(XmlRpcClientResponseProcessor .java:80)
>         at org.apache.xmlrpc.XmlRpcClientW orker.execute(XmlRpcClientWorker.java:73)
>         at org.apache.xmlrpc.XmlRpcClient .execute(XmlRpcClient.java:194)
>         at com.sixdee.rpc.RpcRequest .sendRequest(RpcRequest.java:41)
>         at com.sixdee.rpc.XmlRpcClientInte rface.sendRpcRequest(XmlRpcClientInterface.java:42)
>         at  com.sixdee.rpc.ClientMain .GetAccountDetailsT(ClientMain.java:153)
>          at com.sixdee.rpc.ClientMain .GetAccountDetailsT(ClientMain.java:223)
>         at com.sixdee.ETopupObject .performINOperation(ETopupObject.java:1326)
>         at com.sixdee.ETopupObject .processDealerRecharge(ETopupObject.java:640)
>         at com.sixdee.ETopupObject .processESMEMessage(ETopupObject.java:318)
>         at com.sixdee.ESMEHandler.run(ESMEHandler.java:272)
>         at java.lang.Thread.run(Thread.java:595)
> Caused by: java.lang.StringIndexOutOfBound sException: String index out of range: 255
>         at java.lang.String.charAt(String.java:558)
>         at uk.co.wilson.xml.MinML.parse(MinML.java:371)
>         at uk.co.wilson.xml.MinML.parse(MinML.java:487)
>         at org.apache.xmlrpc.XmlRpc.parse(XmlRpc.java:472)
>         at org.apache.xmlrpc.XmlRpcClientR  esponseProcessor.decodeResponse(XmlRpcClientResponseProcessor .java:68)
>          ... 11 more
>
> XmlRpcClient client = new XmlRpcClient(url);
>         CommonsXmlRpcTransport transport = new CommonsXmlRpcTransport(new URL(url));
>         HashMap result=new HashMap();
>         Hashtable resultData = new Hashtable();
>         Vector args = new Vector();
>         args.add(hm);
>         String username= "abc";
>         String password = "xyz";
> transport.setBasicAuthentication(username,password);
>         transport.setHttp11(true);
>         transport.setUserAgent("UGw Server/2.0/1.0");
> XmlRpcRequest req=new XmlRpcRequest(command,args);
>          try
>         {
>          Object obj=(Hashtable)client.execute(req,transport);
>         System.out.println("The Type of Object returned:"+obj.getClass().getName());
>         resultData=(Hashtable)obj;
>         System.out.println("Converted to HashTable");
> }
>         catch(Exception e)
>         {
>             e.printStackTrace();
>             System.out.println("Error occured while execution");
>             throw e;
>         }
>
> Thankx in Advance,
>
> Gopal
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlrpc-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: xmlrpc-dev-help@ws.apache.org



Re: Client XML Parsing Problem

Posted by Georg Sauer-Limbach <gs...@gslweb.de>.
Hi,

the XML you are trying to parse is not well-formed, it
contains an invalid Character Entity. These are these
constructs like &#32; or &#x20; . The first is the decimal
form, the latter the hex form. Be sure to include only
allowed digits (hex may be upper- and lowercase) and
to conclude the entity with a semicolon. The number
must be the Unicode code point of the character that
you want to represent.

Georg

D. Gopala Krishna Murthy wrote:
> Hi,
> I am using xmlrpc-2.0.1.jar and am getting this exception when i try to connect to a server.  Please find my client code below the exception:
> I am using a server which is xmlrpc-1.2.jar
>
>
> Fatal error parsing XML: org.xml.sax.SAXParseException: invalid Character Entitiy
> org.apache.xmlrpc.XmlRpcClientE xception: Error decoding XML-RPC response
>         at org.apache.xmlrpc.XmlRpcClientR esponseProcessor.decodeResponse(XmlRpcClientResponseProcessor .java:80)
>         at org.apache.xmlrpc.XmlRpcClientW orker.execute(XmlRpcClientWorker.java:73)
>         at org.apache.xmlrpc.XmlRpcClient .execute(XmlRpcClient.java:194)
>         at com.sixdee.rpc.RpcRequest .sendRequest(RpcRequest.java:41)
>         at com.sixdee.rpc.XmlRpcClientInte rface.sendRpcRequest(XmlRpcClientInterface.java:42)
>         at  com.sixdee.rpc.ClientMain .GetAccountDetailsT(ClientMain.java:153)
>          at com.sixdee.rpc.ClientMain .GetAccountDetailsT(ClientMain.java:223)
>         at com.sixdee.ETopupObject .performINOperation(ETopupObject.java:1326)
>         at com.sixdee.ETopupObject .processDealerRecharge(ETopupObject.java:640)
>         at com.sixdee.ETopupObject .processESMEMessage(ETopupObject.java:318)
>         at com.sixdee.ESMEHandler.run(ESMEHandler.java:272)
>         at java.lang.Thread.run(Thread.java:595)
> Caused by: java.lang.StringIndexOutOfBound sException: String index out of range: 255
>         at java.lang.String.charAt(String.java:558)
>         at uk.co.wilson.xml.MinML.parse(MinML.java:371)
>         at uk.co.wilson.xml.MinML.parse(MinML.java:487)
>         at org.apache.xmlrpc.XmlRpc.parse(XmlRpc.java:472)
>         at org.apache.xmlrpc.XmlRpcClientR  esponseProcessor.decodeResponse(XmlRpcClientResponseProcessor .java:68)
>          ... 11 more
>
> XmlRpcClient client = new XmlRpcClient(url);
>         CommonsXmlRpcTransport transport = new CommonsXmlRpcTransport(new URL(url));
>         HashMap result=new HashMap();
>         Hashtable resultData = new Hashtable();
>         Vector args = new Vector();
>         args.add(hm);
>         String username= "abc";
>         String password = "xyz";
> transport.setBasicAuthentication(username,password);
>         transport.setHttp11(true);
>         transport.setUserAgent("UGw Server/2.0/1.0");
> XmlRpcRequest req=new XmlRpcRequest(command,args);
>          try
>         {
>          Object obj=(Hashtable)client.execute(req,transport);
>         System.out.println("The Type of Object returned:"+obj.getClass().getName());
>         resultData=(Hashtable)obj;
>         System.out.println("Converted to HashTable");
> }
>         catch(Exception e)
>         {
>             e.printStackTrace();
>             System.out.println("Error occured while execution");
>             throw e;
>         }
>
> Thankx in Advance,
>
> Gopal
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlrpc-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: xmlrpc-dev-help@ws.apache.org