[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster-devel] python xml-rpc client, key with embedded ampersand

Hi Brad,

1) When i try this (java) client with CORBA or SOCKET

java javaclients.HelloWorldPublish -session.name aPublisher/1 -numPublish 5 -persistent false -oid Hello -clientTags "<org.xmlBlaster><a>&amp;</a></org.xmlBlaster>"

publishing works fine, but the subscriber has problems parsing it
(java javaclients.HelloWorldSubscribe -oid Hello).

2) Switching to XMLRPC the same fails, but escaping twice works again:

java javaclients.HelloWorldPublish -protocol XMLRPC -session.name aPublisher/1 -numPublish 5 -persistent false -oid Hello -clientTags "<org.xmlBlaster><a>&amp;amp;</a></org.xmlBlaster>"

The java subscriber runs fine with this setup (&amp;amp;) and receives a '&' as expected
for all protocols (XMLRPC, SOCKET, CORBA).

So why do we need to escape twice?
I don't know yet, Michele any idea?


Brad Clements wrote:

I am running xmlBlaster version 1.0.6 Xmas 2005-08-10

I'm using pyblaster, sending a key that contains an element, whose element text includes an amper sign.

xml-blaster receives the xml-rpc request, but seems that somewhere, the escaping of the amper is not handled properly.

I added a print statement to pyblaster.py, in XMLBlasterClient.publish()

XMLKEY = '<key contentMime="text/xml"><sfi type="instance">
       <messageprocessor type="instance">
           <organization>Dew Engineering &amp; Development In</organization>

You'll note that in the publish call, the amper in the <organization> element is escaped.

However I get an xml-rpc error back from the publish call
(in this example, the key is slightly different, but it's the same basic problem)

Module pyBlaster.pyBlaster, line 213, in publish
Module xmlrpclib, line 1032, in __call__
Module xmlrpclib, line 1319, in __request
Module xmlrpclib, line 1083, in request
Module xmlrpclib, line 1222, in _parse_response
Module xmlrpclib, line 745, in close
Fault: <Fault 0: "java.lang.Exception: errorCode=legacy message=#exported Problems when building DOM tree from your XML-ASCII string: org.xml.sax.SAXParseException: Illegal character or entity reference syntax.\n
<key oid='xmlBlaster_192_168_1_9_3412-1129841072925000000' contentMime='text/xml'>\n <sfi type='instance'>
<messageprocessor type='instance'>
<organization>Dew Engineering & Development In</organization>
</sfi>\n </key>">

Note that the returned error text does not show that the amp is escaped..

Etherreal shows that the xml text is all escaped.

       <?xml version='1.0'?>
       <value><string>&lt;key contentMime="text/xml"&gt;
           &lt;sfi type="instance"&gt;&lt;messageprocessor type="instance"&gt;
           &lt;/dn&gt;&lt;organization&gt;Dew Engineering &amp;amp; Development In
       &lt;expiration lifeTime="30000"  /&gt;

This looks like a problem in the xml-rpc server component of xml-blaster. Is there a fix?