[omniORB] omniorb_py and trading service

baileyk at schneider.com baileyk at schneider.com
Thu Jun 26 09:24:34 BST 2003


Try

desiredProps = CosTrading.Lookup.SpecifiedProps(
                  CosTrading.Lookup.all, None)

I have no experience with the Trading service, but a union's constructor
expects the discriminant first, and the value second.  The SpecifiedProps
union only requires a value if the discriminant takes one the "some"
enumerated value.  The "none" or "all" discriminants require a None union
value.

The rest looks OK to me as far as parameter types go.  I think you'll want
to capture the return value of the query method variables like so:

offers, offer_iter, limits_applied = lookup.query("ExampleService",
                                           "TRUE", "", policies,
                                           desiredProps, 100 )

The return value of query() is a tuple of three (the three out params).
Python will unpack that tuple into three named variables if you use syntax
like the above.

hth

Kendall





                                                                                                                                         
                      Bernd Winterstein                                                                                                  
                      <bernd.winterstein at vodafone.c        To:       omniorb-list <omniorb-list at omniorb-support.com>                     
                      om>                                  cc:                                                                           
                      Sent by:                             Fax to:                                                                       
                      omniorb-list-bounces at omniorb-        Subject:  Re: [omniORB] omniorb_py and trading service                        
                      support.com                                                                                                        
                                                                                                                                         
                                                                                                                                         
                      06/26/2003 08:04 AM                                                                                                
                      Please respond to                                                                                                  
                      bernd.winterstein                                                                                                  
                                                                                                                                         
                                                                                                                                         




Okay Thanks Duncan.
I'm pretty new to python. I'm trying to write a test driver for an C++
appliction in python. Maybe anyone can help me with this problem
accessing the TradingService. I don't get the right parametrs to call
the query function.

Here is the idl:

                void query (
                        in ServiceTypeName type,
                        in Constraint constr,
                        in Preference pref,
                        in PolicySeq policies,
                        in SpecifiedProps desired_props,
                        in unsigned long how_many,
                        out OfferSeq offers,
                        out OfferIterator offer_itr,
                        out PolicyNameSeq limits_applied
                ) raises (...)

Here is what I try:

policies = []
policies.append( CosTrading.Policy("","") )
desiredProps = CosTrading.Lookup.SpecifiedProps(
CosTrading.Lookup.HowManyProps, CosTrading.Lookup.all)
lookup.query("ExampleService", "TRUE", "", policies, desiredProps, 100 )


Thats what I get:
Traceback (most recent call last):
  File "./ExampleClient.py", line 57, in ?
    lookup.query("ExampleService", "TRUE", "", policies, desiredProps, 100
)
  File
"/home/tesp/bwinters/ld/omniorb_py/lib/python2.2/site-packages/omniORB/COS/CosTrading_idl.py",

line 906, in query
    return _omnipy.invoke(self, "query", _0_CosTrading.Lookup._d_query,
args)
omniORB.CORBA.BAD_PARAM: Minor: BAD_PARAM_WrongPythonType, COMPLETED_NO.

:-(

Any ideas?

Duncan Grisby wrote:

>On Thursday 26 June, Bernd Winterstein wrote:
>
>
>
>>I have a problem accessing the TradingService from python. Maybe anyone
>>has a good idea.
>>
>>
>
>[...]
>
>
>>lookup.query("ExampleService", "TRUE", "", policies, desiredProps, 1,
>>offers, iterator, appliedPolicies )
>>
>>
>[...]
>
>
>>TypeError: Operation requires 6 arguments; 9 given
>>
>>
>
>You're calling query() with the wrong number of arguments, just like
>it says. IDL out arguments are represented as extra returns values in
>a tuple, not as parameters.
>
>Cheers,
>
>Duncan.
>
>
>

_______________________________________________
omniORB-list mailing list
omniORB-list at omniorb-support.com
http://www.omniorb-support.com/mailman/listinfo/omniorb-list








More information about the omniORB-list mailing list