tags:

views:

150

answers:

2

Hello,

I am using SUDS (Like SOAP) to test WSDL files. The methods contain types that are linked to further functions. I am not sure how to access the variables stored in the types that are displayed. Some sample code is below:

from suds.client import Client
client=Client('http://eample.wsdl')
print client

response is:

 Ports (1):
      (PTZ)
         Methods (4):
            AbsoluteMove(ns4:ReferenceToken ProfileToken, ns4:PTZVector Destination, ns4:PTZSpeed Speed, )
         Types (303):
            ns4:PTZSpeed

I am able to get access to these functions. I cannot find any documentation on how to test functions in SUDS. I want to test to see if functions work and checking their return values. Does anyone know how to do this?

I used the command below to display all child functions.

client.factory.create('AbsoluteMove.PTZSpeed.Speed.PanTilt')

I main problem is basically passing values into the functions and getting return values.

I have tried to pass the arguments but the parameters have attributes stored in the attributes. Below shows the layout for the structure of the parameters I'm trying to access.

(AbsoluteMove){
    ProfileToken = None
    Destination = 
      (PTZVector){
         PanTilt = 
            (Vector2D){
               _x = ""
               _y = ""
               _space = ""
            }
         Zoom = 
            (Vector1D){
               _x = ""
               _space = ""
            }
      }
   Speed = 
      (PTZSpeed){
         PanTilt = 
            (Vector2D){
               _x = ""
               _y = ""
               _space = ""
            }
         Zoom = 
            (Vector1D){
               _x = ""
               _space = ""

The parameters are more complex than just entering simple values.

+2  A: 

Try to invoke the method on the service:

from suds.client import Client
client=Client('http://eample.wsdl')
res = client.service.AbsoluteMove(profile_token, destination, speed)
print res

You'll need to determine what values to put in for those arguments to the AbsoluteMove method.

jps
+1  A: 

Client.factory.create is for the instantiation of object types that are internal to the service you are utilizing. If you're just doing a method call (which it seems you are), invoke it directly.

jathanism