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

Re: [xmlblaster-devel] Python/xmlrpc publishArr and publishOneway doesn't work

Brad Clements wrote:
I want to use publishOneway from a Python program via pyBlaster.

I note that the signature for this method is wrong in the distributed pyBlaster.py file.

It is:

    def publishOneway(self, xmlKey, content, qos):

But should be:

    def publishOneway(self, msgUnitArr):

I've change the signature and it's corresponding xml-rpc call to:

    def publishOneway(self, msgUnitArr):
        return self.proxy.xmlBlaster.publishOneway(self.sessionId, msgUnitArr)

And I call it like this:

print client.publishOneway([[key.xml, '', qos.xml]])

But that doesn't work, I get an error from xmlBlaster:

xmlrpclib.Fault: <Fault 0: 'java.lang.Exception: errorCode=legacy message=Class Cast Exception'>

(well ok, I cheated, I actually call publishArr so that I can get the excption, but the method signatures are the same)

So, msgUnitArr is a vector of vectors, where the inner vectors have (key, content, qos)

But it doesn't work. Does anyone have any idea why it doesn't work or how I can better debug this?


the reason for the server side exception is that the content was
a string instead of a byte[] and the cast failed.

In the current cvs i have changed as follows:

- Now a content of type 'String' is supported as well (on server side)

- The exception text is nicer for casting problems

- pyBlaster.py has now an example for publishArr()

- The publishOneway() declaration in pyBlaster.py as now fixed
  as you suggested.
  But it still fails, i think it is because an XmlRpc call
  may not return void (the underlying http GET or POST always
  wants to return something).
  For now i have made a hack and publishOneway() calls publishArr()
  and ignores the returned QoS.

Please update with cvs and try again,



This is what is sent on the wire (captured by ethereal)

<?xml version='1.0'?>
<value><string>&lt;key contentMime="text/xml"&gt;&lt;sfi type="instance"&gt;&lt;messageprocessor type="instance"&gt;&lt;preferenceid type="long"&gt;8&lt;/preferenceid&gt;&lt;schedule&gt;Sent&lt;/schedule&gt;&lt;/messageprocessor&gt;&lt;/sfi&gt;&lt;/key&gt;</string></value>
&lt;expiration lifeTime="0"  /&gt;