Announcement Announcement Module
No announcement yet.
Client WS attachment with JAXB2 and Spring WS Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Client WS attachment with JAXB2 and Spring WS


    I am writing a client to consume a server web service having an attachment. I am using Spring WS and JAXB2. The problem is that the JAXB2 generated class gets always an empty DataHandler as result from the server. The attachment doesn't get bound apparently while other "simple" values are well bound.
    Here's my config:

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

    my jaxb2 generated java object:
    class Doc {
    @XmlElement(name = "pdf", namespace = "")
    protected DataHandler pdf;

    my spring config:
    <bean id="messageFactory" class=" ssageFactory" />

    <bean id="veaMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
    <property name="mtomEnabled" value="false" />
    <property name="classesToBeBound">
    <value> l.response.Doc</value>

    <bean id="veaDetailWsClient" class="be.fednot.epc.repository.VeaDetailWsClient" >
    <property name="webServiceTemplate">
    <bean class=" ceTemplate">
    <constructor-arg ref="messageFactory" />
    <property name="defaultUri" value="${ws-client.vea.detail.uri}" />
    <property name="marshaller" ref="veaMarshaller" />
    <property name="unmarshaller" ref="veaMarshaller" />

    my client WS
    public GeefEnergiePrestatieCertificaatDetailResponse geefEnergiePrestatieCertificaatDetailMtom(
    final GeefEnergiePrestatieCertificaatDetail requestPayload) {
    return (GeefEnergiePrestatieCertificaatDetailResponse) this.webServiceTemplate

    I have also tried to enable MTOM but I get the following error: Exception: Error reading XMLStreamReader.

    Anyone could help please?