3 Replies Latest reply on Dec 15, 2013 12:42 PM by Nihar Pattanaik

    SOAP Attachment is getting dropped from the outbound message

    Nihar Pattanaik Newbie

      Hi,

       

      I'm consuming a third party web service where they expect attachment over SOAP as un-referenced types (wsdl does not define the multipart information). I'm using JAX-WS SOAPHandler implementation to attach a file to an outbound message.Along with file i'm also setting the content id (cid) to identify the attachment at the service. The code works fine, sends the attachment to the service when i run from my eclipse as a standalone program. However the same does not work when i run the code in JBoss. I have debugged and seen the file is getting attached to the SOAP message, however the same is getting dropped over the transport layer. I suspect the issue may be with JBOSS JAX-WS CXF bridge and i may need to take care of something else. Could someone please help.

       

      My Attachment Sample Code

      ---------------------------------------------------------------------------------------------------

      private void attachPayload(File file, SOAPMessage message) {

            DataSource dataSource = new FileDataSource(file);

            DataHandler handler = new DataHandler(dataSource);

            AttachmentPart attachPart = message.createAttachmentPart(handler);

            attachPart.setContentId(file.getName());

            message.addAttachmentPart(attachPart); 

      }

      ---------------------------------------------------------------------------------------------


      SOAP message dump, which shows attachment is not available in the message.


      --------------------------------------------------------------------

      03:57:34,621 INFO  [org.apache.cxf.interceptor.LoggingOutInterceptor] (http--0.0.0.0-8070-1) Outbound Message

      ---------------------------

      ID: 3

      Address: http://9.9.1.108:50053/services/SEP.SEPHttpSoap11Endpoint

      Encoding: UTF-8

      Content-Type: text/xml

      Headers: {Accept=[*/*], SOAPAction=["urn:loadRefDataRequestType_Insert"]}

      Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns3:loadRefDataRequestType_InsertRequest xmlns="GX" xmlns:ns2="http://tresoap.intecbilling.com/fault/2.0" xmlns:ns3="http://tresoap.intecbilling.com/2.0/SEP"><ON_BEHALF_OF>100000000000005</ON_BEHALF_OF><EXTERNAL_CUSTOMER_ID>100000000000005</EXTERNAL_CUSTOMER_ID><SOURCE_FILES_LIST><SRC_FILE><SOURCE_FILE>RT_cam.MARKET.csv</SOURCE_FILE><ATTACHMENT href="cid:RT_cam.MARKET.csv"><ATTACHED>true</ATTACHED></ATTACHMENT><SOURCE_NAME>cam.MARKET</SOURCE_NAME><SOURCE_TYPE>RT</SOURCE_TYPE></SRC_FILE></SOURCE_FILES_LIST></ns3:loadRefDataRequestType_InsertRequest></soap:Body></soap:Envelope>

      ---------------------------------------------------------------------------------------------------------------------------------

      -

      Regards,

      Nihar