Hello Duncan and Martin,<br><br>Thanks for your answers.<br>Here is my server class.<br>It just takes a list and append a new item to the list.<br>----------------------------------------------------------------------------------<br>
class Echo_i (Example__POA.Echo):<br> def echoString(self, mesg):<br> print "echoString() called with message:", mesg<br> mesg.append("new")<br> return mesg<br><br>My objective is to pass a sequence (i.e list) to the server method and modify the list from there. I suppose python lists are passed by reference by default. The changes that I am doing to the list within the server method should be reflected on the client without actually returning the list. But when I tried it did not happen that way. I had to return the list to the client to update the list on its side. I am not sure whether this is the expected behavior or am i doing something wrong here. Could anyone please help me here?<br>
<br>After few trials, I was able to get rid of the CORBA_BAD_PARAM error. Here is my new IDL and client code. Server code is same as what I pasted above.<br>---IDL--------<br>module Example {<br> typedef sequence<string> sample;<br>
interface Echo {<br> void echoString(inout sample mesg);<br> };<br>};<br><br>----Client code--------------<br>message = ["hello"]<br>result = eo.echoString(message)<br>print "I said '%s'. The object said '%s'." % (message,result)<br>
<br>-------- output from client execution ---<br>I said '['hello']'. The object said '['hello', 'new']'.<br><br>Thanks a lot once again for your help.<br><br>Regards,<br>Deepan<br><br>
<br><div class="gmail_quote">On Wed, Jan 7, 2009 at 7:37 AM, Duncan Grisby <span dir="ltr"><<a href="mailto:duncan@grisby.org">duncan@grisby.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Tuesday 6 January, "Deepan N Seeralan" wrote:<br>
<br>
> This example works just fine without any modifications. However, if i try to<br>
> change the parameters of the method 'echoString' from string to a sequence, I<br>
> get CORBA_BAD_PARAM error.<br>
<br>
</div>That means the Python type of either the arguments or the return value<br>
do not match the IDL.<br>
<div class="Ih2E3d"><br>
> Here is the new IDL and piece of client code where i invoke the method<br>
> echoString.<br>
> module Example {<br>
> typedef sequence<string> sample;<br>
> interface Echo {<br>
> void echoString(inout sample mesg);<br>
> };<br>
> };<br>
<br>
</div>Did you really mean to use inout there? That means the sequence is<br>
returned from the server back to the client.<br>
<div class="Ih2E3d"><br>
> .. client code:<br>
> message = ["hello"] #python list<br>
> result = eo.echoString(message)<br>
> print "I said '%s'. The object said '%s'." % (message,result)<br>
><br>
> I referred to the CORBA-Python mapping document which says that list and<br>
> tuples are the equivalent objects of CORBA sequence. However, when I run the<br>
> server and client, it throws the error omniORB.CORBA.BAD_PARAM:<br>
> CORBA.BAD_PARAM(omniORB.BAD_PARAM_WrongPythonType, CORBA.COMPLETED_MAYBE).<br>
<br>
</div>You probably aren't returning the list from your servant method. What<br>
does your servant class look like?<br>
<br>
You can get more information about where the exception came from by<br>
running your code with command line arguments -ORBtraceExceptions 1<br>
<br>
Cheers,<br>
<br>
Duncan.<br>
<font color="#888888"><br>
--<br>
-- Duncan Grisby --<br>
-- <a href="mailto:duncan@grisby.org">duncan@grisby.org</a> --<br>
-- <a href="http://www.grisby.org" target="_blank">http://www.grisby.org</a> --<br>
</font></blockquote></div><br>