Re: [pyatl] zsi sope complextype question and wsdl2py

From: Corey O.
Sent on: Monday, February 15, 2010 10:40 PM
Dude!  Suds is pretty awesome.  It took me about 30 min to get things working.  Suds is just really easy.  Thanks for introducing suds.  



Corey
On Feb 15, 2010, at 9:56 AM, Matt Cauthorn wrote:

Hi list - been lurking for a while now :). Fwiw had to ditch ZSI completely, for a bunch of reasons. The class generation is really nice in ZSI but I really needed support for soap encoded arrays and ZSI wasn't able to do this in a way that made sense. Also, the ServicProxy module, which I eventually fell back to in lieu of generated classes, produced a bunch of stub code that's never referenced...

Anyhow, if you're using this for client side code, I'd strongly suggest you look at Suds as Doug mentions above. It's a really nice library and the author (Jeff Ortel of Redhat) is ultra-responsive and is keen on writing a great library. I've had enormous success with this library. Recently Jeff has added some better caching support so if a pure proxy implementation gives you pause this should help a bit.

I've written a python wrapper for a slew of WSDLs for f5's BigIP application delivery controllers and it works great thanks to Suds. My ZSI-based version was less than ideal.

Regards,
Matt

On Sun, Feb 14, 2010 at 8:05 PM, Corey Osman <[address removed]> wrote:
Hi,

So I used the wsdl2py converter to convert a wsdl xml file to python code and have a few questions with some of the code generated.

The getProfileSoap function requires that you pass in a request type def that includes user credentials.  This is fine but I am a little lost on how to exactly create this request.  I figured I have to instantiate a Credential_Def with username, password but I am unsure of how to pass these variables in in order to create this type. 

>> def __init__(self, pname, ofwhat=(), attributes=None, extend=False, restrict=False, **kw):

The line above doesn't mention anything about username,password.  Do I pass a string, list, dict?  Do I need to create a ZSI.TC.String?


Anybody have experience with ZSI web services that can help me out?

thanks,


Core Osman

def getProfileSoap(self, request):
        if isinstance(request, getProfileSoapRequest) is False:
            raise TypeError, "%s incorrect request type" % (request.__class__)
        kw = {}
        # no input wsaction
        self.binding.Send(None, None, request, soapaction="urn:getProfileSoap", encodingStyle="http://schemas.xmlsoap.org/soap/encoding/", **kw)
        # no output wsaction
        typecode = Struct(pname=None, ofwhat=getProfileSoapResponse.typecode.ofwhat, pyclass=getProfileSoapResponse.typecode.pyclass)
        response = self.binding.Receive(typecode)
        return response

class getProfileSoapRequest:
    def __init__(self):
        self._cred = None
        self._userid = None
        return

class Credential_Def(ZSI.TCcompound.ComplexType, TypeDefinition):
        schema = "urn:WebdialerSoap"
        type = (schema, "Credential")
        def __init__(self, pname, ofwhat=(), attributes=None, extend=False, restrict=False, **kw):
            ns = ns0.Credential_Def.schema
            TClist = [ZSI.TC.String(pname="userID", aname="_userID", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.String(pname="password", aname="_password", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded"))]
            self.attribute_typecode_dict = attributes or {}
            if extend: TClist += ofwhat
            if restrict: TClist = ofwhat
            ZSI.TCcompound.ComplexType.__init__(self, None, TClist, pname=pname, inorder=0, **kw)
            class Holder:
                typecode = self
                def __init__(self):
                    # pyclass
                    self._userID = None
                    self._password = None
                    return
            Holder.__name__ = "Credential_Holder"
            self.pyclass = Holder



On Feb 13, 2010, at 7:27 PM, Doug Hellmann wrote:


On Feb 13, 2010, at 5:37 PM, Corey Osman wrote:

Hi,

I am working on a click to dial project where I need some python code
to use the cisco call manager soap interface to dial a phone number.
I have seen some php code but wanted to know if there was a python
wrapper around the soap calls that would make the CCM API easier.  Has
anybody run across something like this.  Google isn't turning up any
good results.

suds (https://fedorahosted.org/suds/) is a generic Python soap library, is that the sort of thing you mean?  Or are you looking for something specific to this Cisco interface?

Doug




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
http://www.meetup.com/python-atlanta/
This message was sent by Doug Hellmann ([address removed]) from PyAtl: Atlanta Python Programmers.
To learn more about Doug Hellmann, visit his/her member profile: http://www.meetup.com/python-atlanta/members/234167/
To unsubscribe or to update your mailing list settings, click here: http://www.meetup.com/account/comm/
Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]






--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Corey Osman ([address removed]) from PyAtl: Atlanta Python Programmers.
To learn more about Corey Osman, visit his/her member profile
To unsubscribe or to update your mailing list settings, click here

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Matt Cauthorn ([address removed]) from PyAtl: Atlanta Python Programmers.
To learn more about Matt Cauthorn, visit his/her member profile
To unsubscribe or to update your mailing list settings, click here

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy