4 Replies Latest reply on Jan 14, 2008 5:09 AM by paoletto

    WS-Attachment on jbossws

    paoletto

      Hi

      I followed the wiki user guide to add attachments in my ws invocations/replies
      using the DataHandler and binding type DOCUMENT.

      my question is: does this mean i'm using WS-Attachment kind of attachments?
      or im just defining documents containing base64binary elements?

      this because ActiveBPEL engine (an open source BPM engine) supports WS-Attachments and does not seem to use the same way Jbossws suggest to handle them..

      thanks for any clarification

        • 1. Re: WS-Attachment on jbossws
          asoldano

          With JBossWS you can use either MTOM or SOAP Attachments (SwA), WS-Attachments (DIME) is not supported.

          • 2. Re: WS-Attachment on jbossws
            paoletto

            thanks for clarification.. i had a look on jbossws 2.0.1 examples now, but there is something i dont yet understand:

            actually what i would expect is to have some api to "attach" a DataHandler to a web service invocation.

            for example, im trying to invoke a web service exposed by ActiveBPEL engine which takes an array of strings.

            ActiveBPEL engine provides a set of methods to get attachments from an incoming invocation, but as far as i understood, these attachments dont have to be declared among invocation parameters.

            So what i would expect is a way to attach a payload (attachment) to my invocation without the need of having declared it somewhere..

            is this possible with jbossws?

            • 3. Re: WS-Attachment on jbossws
              paoletto

              Actually i checked the examples provided by ActiveBPEL and in their data type or message type definitions they dont add anything.
              Instead, while testing with SoapUI, they enable and then add attachments on the fly.

              So i wonder how to add an attachment to an web service invocation from the jbossws generated stub.. :?

              thanks for any explaination

              • 4. Re: WS-Attachment on jbossws
                paoletto

                googled further, and found this on axis2 documentation:

                /* Sample client which sends a message with SwA type attachments */
                
                 public void uploadFileUsingSwA(String fileName) throws Exception {
                
                 Options options = new Options();
                 options.setTo(targetEPR);
                 options.setProperty(Constants.Configuration.ENABLE_SWA, Constants.VALUE_TRUE);
                 options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
                 options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
                 options.setTo(targetEPR);
                
                 ServiceClient sender = new ServiceClient(null,null);
                 sender.setOptions(options);
                 OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);
                
                 MessageContext mc = new MessageContext();
                 mc.setEnvelope(createEnvelope());
                 FileDataSource fileDataSource = new FileDataSource("test-resources/mtom/test.jpg");
                 DataHandler dataHandler = new DataHandler(fileDataSource);
                 mc.addAttachment("FirstAttachment",dataHandler);
                
                 mepClient.addMessageContext(mc);
                 mepClient.execute(true);
                 }
                


                isnt it possible to do the same with jbossws?