Suds -> client and for ? the server side ?
by Alexis Michon
Hello,
My question is a little bit off the topic.
Actually, i am programming some webservices and for the client part,
Suds makes a very great job.
This is a very userfriendly tool, a very good job have been done by
developpers, thanks you guy !
But for the server side, i haven't found any tools like Suds.
Do you know a python library that could make the server side of a
webservice infrastructure ? Something that could be use with mod_python
and apache.
I found and tried ZSI, but it isn't enough and it seems to be dead.
So, what library do you use in your infrastructure ?
Thanks you in advance for your help.
++
Alexis
--
Alexis MICHON CNRS, France
IBCP, Institut de Biologie et Chimie des Proteines
Mail : alexis.michon(a)ibcp.fr
Tel : 04.72.72.26.46
Empreinte : 8FDA 1594 2C18 EEDA 681E 8A6D 56EF F0A0 6F06 892A
14 years, 4 months
optional elements
by Yi Qiang
Hi,
The WSDL I am trying to use suds with is a bit annoying in that it defines
certain elements as REQUIRED but read only. For example, it will have
something like the following:
<s:element minOccurs="1" maxOccurs="1" name="fDefault" type="s:boolean"/>
So when suds generates the SOAP request, it will put the following as a
default:
<ns0:fDefault xsi:nil="true"/>
Then the server complains that this is not valid. If I set this to say
"true" or "false", the server complains that this field is read only.
The only way I've been able to work around this is to download the WSDL from
the server, make that element optional by changing "minOccurs" to 0.
Is there anyway to tell suds to not put default elements? I.e., only create
XML elements that I specifically ask for?
Thanks,
Yi
14 years, 4 months
ImportDoctor or SAX?
by Zhiwu Xie
Newbie here, would appreciate your help and/or hint.
Not sure if it's because I didn't use ImportDoctor properly or because it's
a SAX parser so it didn't reach the scheme for the namespace
'urn:theplatform-com:v4/base/' before trying to parse it, or it's the WSDL
file (http://admin.theplatform.com/API/urn:service.wsdl) that's wrongly
formed.
Thanks a lot,
Zhiwu
>>> from suds.xsd.doctor import *
>>> imp = Import('http://www.w3.org/2001/XMLSchema')
>>> imp.filter.add('urn:theplatform-com:v4/base/')
>>> doctor = ImportDoctor(imp)
>>> url = 'http://admin.theplatform.com/API/urn:service.wsdl'
>>> client = Client(url, schemadoctor=doctor)
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
client = Client(url, schemadoctor=doctor)
File "C:\Python25\Lib\site-packages\suds\client.py", line 106, in __init__
self.wsdl = Definitions(url, options)
File "C:\Python25\Lib\site-packages\suds\wsdl.py", line 193, in __init__
self.build_schema()
File "C:\Python25\Lib\site-packages\suds\wsdl.py", line 255, in
build_schema
self.schema = container.load()
File "C:\Python25\Lib\site-packages\suds\xsd\schema.py", line 92, in load
child.dereference()
File "C:\Python25\Lib\site-packages\suds\xsd\schema.py", line 294, in
dereference
midx, deps = x.dependencies()
File "C:\Python25\Lib\site-packages\suds\xsd\sxbasic.py", line 783, in
dependencies
raise TypeNotFound(qref)
TypeNotFound: Type not found: '(BusinessObject,
urn:theplatform-com:v4/base/, )'
14 years, 4 months
schema doctor
by Jeff Ortel
All,
The schema /doctor/ was added in r512 and released in the 0.3.6 beta. The module defines
the Doctor interface and provides one stock implementation. The ImportDoctor is designed
to fix schemas that are missing imports. Those of you using locally stored and fixed
wsdls containing or importing schemas that are missing imports such as:
<xs:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
and
<xs:import namespace="http://www.w3.org/2001/XMLSchema"/>
can now use the schema doctor to patch these schema(s) at runtime and go back to using the
wsdl provided by the service provider.
Also, the Doctor interface is designed to be user extensible. Suds users can write there
own doctor classes to do pretty much whatever is needed to make schema(s) work.
See https://fedorahosted.org/suds/wiki/Documentation#FIXINGBROKENSCHEMAs for examples and
more details.
Regards,
Jeff
14 years, 4 months
multipart reply with binary
by Daryl Daly
I am new to suds and fairly new to SOAP in general.
I am trying to use suds to interact with JasperServer's SOAP server.
versions:
Python 2.5
suds 0.3.5 (also tried 0.3.6)
I am able to connect to the SOAP server and use simple commands but when
I try to use the runReport method I get:
xml.sax._exceptions.SAXParseException: <unknown>:2:6: not well-formed
(invalid token)
It seems that the server is returning a multipart reply. One part of it
is binary (an image). My first question is, should suds be able to
handle this?
Here the code I am using:
from suds.client import Client
client =
Client('http://mxp.norco.com:8080/jasperserver/services/repository?wsdl',username='jasperadmin',password='xxxxxx')
result = client.service.runReport('<request operationName="runReport"
locale="en"><argument
name="RUN_OUTPUT_FORMAT">HTML</argument><resourceDescriptor name=""
wsType="" uriString="/reports/sales/cust_sales_chart"
isNew="false"><label>null</label><parameter
name="cust_no">1dunbcyc</parameter></resourceDescriptor></request>')
If needed I can include the full TCP conversation but it is rather long.
Here is just the beginning part of the reply:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: multipart/related; type="text/xml";
start="<454B124F1FC5659C9A0D323DE8BD639C>";
.boundary="----=_Part_12_32920944.1242418155865"
Date: Fri, 15 May 2009 20:09:15 GMT
Connection: close
------=_Part_12_32920944.1242418155865
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id: <454B124F1FC5659C9A0D323DE8BD639C>
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:runReportResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://axis2.ws.jasperserver.jaspersoft.com"><runReportReturn
xsi:type="xsd:string"><?xml version="1.0"
encoding="UTF-8"?>
<operationResult version="2.0.1">
.<returnCode><![CDATA[0]]></returnCode>
</operationResult>
</runReportReturn></ns1:runReportResponse></soapenv:Body></soapenv:Envelope>
------=_Part_12_32920944.1242418155865
Content-Type: image/png
Content-Transfer-Encoding: binary
Content-Id: <img_0_0_0>
.PNG
[...SNIP...]
Thanks,
Daryl.
14 years, 4 months
help with mlb.com wsdl's again
by Matthew
Hi guys,
Looks like mlb.com's wsdl's are a little iffy once again. Last time it was their MediaService.wsdl. This time I'd like to use their IdentityPointService.wsdl to perform authentication.
The wsdl in question is here:
http://www.mlb.com/flash/mediaplayer/v4/wsdl/IdentityPointService.wsdl
and it's xsd here:
http://www.mlb.com/flash/mediaplayer/v4/wsdl/IdentityPointService.xsd
Here's the code I'm trying:
import sys
import logging
logging.basicConfig(level=logging.INFO)
import suds
from suds.client import Client
from suds.xsd.sxbasic import Import
logging.getLogger('suds.client').setLevel(logging.DEBUG)
url = 'file:///home/matthew/mlb-2009/sudsy/IdentityPointService.wsdl'
client = Client(url)
And the error I get:
>>> client = Client(url)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "build/bdist.linux-i686/egg/suds/client.py", line 109, in __init__
File "build/bdist.linux-i686/egg/suds/servicedefinition.py", line 52, in __init__
File "build/bdist.linux-i686/egg/suds/servicedefinition.py", line 132, in paramtypes
File "build/bdist.linux-i686/egg/suds/xsd/sxbasic.py", line 156, in resolve
suds.TypeNotFound: Type not found: '(identityPoint, http://services.bamnetworks.com/registration/types/1.4, )'
I don't have any control over their WSDL/XSD so if you guys can tell me what lines need to change, I will use local copies of these files using file:// url's to make requests.
Thanks,
Matthew
14 years, 4 months
list (apparently) being sent as '[]' instead of []
by Tom von Schwerdtner
Greetings folks, I'm trying to figure out whose fault this is and
would appreciate some input.
In short, I have a service call that takes a FilterRules type as an
argument (pulled from the client factory), which is configured as
follows:
>>> print filter
(FilterRules){
marketClassIds[] = <empty>
vehicleTypes[] = <empty>
}
The spec for this service says that marketClassIds should be an array
of integers, however when I assign it to an array as follows:
>>> filter.marketClassIds = [1, 2]
>>> print filter
(FilterRules){
marketClassIds[] =
1,
2,
vehicleTypes[] = <empty>
}
and I submit it, I get the following error:
suds.WebFault: Server raised fault: 'JAXRPC.TIE.01: caught exception
while handling request: deserialization error:
java.lang.NumberFormatException: For input string: "[1, 2]"'
FWIW, I have seen (but not executed, yet) PHP code for the service
that simply assigns an empty array to marketClassIds, doing so with
python results in a similar input string error.
So it seems the server is interpreting the marketClassIds as the
__str__ of the array, and not as an actual array. If I set
marketClassIds to a non-array integer, eg:
filter.marketClassIds = 1
It works.
So, my question is, am I doing something wrong, is suds doing
something wrong, or is the server I'm hitting doing something wrong?
Any tips on further debugging this? I'd love to provide working
samples but unfortunately this is a proprietary service.
I can give more information if needed, I'm not too familiar with SOAP
so I wasn't sure what to provide.
Regards,
Tom
14 years, 4 months