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

  • Spring-WS with attachment


    I have a spring ws client and would like to be able to attach and attachment to the request and submit it to an spring ws server. I would like the request to include the file as an Mime attachment. I think the request should look something like this:

    Content-Type: multipart/related; boundary=MIMEBoundary4A7AE55984E7438034;
    type="application/xop+xml"; start="<[email protected]>";
    start-info="text/xml; charset=utf-8"

    content-type: application/xop+xml; charset=utf-8; type="application/soap+xml;"
    content-transfer-encoding: binary
    content-id: <[email protected]>

    <?xml version='1.0' encoding='utf-8'?>
    <soapenv:Envelope xmlns:soapenv="...."....>
    <xop:Include href="cid:[email protected]"

    But right now it looks like:

    "Accept-Encoding: gzip[\r][\n]"
    "Accept: application/soap+xml[\r][\n]"
    "Content-Type: application/soap+xml; charset=UTF-8; action=""[\r][\n]"
    "User-Agent: Jakarta Commons-HttpClient/3.0.1[\r][\n]"
    "Host: localhost:8082[\r][\n]"
    "Content-Length: 11842817[\r][\n]"
    "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:s

    and the attachment is inline.

    Here's is my xsd:

    <xs:complexType name="Attachment">
    <xs:element name="name" type="xs:string" />
    <xs:element name="file" type="xs:base64Binary"

    My client config:

    <bean id="messageFactory" class=" MessageFactory">
    <property name="soapVersion">
    <util:constant static-field=" P_12" />
    <property name="attachmentCaching" value="true" />

    <bean id="serviceMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
    <property name="contextPath" value="epost.mojito.wsc.wsdl" />
    <property name="mtomEnabled" value="true" />

    <bean id="clientTemplate" class=" ceTemplate">
    <constructor-arg ref="messageFactory" />
    <property name="marshaller" ref="serviceMarshaller"></property>
    <property name="unmarshaller" ref="serviceMarshaller"></property>
    <property name="messageSender">
    <bean class=" nsHttpMessageSender">
    <property name="defaultUri" value="http://localhost:8082/mojito-ws/" />

    I'm not sure what else am I missing?

    Thanks in advance.
    Last edited by bdo; Jul 12th, 2012, 11:29 PM.