I have to write a service, not use one.
Sorry for the FAQ, but googling for it just returns zillions of hits
that refer to suds /accessing/ a service.
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
Full disclosure: I know next to nothing about web services, and not sure
what kind of service you want, but I was able to create a simple RESTful
service with cherrypy (www.cherrypy.org) very quickly. Namely a service
you access by 'GET'ing a URL that includes the relevant parameters. For
example, if you start the following script, then you can visit
http://localhost:8080/doNothing?param=value to call it.
import cherrypy # lightweight python web server
class SimpleService:
# define the method handler to be passed named parameters in the URL query
def doNothing(self, param=''):
result = '<?xml version="1.0" encoding="UTF-8"?><result>%s</result>'
%param #really we should escape and encode param
cherrypy.response.headers['Content-Type'] = "text/xml"
return result
# expose this function as a URL
doNothing.exposed = True
# start the service, defaults to listening on port 8080
cherrypy.quickstart(SimpleService)
Cheers,
Patrick
I have to write a service, not use one.
Sorry for the FAQ, but googling for it just returns zillions of hits
that refer to suds /accessing/ a service.
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
Thought this might come in handy to someone else if they are similarly
stuck.
I'm connecting to an internal SOAP 1.2 service, and found I had to
change a couple of hard-wired constants in the suds-0.3.9 tarball I
downloaded before I could talk to it successfully. First it kept giving
me HTTP 415 "unsupported media type" errors. Turned out this is because
it doesn't like Content-Type: text/xml and SoapAction: "" in the header
- instead it insists on Content-Type: application/soap+xml. Then it
insisted that the soap envelope be in a different namespace. Both were
easy to overcome: I just changed the hardwired constants (below). But
maybe there is a better way to detect that automatically, or provide a
way of modifying the defaults from 'outside'?
client.py:SoapClient:headers()
#stock = { 'Content-Type' : 'text/xml', 'SOAPAction': action }
stock = { 'Content-Type' : 'application/soap+xml' }
binding.py:globals:
#envns = ('SOAP-ENV',
'http://schemas.xmlsoap.org/soap/envelope/')
envns = ('SOAP-ENV', 'http://www.w3.org/2003/05/soap-envelope')
Here is a fragment of the WSDL, which includes some clues about being
1.2 but not sure if suds should be able to adjust automatically?
<?xml version="1.0" encoding="UTF-8"?>
<!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version
is JAX-WS RI 2.1.4-b01-. -->
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version
is JAX-WS RI 2.1.4-b01-. -->
<definitions xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:tns="http://services.paws.portraitsoftware.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://services.paws.portraitsoftware.com/"
name="AnalyticsServicesImplService">
...
<binding name="AnalyticsServicesPortBinding"
type="tns:AnalyticsServices">
<soap12:binding
transport="http://www.w3.org/2003/05/soap/bindings/HTTP/"
style="document"></soap12:binding>
...
Cheers,
Patrick
Patrick Surry, PhD
Patrick.Surry(a)portraitsoftware.com
<mailto:Patrick.Surry@portraitsoftware.com>
Customer Analytics Solution Owner
Tel: (617) 457 5230 | Mob: (857) 919 1700 | Fax: (617) 457 5299 | Map
<http://maps.google.com/maps?f=q&hl=en&q=125+Summer+St,+Boston,+MA+02110
&ie=UTF8&z=15&ll=42.353153,-71.057296&spn=0.022644,0.054245&om=1&iwloc=A
>
Support: www.portraitsupport.com <http://www.portraitsupport.com/>
Subscribe to our Newsletter
<http://www.portraitsoftware.com/resources/newsletter>
<http://www.portraitsoftware.com/>
DMA Future Innovators Award Winner 2009
Portrait Software receives first annual innovators award for Uplift
Optimizer
Read more >
<http://www.portraitsoftware.com/newsandevents/press-releases/portrait-s
oftware-receives-2009-dma-future-innovators-award>
NOTICE: This e-mail is intended only for the addressee(s) named above. This e-mail may contain confidential or privileged information; if you are not a named addressee, please do not retain, read, copy or disseminate this message or any part of it. If you have received this email in error, please notify the sender and delete the message from your computer and destroy any copies.
For registration details of the Portrait group of companies, please visit http://www.portraitsoftwarecom/company/company_registration_details
Sudsters:
I'm trying to write a unit test on a view that will respond to SOAPist commands.
To get there, the test must pass XML as if a SOAP client had cooked it
up and sent it over the wire.
So I have a auth object, like this:
wsdl = path(__file__).dirname() / 'QBWebConnectorSvc.wsdl'
wsdl_uri = 'file://' + str(wsdl)
client = Client(wsdl_uri)
auth = client.factory.create('authenticate')
auth.strUserName = 'test'
auth.strPassword = 'password'
Okay, now call _what_, on or around auth, to convert it to its XML?
I'm sure this is easy, because the SUDS internals must do this all the
time, right?
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
Any ideas/suggestions?
$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from suds.client import Client
>>> url = 'https://inWebServices.mir3.com/services/v1.2/mir3'
>>> client = Client(url)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/usr/local/lib/python2.6/dist-packages/suds-0.3.9-py2.6.egg/suds/client.py",
line 111, in __init__
self.wsdl = reader.open(url)
File
"/usr/local/lib/python2.6/dist-packages/suds-0.3.9-py2.6.egg/suds/reader.py",
line 136, in open
d = self.fn(url, self.options)
File
"/usr/local/lib/python2.6/dist-packages/suds-0.3.9-py2.6.egg/suds/wsdl.py",
line 136, in __init__
d = reader.open(url)
File
"/usr/local/lib/python2.6/dist-packages/suds-0.3.9-py2.6.egg/suds/reader.py",
line 73, in open
d = self.download(url)
File
"/usr/local/lib/python2.6/dist-packages/suds-0.3.9-py2.6.egg/suds/reader.py",
line 88, in download
fp = self.options.transport.open(Request(url))
File
"/usr/local/lib/python2.6/dist-packages/suds-0.3.9-py2.6.egg/suds/transport/https.py",
line 60, in open
return HttpTransport.open(self, request)
File
"/usr/local/lib/python2.6/dist-packages/suds-0.3.9-py2.6.egg/suds/transport/http.py",
line 64, in open
raise TransportError(str(e), e.code, e.fp)
suds.transport.TransportError: HTTP Error 405: HTTP method GET is not
supported by this URL
>>>
Bryan Maupin
BANNED CONTENTS ALERT
Our content checker found
banned name: multipart/mixed |
application/octet-stream,.exe,.exe-ms,message.scr
in email presumably from you <fedora-suds-list(a)redhat.com>
to the following recipient:
-> jsalvage(a)cs.drexel.edu
Our internal reference code for your message is 28610-13/H9P9Q6Z1kQiz
First upstream SMTP client IP address: [121.246.27.37]
According to a 'Received:' trace, the message originated at: [121.246.27.37],
redhat.com unknown [121.246.27.37]
Return-Path: <fedora-suds-list(a)redhat.com>
Subject: Delivery reports about your e-mail
Delivery of the email was stopped!
The message has been blocked because it contains a component
(as a MIME part or nested within) with declared name
or MIME type or contents type violating our access policy.
To transfer contents that may be considered risky or unwanted
by site policies, or simply too large for mailing, please consider
publishing your content on the web, and only sending an URL of the
document to the recipient.
Depending on the recipient and sender site policies, with a little
effort it might still be possible to send any contents (including
viruses) using one of the following methods:
- encrypted using pgp, gpg or other encryption methods;
- wrapped in a password-protected or scrambled container or archive
(e.g.: zip -e, arj -g, arc g, rar -p, or other methods)
Note that if the contents is not intended to be secret, the
encryption key or password may be included in the same message
for recipient's convenience.
We are sorry for inconvenience if the contents was not malicious.
The purpose of these restrictions is to cut the most common propagation
methods used by viruses and other malware. These often exploit automatic
mechanisms and security holes in more popular mail readers (Microsoft
mail readers and browsers are a common target). By requiring an explicit
and decisive action from the recipient to decode mail, the danger of
automatic malware propagation is largely reduced.
{\rtf1\ansi\ansicpg1251\deff0\deflang1049{\fonttbl{\f0\fswiss\fprq2\fcharset204{\*\fname Arial;}Arial CYR;}{\f1\fswiss\fcharset204{\*\fname Arial;}Arial CYR;}}
{\colortbl ;\red0\green0\blue255;\red0\green128\blue0;}
{\*\generator Msftedit 0.6.10.7186;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang9\f0\fs32{\field{\*\fldinst{HYPERLINK "h{\*\dd 0.6.10.7186;}ttp://goldrushonline.info"}}{\fldrslt{\ul\cf1 http://goldrushonline.info}}}\f0\cf1\b\fs32 - ONLINE CASINO!\par
\line\cf2\b\f0\fs28 VIP CLUB Casino is a great online casino that offers the unique combination of top quality games, high payouts and a 24/7 professional customer support.\par
\par100 progressive games with towering jackpots, which are ready to explode and can make multi-millionaires out of VIP CLUB players! Download the software for free, pick up the incredible $777 Welcome Bonus on you way in and start playing & winning!\par
}