XML RPC Parser Exception

View: New views
13 Messages — Rating Filter:   Alert me  

XML RPC Parser Exception

by pvishwakarma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

 

I have a question about XML RPC library behaviour. It works fine but
many a times it gives me error:

 

Java.lang.RuntimeException:org:apache.xmlrpc.client.XmlRpcClientExceptio
n: Failed to parse servers response :Premature end of file.

 

Can someone tell me why do I get this exception randomly.

 

Thanks,

-Preeti

 

 


Re: XML RPC Parser Exception

by Jochen Wiedmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Dec 6, 2007 2:30 AM, Preeti Vishwakarma <pvishwakarma@...> wrote:

> Java.lang.RuntimeException:org:apache.xmlrpc.client.XmlRpcClientExceptio
> n: Failed to parse servers response :Premature end of file.

Most possibly a problem on the server side, which prevented generation
of a valid XML-RPC message.


--
Look, that's why there's rules, understand? So that you think before
you break 'em.

    -- (Terry Pratchett, Thief of Time)

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


Re: XML RPC Parser Exception

by tugwilson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 6 Dec 2007, at 12:25, Jochen Wiedmann wrote:

> On Dec 6, 2007 2:30 AM, Preeti Vishwakarma  
> <pvishwakarma@...> wrote:
>
>> Java.lang.RuntimeException:org:apache.xmlrpc.client.XmlRpcClientExcep
>> tio
>> n: Failed to parse servers response :Premature end of file.
>
> Most possibly a problem on the server side, which prevented generation
> of a valid XML-RPC message.


Another possibility is the content length header is wrong.

If the server counts characters and not bytes and the response is  
UTF-8 encoded but contains non USASCII character then you can get  
this error.

What server are you talking to?


John Wilson


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


RE: XML RPC Parser Exception

by pvishwakarma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

The server my client is talking to is a C based server and I can see
response coming from server. Also this happens randomly as in sometimes
it works fine and at other times it throws exception.

Is it something to do with concurrent requests going to the server. Or
XML RPC not being thread safe.

Any help is appreciated.

Thanks,
-Preeti

-----Original Message-----
From: John Wilson [mailto:tug@...]
Sent: Thursday, December 06, 2007 4:46 AM
To: xmlrpc-dev@...
Subject: Re: XML RPC Parser Exception


On 6 Dec 2007, at 12:25, Jochen Wiedmann wrote:

> On Dec 6, 2007 2:30 AM, Preeti Vishwakarma  
> <pvishwakarma@...> wrote:
>
>> Java.lang.RuntimeException:org:apache.xmlrpc.client.XmlRpcClientExcep

>> tio
>> n: Failed to parse servers response :Premature end of file.
>
> Most possibly a problem on the server side, which prevented generation
> of a valid XML-RPC message.


Another possibility is the content length header is wrong.

If the server counts characters and not bytes and the response is  
UTF-8 encoded but contains non USASCII character then you can get  
this error.

What server are you talking to?


John Wilson


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


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


RE: XML RPC Parser Exception

by pvishwakarma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Adding to my system settings, I am using Tomcat Webserver to send
requests to XML RPC Server where I get this exception:

Java.lang.RuntimeException:org:apache.xmlrpc.client.XmlRpcClientExceptio
n: Failed to parse servers response :Premature end of file.

So, is it possible that Tomcat is issuing number of concurrent requests
to the XML RPC server and there comes a race around condition.

Thanks,
-Preeti

-----Original Message-----
From: Preeti Vishwakarma [mailto:pvishwakarma@...]
Sent: Thursday, December 06, 2007 9:23 AM
To: xmlrpc-dev@...
Subject: RE: XML RPC Parser Exception

Hi,

The server my client is talking to is a C based server and I can see
response coming from server. Also this happens randomly as in sometimes
it works fine and at other times it throws exception.

Is it something to do with concurrent requests going to the server. Or
XML RPC not being thread safe.

Any help is appreciated.

Thanks,
-Preeti

-----Original Message-----
From: John Wilson [mailto:tug@...]
Sent: Thursday, December 06, 2007 4:46 AM
To: xmlrpc-dev@...
Subject: Re: XML RPC Parser Exception


On 6 Dec 2007, at 12:25, Jochen Wiedmann wrote:

> On Dec 6, 2007 2:30 AM, Preeti Vishwakarma  
> <pvishwakarma@...> wrote:
>
>> Java.lang.RuntimeException:org:apache.xmlrpc.client.XmlRpcClientExcep

>> tio
>> n: Failed to parse servers response :Premature end of file.
>
> Most possibly a problem on the server side, which prevented generation
> of a valid XML-RPC message.


Another possibility is the content length header is wrong.

If the server counts characters and not bytes and the response is  
UTF-8 encoded but contains non USASCII character then you can get  
this error.

What server are you talking to?


John Wilson


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


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


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


Can I send XML document as parameter in xml-rpc

by Petersen, Jennifer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a service that allows clients to send messages as Strings over
MQ.

For a synchronous request-reply service we are thinking of using
xml-rpc.
We would like to use this api as it maps into the same path as the MQ
messages:

        Service.submit(String message)

The message itself is either of xml document, csv, edi, etc...our system
inspects the incoming message to determine its type and locates
appropriate parser.

I am anticipating we could have some problems with the xml messages as
it will result in an XML document embedded in another... Our xml schema
doesn't use CDATA so not worried about the CDATA in a CDATA problem...

Wondering if there will be other gotchas if we send a String in a CDATA
tag.

