How to handle HTTP redirect using SOAPpy

Sameer Deshpande sameer_deshpande at hotmail.com
Wed Dec 28 21:11:26 CET 2005


Hi,

I am using python SOAPpy module to call a web service. Call to web
service gets executed successfully. I am facing a problem if the call
to WS results into redirect. I get "HTTPError: <HTTPError 302 Moved
Temporarily>"

If I enable the debug info, I do get the new redirected url. How do I
divert my WS request to new url?

Here is my code

>>>import SOAPpy
>>>reqUrl = "http://localhost:8099/VS/SR/wp?wsdl"
>>>srv = SOAPpy.WSDL.Proxy(reqUrl)
>>>srv.soapproxy.config.dumpHeadersIn = 1
>>>srv.logIn(userID = "myusr", password = "mypwd")

>>> srv.logIn(userID = "myusr", password = "mypwd")
*** Incoming HTTP headers
**********************************************
HTTP/1.? 302 Moved Temporarily
Date: Wed, 28 Dec 2005 14:06:25 GMT
Server: Jetty/5.1.4 (Windows 2000/5.0 x86 java/1.4.2_08
Content-Type: text/xml;charset=ISO-8859-1
Location: http://localhost:8080/VS/SR/wp?method=null
Connection: close
************************************************************************
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\PYTHON23\lib\site-packages\SOAPpy\Client.py", line 470, in
__call__
    return self.__r_call(*args, **kw)
  File "C:\PYTHON23\lib\site-packages\SOAPpy\Client.py", line 492, in
__r_call
    self.__hd, self.__ma)
  File "C:\PYTHON23\lib\site-packages\SOAPpy\Client.py", line 363, in
__call
    config = self.config)
  File "C:\PYTHON23\lib\site-packages\SOAPpy\Client.py", line 263, in
call
    raise HTTPError(code, msg)
HTTPError: <HTTPError 302 Moved Temporarily>

How do I divert all my requests to new url.

Thanks

Sameer




More information about the Python-list mailing list