Trouble with amazon SOAP services
by Priit Laes
Hi!
I am playing around with amazon's SOAP interface with 0.3.3 and
0.3.4_beta, but ran into a backtrace problem. This is the test script:
#!/usr/bin/python
from suds.client import Client
AWS_ACCESS_KEY='' # masked out (but, backtrace happens even with the right key)
url = 'http://ecs.amazonaws.com/AWSECommerceService/2008-08-19/AWSECommerceServi...'
client = Client(url)
req = client.factory.create('ItemSearchRequest')
req.Keywords = 'Canon lens'
res = client.service.ItemSearch('US', AWS_ACCESS_KEY, '', '', 'False', req)
print res
...which runs into following problem/backtrace:
plaes@chi ~/code/soaptest $ ./test.py
No handlers could be found for logger "suds.resolver"
Traceback (most recent call last):
File "./test.py", line 14, in <module>
res = client.service.ItemSearch('US', AWS_ACCESS_KEY, '', '', 'False', req)
File "//usr/lib64/python2.5/site-packages/suds/client.py", line 229, in __call__
return target.call(*args, **kwargs)
File "//usr/lib64/python2.5/site-packages/suds/client.py", line 356, in call
return method(*args, **kwargs)
File "//usr/lib64/python2.5/site-packages/suds/client.py", line 229, in __call__
return target.call(*args, **kwargs)
File "//usr/lib64/python2.5/site-packages/suds/client.py", line 399, in call
return client.invoke(args, kwargs)
File "//usr/lib64/python2.5/site-packages/suds/client.py", line 457, in invoke
result = self.send(msg)
File "//usr/lib64/python2.5/site-packages/suds/client.py", line 482, in send
result = self.succeeded(binding, reply)
File "//usr/lib64/python2.5/site-packages/suds/client.py", line 514, in succeeded
r, p = binding.get_reply(self.method, reply)
File "//usr/lib64/python2.5/site-packages/suds/bindings/binding.py", line 129, in get_reply
result = self.reply_composite(rtypes, nodes)
File "//usr/lib64/python2.5/site-packages/suds/bindings/binding.py", line 179, in reply_composite
sobject = unmarshaller.process(node, resolved)
File "//usr/lib64/python2.5/site-packages/suds/bindings/unmarshaller.py", line 302, in process
return UMBase.process(self, content)
File "//usr/lib64/python2.5/site-packages/suds/bindings/unmarshaller.py", line 87, in process
data, result = self.append(content)
File "//usr/lib64/python2.5/site-packages/suds/bindings/unmarshaller.py", line 103, in append
self.append_children(content)
File "//usr/lib64/python2.5/site-packages/suds/bindings/unmarshaller.py", line 180, in append_children
cdata, cval = self.append(cont)
File "//usr/lib64/python2.5/site-packages/suds/bindings/unmarshaller.py", line 101, in append
self.start(content)
File "//usr/lib64/python2.5/site-packages/suds/bindings/unmarshaller.py", line 323, in start
raise TypeNotFound(content.node.qname())
suds.TypeNotFound: Type not found: 'HTTPHeaders'
Cheers,
Priit :)
15 years, 3 months
Cookie Question
by Jeff Ortel
Marc,
Hmm.... I'm not sure what to tell you. I'll forward to the list and
hope that someone that has experience using cookielib can help.
Anyone?
Jeff
Marc Belmont wrote:
> Hi, I am still trying to figure out how the cookies are working, here is
> the code I use:
>
> from suds.client import Client, SoapClient
> url = "http://demo.gostai.com/WSDL001HHDIZMAKS787F2AHGHFD2DFF/rcweb.wsdl"
> client = Client(url)
> client.service.userAuthenticate("marcbelmont(a)gmail.com
> <mailto:marcbelmont@gmail.com>", "testpass")
> print client.options.transport.cookiejar
>
> The cookie jar is empty.
>
> With the php code, I have cookies.
>
> $address =
> "http://demo.gostai.com/WSDL001HHDIZMAKS787F2AHGHFD2DFF/rcweb.wsdl";
> $client = new SoapClient($address);
> $client->userAuthenticate(array('login' => "marcbelmont(a)gmail.com
> <mailto:marcbelmont@gmail.com>",
> 'password' => "testpass"));
> print_r($client->_cookies);
>
> Happy new year! Marc
>
> On Fri, Dec 19, 2008 at 10:58 AM, Marc Belmont <contact(a)marcbelmont.com
> <mailto:contact@marcbelmont.com>> wrote:
>
> Thanks for the code, I will test my stuff more and I will let you
> know if I manage to make it work.
>
> Bye, Marc
>
>
> On Thu, Dec 18, 2008 at 5:03 PM, Jeff Ortel <jortel(a)redhat.com
> <mailto:jortel@redhat.com>> wrote:
>
> Marc,
>
> Glad to help.
>
> Cookies should be working but it hasn't been tested in several
> releases. I don't have a server that uses cookies so it's hard
> for me to regression test this.
>
> The cookiejar is adding cookies to the urllib2 request and
> extracting cookies from the urllib2 response as follows:
>
> def send(self, request):
> result = None
> url = request.url
> msg = str(request.message)
> headers = request.headers
> log.debug('sending to (%s)\nmessage:\n%s', url, msg)
> try:
> u2request = u2.Request(url, msg, headers)
> self.__addcookies(u2request)
> self.__setproxy(url, u2request)
> fp = self.__open(u2request)
> self.__getcookies(fp, u2request)
> result = fp.read()
> except u2.HTTPError, e:
> if e.code in (202,204):
> result = None
> else:
> raise TransportError(e.msg, e.code, e.fp)
> return result
>
> def __addcookies(self, u2request):
> self.cookiejar.add_cookie_header(u2request)
>
> def __getcookies(self, fp, u2request):
> self.cookiejar.extract_cookies(fp, u2request)
>
> When you walk through this with the debugger, do you not see the
> cookies you're expecting?
>
> What makes you think it's not working?
>
> Regards,
>
> Jeff
>
> Marc Belmont wrote:
>
> Hi, thanks for the quick update. The cookiejar is always
> empty. Has this feature been tested ?
>
> Thanks, Marc
>
> On Thu, Dec 18, 2008 at 3:03 PM, Jeff Ortel
> <jortel(a)redhat.com <mailto:jortel@redhat.com>
> <mailto:jortel@redhat.com <mailto:jortel@redhat.com>>> wrote:
>
> Hey Marc,
>
> Thanks for your interest in suds.
>
> I'm assuming you're using 0.3.3
>
> The best way to do this is to get the (cookielib) cookie
> jar from
> the transport. You should be able to do something like this:
>
> >
> > client = Client(url)
> > cj = client.options.transport.cookiejar
> >
>
> Now that you have the cookie jar, you can do what you
> want with the
> cookies.
>
> Hope this helps,
>
> Jeff
>
>
> Marc Belmont wrote:
>
> Hi,
>
> Is it possible to get the cookie returned by a soap
> call. Example :
> client = Client(url)
> res = client.service.mymethod()
> res.getcookies() # that's what I'm trying to do
>
> I also need to set the cookie before a soap call and
> I don't
> know how to do that.
>
> Have a nice day. Bye
>
>
>
>
15 years, 4 months
SUDS and Changing the Service Port Address
by Itsa Me, Momo!
Hi,
I'm currently working with VTiger and I've noticed that the address in
the service port definition is wrong. I am working with them to see
if we can get that fixed, but in the meantime, is there a way that I
can alter the address of a service port programmatically?
Essentially I need to change the address that
client.service.vtigersoapPort points to when it makes a call.
Thanks!
15 years, 4 months