Hi,
searched the web for hours, but didn't find a solution
We use:
- spring 3.0.5
- spring ws 2.0
- jaxb
- saaj
- java 1.6
- tomcat 6.0.29
- soapUI
We want to add a xml file to the ws-response (or a zip file containing the xml File) but content seams to be inline.
config:
XSD:Code:<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory" /> <util:list id="xsds"> <value>WEB-INF/xsd/info.xsd</value> ... </util:list> <bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="contextPath" value="xx.xx.ws.domain" /> <property name="schemas" ref="xsds"/> <property name="mtomEnabled" value="true"/> </bean> <bean id="marshallingPayloadMethodProcessor" class="org.springframework.ws.server.endpoint.adapter.method.MarshallingPayloadMethodProcessor"> <constructor-arg ref="jaxbMarshaller"/> </bean> <bean id="defaultMethodEndpointAdapter" class="org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter"> <property name="methodArgumentResolvers"> <list> <ref bean="marshallingPayloadMethodProcessor"/> </list> </property> <property name="methodReturnValueHandlers"> <list> <ref bean="marshallingPayloadMethodProcessor"/> </list> </property> </bean>
--> generated objects and factory by xjcCode:<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://pms.dataconnect.ch/ws/schema/info" xmlns:tns="http://pms.dataconnect.ch/ws/schema/info" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" elementFormDefault="qualified"> <element name="InfoResponse"> <complexType> <sequence> <element name="Info" minOccurs="0" maxOccurs="unbounded" > <complexType> <sequence> ... <element name="File" type="base64Binary" xmime:expectedContentTypes="application/octet-stream"/> </sequence> </complexType> </element> </sequence> </complexType> </element> </schema>
Endpoint:
Response seen in soapUI: Attachments: (0), but inline:Code:@Endpoint public class InfoEndpoint { ... @PayloadRoot(localPart = REQUEST_LOCAL_NAME, namespace = NAMESPACE_URI) @ResponsePayload public InfoResponse getInfo(@RequestPayload InfoRequest rafInfoRequest) throws Exception { ObjectFactory factory = new ObjectFactory(); InfoResponse response = factory.createInfoResponse(); ... Info info = factory.createInfoResponseRAFInfo(); File f = zip(clob); DataSource source = new FileDataSource(f); DataHandler handler = new DataHandler(source); info.setFile(handler); ...
Tried to debug:Code:.... <ns2:Info> ... <ns2:File>UEsDBBQACAAIAExi4AAAAAAAAAHAAAAc ... </ns2:RAF> </ns2:Info> </ns2:InfoResponse>
- marshall in org.springframework.oxm.jaxb.Jaxb2Marshaller is never called (why?)
- Jaxb2AttachmentMarshaller in Jaxb2Marshaller is never called
- AbstractJaxb2PayloadMethodProcessor.marshalToRespo nsePayload is called
What am I doing wrong or what is missing, that the file is attached?
Or:
is ist possible to add a attachment at the endpoint manually as attachment without "xsd" and jaxb?
Any help appreciated!
Thanks in advance!
mala



Reply With Quote

