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

  • Client WS attachment with JAXB2 and Spring WS

    Hi,

    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 = "http://energieprestatiecertificaat.vea.vlaanderen.be")
    @XmlMimeType("application/octet-stream")
    protected DataHandler pdf;
    }

    my spring config:
    <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMe ssageFactory" />

    <bean id="veaMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
    <property name="mtomEnabled" value="false" />
    <property name="classesToBeBound">
    <list>
    [...]
    <value>be.fednot.epc.repository.ws.client.vea.mode l.response.Doc</value>
    </list>
    </property>
    </bean>

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

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

    I have also tried to enable MTOM but I get the following error:
    org.springframework.ws.soap.client.SoapFaultClient Exception: Error reading XMLStreamReader.

    Anyone could help please?

    Bruno
Working...
X