[Remedy] Consuming Web Services

from SOAPpy import *

# This is an example based on a default web service created for a default regular form
# (i.e. I created a new form, and saved it without any changes with the name "TEST"; 
# and then created a web service for the form and saved it without any changes)

# It's important to avoid having twice the same value in a method call because in that case
# SOAPpy will use references within the XML document and this breaks authentication 
# (there might be a way to disable that feature, but I didn't find it)

# The ordering of the parameters has to be specified, look at the mapping or the WSDL file
# (OpGet takes a single argument, there is no ambiguity)

Config.argsOrdering={'OpCreate':['Assigned_To','Short_Description','Status','Submitter'],
                     'OpGetList':['Qualification','startRecord','maxLimit'],
                     'OpSet':['Assigned_To','Short_Description','Status','Submitter','Request_ID']}

#Config.debug=1

username="Demo"
password=""

namespace = "urn:TEST"
url = "http://10.0.1.4:8080/arsys/services/ARService?server=macbook&webService=TEST"

header = headerType(data={'AuthenticationInfo':{'userName':username,'password':password}})

server = SOAPProxy(url,namespace)._hd(header)

print "OpCreate: create an entry"
print server.OpCreate(Assigned_To="someoneElse",Short_Description="test",Status="New",Submitter="notDemo")
print

print "OpGetList: list entries matching a criteria"
print server.OpGetList(Qualification="'Request ID' LIKE \"%1\"")
print 

print "OpSet: change an entry"
print server.OpSet(Request_ID="000000000000001",Short_Description="changed",Status="Fixed",Assigned_To="newAssignee",Submitter="notDemo")
print

print "OpGet: get an entry"
print server.OpGet(Request_ID="000000000000001")
print

Links