[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?

rgds
Marcel


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">
           <dn>cn=brad.clements,o=sfiusa,dc=public,dc=strader-ferris,dc=com</dn>
           <organization>Dew Engineering &amp; Development In</organization>
           <admin_message_type>party_username_signup</admin_message_type>
           <message_type>admin_email</message_type>
           <recipient_dn>cn=james.gendron,o=dew,dc=public,dc=strader-ferris,dc=com</recipient_dn>
       </messageprocessor>
   </sfi></key>'


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'>
<dn>cn=brad.clements,o=sfiusa,dc=public,dc=strader-ferris,dc=com</dn>
<organization>Dew Engineering & Development In</organization>
<admin_message_type>party_username_signup</admin_message_type>
<message_type>admin_email</message_type>
<recipient_dn>cn=Janet.Collins,o=dew,dc=public,dc=strader-ferris,dc=com</recipient_dn>
</messageprocessor>
</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'?>
       <methodCall>
       <methodName>xmlBlaster.publish</methodName>
       <params>
       <param>
       <value><string>sessionId:192.168.1.9-null-1129842706775-833827325-90409</string></value>
       </param>
       <param>
       <value><string>&lt;key contentMime="text/xml"&gt;
           &lt;sfi type="instance"&gt;&lt;messageprocessor type="instance"&gt;
           &lt;dn&gt;cn=brad.clements,o=sfiusa,dc=public,dc=strader-ferris,dc=com
           &lt;/dn&gt;&lt;organization&gt;Dew Engineering &amp;amp; Development In
           &lt;/organization&gt;&lt;admin_message_type&gt;party_username_signup
           &lt;/admin_message_type&gt;&lt;message_type&gt;admin_email&lt;/message_type&gt;
           &lt;recipient_dn&gt;cn=james.gendron,o=dew,dc=public,dc=strader-ferris,dc=com
           &lt;/recipient_dn&gt;&lt;/messageprocessor&gt;&lt;/sfi&gt;&lt;/key&gt;</string></value>
       </param>
       <param>
       <value><string></string></value>
       </param>
       <param>
       <value><string>&lt;qos&gt;
       &lt;expiration lifeTime="30000"  /&gt;
       &lt;priority&gt;5&lt;/priority&gt;
       &lt;/qos&gt;</string></value>
       </param>
       </params>
       </methodCall>


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