-
Jul 12th, 2012, 11:13 PM
#1
Spring-WS with attachment
Hi,
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="<0.09BC7F4BE2E4D3EF1B@apache.org>";
start-info="text/xml; charset=utf-8"
--MIMEBoundary4A7AE55984E7438034
content-type: application/xop+xml; charset=utf-8; type="application/soap+xml;"
content-transfer-encoding: binary
content-id: <0.09BC7F4BE2E4D3EF1B@apache.org>
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="...."....>
........
<xop:Include href="cid:1.A91D6D2E3D7AC4D580@apache.org"
xmlns:xop="http://www.w3.org/2004/08/xop/include">
</xop:Include>
........
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]"
"[\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:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="file" type="xs:base64Binary"
xmime:expectedContentTypes="application/octet-stream"/>
</xs:sequence>
</xs:complexType>
My client config:
<bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoap MessageFactory">
<property name="soapVersion">
<util:constant static-field="org.springframework.ws.soap.SoapVersion.SOA P_12" />
</property>
<property name="attachmentCaching" value="true" />
</bean>
<bean id="serviceMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
<property name="contextPath" value="epost.mojito.wsc.wsdl" />
<property name="mtomEnabled" value="true" />
</bean>
<bean id="clientTemplate" class="org.springframework.ws.client.core.WebServi ceTemplate">
<constructor-arg ref="messageFactory" />
<property name="marshaller" ref="serviceMarshaller"></property>
<property name="unmarshaller" ref="serviceMarshaller"></property>
<property name="messageSender">
<bean class="org.springframework.ws.transport.http.Commo nsHttpMessageSender">
</bean>
</property>
<property name="defaultUri" value="http://localhost:8082/mojito-ws/" />
</bean>
I'm not sure what else am I missing?
Thanks in advance.
Last edited by bdo; Jul 12th, 2012 at 11:29 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules