5 Replies Latest reply on Dec 5, 2005 10:36 AM by Anil Saldanha

    A web service which returns data + SOAP attachment

    Gennadi Pais Newbie

      Did somebody succeed to create a web service that returns SOAP message with some data and binary attachment from one of its methods using JWSDP?

      I tried to use all the approaches I found in Internet, but none of them works properly. WSI AP 1.0 defines two separate schemes to specify attachments: one based on the WSDL MIME binding, and the other using the WS-I defined swaRef type.

      When using multiple MIME bindings the JWSDP interprets the output parameters as input parameter holders that leads to the ?wrong number of arguments? runtime exception in JBoss.

      swaRef works better (at least the web service implementation returns a well formatted multipart response) but I didn?t succeed to send a swaRef parameter as a part of complex type, thus I didn?t succeed to provide an additional information I need to return from the web service method. Also JWSDP client stubs don?t deserialize the response correctly and complained about the missing attachment. It looks like the problem is that JWSDP assumes that swaRef parameter value and ?content-id? of the attachment are equal to the part name as well as it?s defined in the WSDL file.

      All the tests I performed using JWSDP 1.6 and JBoss 4.0.3SP1.

      If somebody created a web service that returns SOAP message with some data and binary attachment from one of its methods using JWSDP please could you post your solution?

        • 1. Re: A web service which returns data + SOAP attachment
          John Reynolds Newbie

          The issues regarding file trasfer are numerous and painful.
          Microsoft promoted DIME, knowing that it probably woudn't fly.
          Sun Promoted Mime attachments and has gone with the SWA.
          Now there seems to be a push towards MTOM, which I hope will be picked up by the JBOSS implementation shortly, as we are also needing it.

          The interesting thing about MTOM, is appears that you just deal will returning byte arrays or native return types. The MTOM functionality appears to get turned on external to the code and will autmatically optimize the soap message, moving portions of the data outside the soap message as an attachments.

          I unfortunately haven't answered the question you asked by wanted to share yet another option. MTOM was released on the Micrsoft side and appears to be on the list for JBoss. I'm on a project that will require its abilities shortly.

          • 2. Re: A web service which returns data + SOAP attachment
            Jason Greene Master

            The current JBoss 4.x stack support SwA (SOAP With attachments). SwA is technically not valid for literal encodings because it adds empty tags with an href attribute (this validates the literal schema). That said, the 4.0 stack will still let you use them with literal types. So if both your client and server components are jboss you should have no problems. Also, I believe Axis allows SwA over literal as well.

            The new stack (should be released soon) has support for AP 1.0, which fixes the literal encoding problem.

            We have MTOM on our roadmap, it will also be added, but after the first release of the new stack.

            I understand your frustrations and unfortunately the disgreements between vendors regarding attachments has delayed the technology, and thus caused headaches for the user.

            The good news is that everyone has agreed on MTOM, its just a matter of everyone adding support for it.

            -Jason

            • 3. Re: A web service which returns data + SOAP attachment
              Gennadi Pais Newbie

              Thanks for replies.

              I did some additional investigation, testing and would like to conclude the issue. It looks like it is impossible to use JWSDP + JBoss 4.0.3 to return to a client a SOAP message with some data and binary attachment.

              If somebody did succeed to do it please correct me. I will be happy to get to know that I?m wrong!

              • 4. Re: A web service which returns data + SOAP attachment
                Gennadi Pais Newbie

                Sorry, I?d like to correct myself.

                My previous post should be more specific: ?It looks like it is impossible to use JAX-RPC + JBoss WS to return to a client a SOAP message with some data and binary attachment.?

                But it is possible to do if the web service is implemented as a servlet that parses request and creates response using SAAJ.

                • 5. Re: A web service which returns data + SOAP attachment
                  Anil Saldanha Master

                  The wsdl that is generated by jwsdp may have to be manually edited to add the mime header settings in the wsdl:bindings.