Hi There, I'm looking for an example of a simple SOAP web service call using the Zolera SOAP Infrastructure library. The web service I am trying to call contains a method that is supposed to accept a string as a parameter and output it to a file.
I have tried the following and I am able to create the file on the web server although the file is empty. Is there additional code required for this? from datetime import datetime from EventsDatabase_services import * from ZSI.client import * import sys def main(): SOAPAction = 'http://tempuri.org/ALU.EventsDatbase/ EventsDatabase/LogEventStringInputTest' teststring = 'This is a test' loc = EventsDatabaseLocator() port = loc.getEventsDatabaseSoap() req = LogEventStringInputTestSoapIn() req.input = 'test' resp = port.LogEventStringInputTest(req) print resp ################################################## # EventsDatabase_services.py # generated by ZSI.generate.wsdl2python ################################################## from EventsDatabase_services_types import * import urlparse, types from ZSI.TCcompound import ComplexType, Struct from ZSI import client import ZSI from ZSI.generate.pyclass import pyclass_type # Locator class EventsDatabaseLocator: EventsDatabaseSoap_address = "http://tipsy/ALU.EventsDatabase/ EventsDatabase.asmx" def getEventsDatabaseSoapAddress(self): return EventsDatabaseLocator.EventsDatabaseSoap_address def getEventsDatabaseSoap(self, url=None, **kw): return EventsDatabaseSoapSOAP(url or EventsDatabaseLocator.EventsDatabaseSoap_address, **kw) # Methods class EventsDatabaseSoapSOAP: def __init__(self, url, **kw): kw.setdefault("readerclass", None) kw.setdefault("writerclass", None) # no resource properties self.binding = client.Binding(url=url, **kw) # no ws-addressing # op: LogEventStringInputTest def LogEventStringInputTest(self, request): if isinstance(request, LogEventStringInputTestSoapIn) is False: raise TypeError, "%s incorrect request type" % (request.__class__) kw = {} # no input wsaction self.binding.Send(None, None, request, soapaction="http:// tempuri.org/ALU.EventsDatbase/EventsDatabase/LogEventStringInputTest", **kw) # no output wsaction response = self.binding.Receive(LogEventStringInputTestSoapOut.typecode) return response LogEventStringInputTestSoapIn = ns0.LogEventStringInputTest_Dec().pyclass LogEventStringInputTestSoapOut = ns0.LogEventStringInputTestResponse_Dec().pyclass ################################################## ################################################## import ZSI import ZSI.TCcompound from ZSI.schema import LocalElementDeclaration, ElementDeclaration, TypeDefinition, GTD, GED from ZSI.generate.pyclass import pyclass_type ############################## # targetNamespace # http://tempuri.org/ALU.EventsDatbase/EventsDatabase ############################## class ns0: targetNamespace = "http://tempuri.org/ALU.EventsDatbase/ EventsDatabase" class LogEventStringInputTest_Dec(ZSI.TCcompound.ComplexType, ElementDeclaration): literal = "LogEventStringInputTest" schema = "http://tempuri.org/ALU.EventsDatbase/EventsDatabase" def __init__(self, **kw): ns = ns0.LogEventStringInputTest_Dec.schema TClist = [ZSI.TC.String(pname=(ns,"input"), aname="_input", minOccurs=0, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded"))] kw["pname"] = ("http://tempuri.org/ALU.EventsDatbase/ EventsDatabase","LogEventStringInputTest") kw["aname"] = "_LogEventStringInputTest" self.attribute_typecode_dict = {} ZSI.TCcompound.ComplexType.__init__(self,None,TClist,inorder=0,**kw) class Holder: __metaclass__ = pyclass_type typecode = self def __init__(self): # pyclass self._input = None return Holder.__name__ = "LogEventStringInputTest_Holder" self.pyclass = Holder class LogEventStringInputTestResponse_Dec(ZSI.TCcompound.ComplexType, ElementDeclaration): literal = "LogEventStringInputTestResponse" schema = "http://tempuri.org/ALU.EventsDatbase/EventsDatabase" def __init__(self, **kw): ns = ns0.LogEventStringInputTestResponse_Dec.schema TClist = [ZSI.TC.String(pname=(ns,"LogEventStringInputTestResult"), aname="_LogEventStringInputTestResult", minOccurs=0, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded"))] kw["pname"] = ("http://tempuri.org/ALU.EventsDatbase/ EventsDatabase","LogEventStringInputTestResponse") kw["aname"] = "_LogEventStringInputTestResponse" self.attribute_typecode_dict = {} ZSI.TCcompound.ComplexType.__init__(self,None,TClist,inorder=0,**kw) class Holder: __metaclass__ = pyclass_type typecode = self def __init__(self): # pyclass self._LogEventStringInputTestResult = None return Holder.__name__ = "LogEventStringInputTestResponse_Holder" self.pyclass = Holder class string_Dec(ZSI.TC.String, ElementDeclaration): literal = "string" schema = "http://tempuri.org/ALU.EventsDatbase/EventsDatabase" def __init__(self, **kw): kw["pname"] = ("http://tempuri.org/ALU.EventsDatbase/ EventsDatabase","string") kw["aname"] = "_string" class IHolder(str): typecode=self kw["pyclass"] = IHolder IHolder.__name__ = "_string_immutable_holder" ZSI.TC.String.__init__(self, **kw) # end class ns0 (tns: http://tempuri.org/ALU.EventsDatbase/EventsDatabase) -- http://mail.python.org/mailman/listinfo/python-list