I have a webservice which expects a document in this format:
<xs:complexType name="document">
<xs:sequence>
<xs:element minOccurs="0" name="inhalt" ns1:expectedContentTypes="application/octet-stream" type="xs:base64Binary"/>
</xs:sequence>
</xs:complexType>
Eclipse asks for a DataHandler, so I tried passing a PDF file like so:
DataSource dataSource = new ByteArrayDataSource(myDoc.getDocument(), "application/pdf");
DataHandler dataHandler = new DataHandler(dataSource, "application/octet-stream");
However, the webservice throws a persistence exception, signaling it can't work with the file I gave it. How else should I build the dataHandler?
(P.S. the sequence above contains 2 more String elements, which I have omitted here because they are not problematic
P.P.S. getDocument() returns byte[])
It worked by leaving out the type for the dataHandler: