2

I'm using Python suds to consume SOAP services and the logic behind those calls are written in Java. It seems like one of the arguments require a DataHandler object to be passed through. Is there any way I can either create a DataHandler Java object within Python (ie. by using a library) or is there an equivalent of a DataHandler class within Python?

Some background:

In the WSDL I've been using, the specific line defining the type of input states:

<xs:element name="filedata" xmime:expectedContentTypes="application/octet-stream" type="xs:base64Binary" minOccurs="0"/>

I thought that I needed to do was follow this requirement, so I've tried creating a binary base64 object like so:

openedfile = open(sourcepath, 'r')
fileData = base64.b64encode(openedfile.read())

But when I call the method through suds, I receive this error:

suds.WebFault: Server raised fault: 'javax.activation.DataHandler cannot be cast to org.jvnet.staxex.StreamingDataHandler'

because my input is not a DataHandler (specifically StreamingDataHandler) object.

with
  • 91
  • 1
  • 3

0 Answers0