Announcement Announcement Module
No announcement yet.
Spring web service client to get a document from a service as attachment over JMS Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring web service client to get a document from a service as attachment over JMS

    I am using Springs WebServiceTemplate class to invoke a Tibco Web service over JMS to get a document as an attachment. The springs configuration is :

    <bean id="downloadDOCservice"
    class="downloaddocument.service.DownloadDocumentSe rviceImpl"
    <property name="wstemplate" ref="webServiceTemplateWithoutMS" />
    <property name="soapActionGetDocument"
    value="/ApplicationComponents/BusinessServices/DocumentService/DocumentService.serviceagent/PortTypeEndpoint1/getDocument" />
    <property name="url"
    value="jms:XX.XXX.Documents1?messageType=BINARY_ME SSAGE" />

    <bean id="webServiceTemplateWithoutMS" class=" ceTemplate">
    <constructor-arg ref="messageFactory" />
    <property name="messageSender" ref="messageSender" />
    <property name="marshaller" ref="marshaller" />
    <property name="unmarshaller" ref="marshaller" />
    <property name="faultMessageResolver" ref="faultMessageResolver" />

    <bean id="messageFactory" class=" ssageFactory" />

    Java code is


    wstemplate.sendAndReceive(new WebServiceMessageCallback() {

    public void doWithMessage(WebServiceMessage message)
    throws IOException, TransformerException {

    MarshallingUtils.marshal(wstemplate.getMarshaller( ),
    request, message);

    SoapMessage soapMessage = (SoapMessage) message;
    }, new WebServiceMessageExtractor() {

    public Object extractData(WebServiceMessage response) {
    System.out.println("extractDataMethod invoked");
    return response;

    When I invoke the web service, I get an error and the callback method extractData() does not get invoked.The client is deployed on Tomcat, JDK 1.6 as part of a Web Application.

    Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
    at tSAXParser.parse(
    at mpl$JAXPSAXParser.parse(
    at org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
    at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(

    I have put xerces and xalan libraries in the endorsed directory but the error is the same.
    The response returned by the Service as intercepted by tcpmon is:

    Content-transfer-encoding: binary
    Content-type: text/xml; charset=utf-8
    Content-id: <TIBCO_START_PART>

    <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV=""><SOAP-ENV:Body><ns0:ResponseGetDocument xmlns:ns0=""><ns0:status>1</ns0:status><ns0:documentName>aaa.pdf</ns0:documentName></ns0:ResponseGetDocument></SOAP-ENV:Body></SOAP-ENV:Envelope>
    Content-transfer-encoding: binary
    Content-type: application/pdf