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%27,username=...')
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%22%3Esoapenv:Body<ns1:runReportResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://axis2.ws.jasperserver.jaspersoft.com%22%3E<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.
Hey Daryl,
Currently, I don't thinks suds handles multipart but I need to look into how urllib2 behaves to be sure. I'll get back with you.
Regards,
Jeff
Daryl Daly wrote:
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%27,username=...')
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%22%3Esoapenv:Body<ns1:runReportResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://axis2.ws.jasperserver.jaspersoft.com%22%3E<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.
fedora-suds-list mailing list fedora-suds-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-suds-list