On 21.09.2012 15:33, Glen Mazza wrote:
On 09/21/2012 08:08 AM, Marcel Stör wrote:
The bad news:
d) Since we run wsdl2java in each an every Maven build a) isn't an
option anyway.


wsdl2java should be able to generate DataHandlers within method
signatures, my MTOM/Apache FOP tutorial[1] will generate the following
service endpoint interface for uploading/downloading PDFs:

Yes, that's because you use xmime:expectedContentTypes="application/octet-stream" in the WSDL/XSD.

In addition to my image attachment I also have a CSV attachment type with a text/csv MIME type. For this class the content attribute is a DataHandler.

<xs:complexType name="csvAttachment">
  <xs:complexContent>
    <xs:extension base="me:attachment">
      <xs:sequence>
<xs:element name="content" type="xs:base64Binary" xmime:expectedContentTypes="text/csv"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>
<xs:complexType name="imageAttachment">
  <xs:complexContent>
    <xs:extension base="me:attachment">
      <xs:sequence>
<xs:element name="content" type="xs:base64Binary" xmime:expectedContentTypes="image/jpeg, image/png, image/gif"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

public class CsvAttachment extends Attachment {
  @XmlElement(required = true)
  @XmlMimeType("text/csv")
  protected DataHandler content;

public class ImageAttachment extends Attachment {
  @XmlElement(required = true)
  @XmlMimeType("image/*")
  protected Image content;

Cheers,
Marcel

Reply via email to