A fork of https://github.com/Synerty/SOAPpy-py3 This is a working tree till fixes get imported upstream.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

47 lines
1.4 KiB

  1. #!/usr/bin/env python
  2. ident = '$Id: newsTest.py,v 1.4 2003/05/21 14:52:37 warnes Exp $'
  3. import os, re
  4. import sys
  5. sys.path.insert(1, "..")
  6. from SOAPpy import SOAPProxy
  7. # Check for a web proxy definition in environment
  8. try:
  9. proxy_url=os.environ['http_proxy']
  10. phost, pport = re.search('http://([^:]+):([0-9]+)', proxy_url).group(1,2)
  11. proxy = "%s:%s" % (phost, pport)
  12. except:
  13. proxy = None
  14. SoapEndpointURL = 'http://www22.brinkster.com/prasads/BreakingNewsService.asmx?WSDL'
  15. MethodNamespaceURI = 'http://tempuri.org/'
  16. # Three ways to do namespaces, force it at the server level
  17. server = SOAPProxy(SoapEndpointURL, namespace = MethodNamespaceURI,
  18. soapaction='http://tempuri.org/GetCNNNews', encoding = None,
  19. http_proxy=proxy)
  20. print "[server level CNN News call]"
  21. print server.GetCNNNews()
  22. # Do it inline ala SOAP::LITE, also specify the actually ns (namespace) and
  23. # sa (soapaction)
  24. server = SOAPProxy(SoapEndpointURL, encoding = None)
  25. print "[inline CNNNews call]"
  26. print server._ns('ns1',
  27. MethodNamespaceURI)._sa('http://tempuri.org/GetCNNNews').GetCNNNews()
  28. # Create an instance of your server with specific namespace and then use
  29. # inline soapactions for each call
  30. dq = server._ns(MethodNamespaceURI)
  31. print "[namespaced CNNNews call]"
  32. print dq._sa('http://tempuri.org/GetCNNNews').GetCNNNews()
  33. print "[namespaced CBSNews call]"
  34. print dq._sa('http://tempuri.org/GetCBSNews').GetCBSNews()