Looking for any better suggestions on how to do this?

(Note that we are trying to avoiding DOM as we have already found it too
be too resource intensive for our system)

Any suggestions/recommendations are appreciated. Encode the xml maybe?

Re: Can I send XML document as parameter in xml-rpc

by Thomas Gärtner-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 03 September 2009 wrote Petersen, Jennifer:
> I have a service that allows clients to send messages as Strings over
> MQ.
>
<snip/>
>
> (Note that we are trying to avoiding DOM as we have already found it too
> be too resource intensive for our system)
>
> Any suggestions/recommendations are appreciated. Encode the xml maybe?

Encoding would be indeed a good idea. I'd gzip the doc and then send it as
Base64 encoded data. That way you can also save a bit bandwidth.

Hope that helps.

Thomas
--
Thomas Gaertner ( host leela )
---------------------------------------------------------------
Please send only plain ASCII-Mail. In case your Mail will be turned down, use
<thomas-gaertner at bluebottle dot com>.
--
>> There is not one truth only out there <<
---
 PGP Key ID: 0x0C3A0F95


signature.asc (492 bytes) Download Attachment

Re: Can I send XML document as parameter in xml-rpc

by Jochen Wiedmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Sep 3, 2009 at 5:08 PM, Petersen,
Jennifer<Jennifer.Petersen@...> wrote:

> I am anticipating we could have some problems with the xml messages as
> it will result in an XML document embedded in another...

Apart from the resulting document size: No, there should not be any
problem, providing that both sides are capable to create and parse
well formed XML. (Apache XML-RPC is capable, of course.)

Jochen


--
Perl rules: http://xkcd.com/224/

Re: Can I send XML document as parameter in xml-rpc

by Jochen Wiedmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Sep 3, 2009 at 6:25 PM, Thomas Gaertner<gaertth@...> wrote:

> Encoding would be indeed a good idea. I'd gzip the doc and then send it as
> Base64 encoded data. That way you can also save a bit bandwidth.

No need to do so, unless the document is really large. And in that
case, it would make more sense to consider streaming the document
contents rather than use encoding and an additional byte buffer.

Jochen


--
Perl rules: http://xkcd.com/224/

RE: Can I send XML document as parameter in xml-rpc

by Petersen, Jennifer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The document could be large which is one of our concerns.
I am looking into how we can stream the document. Can xml-rpc do this?

Thanks.

-----Original Message-----
From: Jochen Wiedmann [mailto:jochen.wiedmann@...]
Sent: September 3, 2009 4:28 PM
To: xmlrpc-dev@...
Subject: Re: Can I send XML document as parameter in xml-rpc

On Thu, Sep 3, 2009 at 6:25 PM, Thomas Gaertner<gaertth@...>
wrote:

> Encoding would be indeed a good idea. I'd gzip the doc and then send
it as
> Base64 encoded data. That way you can also save a bit bandwidth.

No need to do so, unless the document is really large. And in that
case, it would make more sense to consider streaming the document
contents rather than use encoding and an additional byte buffer.

Jochen


--
Perl rules: http://xkcd.com/224/

RE: Can I send XML document as parameter in xml-rpc

by Petersen, Jennifer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I thought that xml embedded in xml was not well-formed.
I know it works in a CDATA as long as the embedded xml does not itself
contain a CDATA. Doesn't work if it does (at least with the parser I am
using...)

I read something about XML Includes but don't fully understand what it
is...

Jennifer

-----Original Message-----
From: Jochen Wiedmann [mailto:jochen.wiedmann@...]
Sent: September 3, 2009 4:23 PM
To: xmlrpc-dev@...
Subject: Re: Can I send XML document as parameter in xml-rpc

On Thu, Sep 3, 2009 at 5:08 PM, Petersen,
Jennifer<Jennifer.Petersen@...> wrote:

> I am anticipating we could have some problems with the xml messages as
> it will result in an XML document embedded in another...

Apart from the resulting document size: No, there should not be any
problem, providing that both sides are capable to create and parse
well formed XML. (Apache XML-RPC is capable, of course.)

Jochen


--
Perl rules: http://xkcd.com/224/

Re: Can I send XML document as parameter in xml-rpc

by tugwilson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 4 Sep 2009, at 16:41, Petersen, Jennifer wrote:

> I thought that xml embedded in xml was not well-formed.
> I know it works in a CDATA as long as the embedded xml does not itself
> contain a CDATA. Doesn't work if it does (at least with the parser I  
> am
> using...)
>
> I read something about XML Includes but don't fully understand what it
> is...

The < and & characters in the embedded document will be escaped as  
< and & by the sender. These will be replaced by < and & by the  
XML parser at the client end. Using a CDATA section is not a good idea  
because the included document might contain a CDATA section and they  
don't nest.

Sending very large documents in this way may well cause you problems.  
The server will have to assemble the entire message in memory before  
it sends it.

A common way of sending very large items using XML-RPC is to send a  
URL which references the item. The client does a GET on the URL to  
retrieve the actual data. This can use chunked transfer and the item  
can be processed in a streaming manner.

John Wilson


Re: Can I send XML document as parameter in xml-rpc

by Jochen Wiedmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Sep 5, 2009 at 1:23 PM, John Wilson<tug@...> wrote:

> the client end. Using a CDATA section is not a good idea because the
> included document might contain a CDATA section and they don't nest.

Unless you do consider, of course. :-)


I'll post some sample code which will handle streaming using CDATA later
this weekend.


Jochen



--
Germanys national anthem is the most boring in the world - how telling!