Version 21

    A step by step Soap with Attachment (SwA) example

     

    In this example you will learn how to implement a SEI web service with only one operation.

    This operation receives an attached text file and returns another attached text file.

     

    Generally, document/literal web service is the style/use of choice. However, only future release of JBossWS will provide it for attachment along with the WS-I Attachment Profile 1.0 compliance. Here we will define a rpc/literal web service that JBossWS is supporting today. Note that using the Sun's JWSDP1.5 JAX-RPC & SAAJ implementation will throw an exception as literal attachment is not supported yet.

     

    Today, with the lack of tools, the process is not very friendly. JBoss team will fill the gap soon, but if you need to do it right now, you should find enough information in this page.

     

    For the impatients

    Steps are:

    • install the Sun's JWSDP

    • write the service implementation + interface

    • write webservice.xml + web.xml

    • write config.xml + generate a wsdl with the jwsdp

    • modify the wsdl

    • generate the jaxrpc-mapping.xml

    • package & deploy your service

    • write and run your client

     

    You will need to provide jars from the Sun's JWSDP 1.5 and JBossAS see Set up your environment.

     

     

    For the others

     

    Running the Example

    This example is part of the JBoss AS testsuite (_jboss-4.0_home_/testsuite/src/main/org/jboss/test/webservice/attachmentstepbystep).

    From the client you will see

         [java] **************************************
         [java] This is a text file attachment
         [java] **************************************
         [java] FROM SERVER  FROM SERVER  FROM SERVER
         [java] **************************************
    BUILD SUCCESSFUL

     

    From the server console you will see

         INFO  [STDOUT] **************************************
         INFO  [STDOUT]     This is a text file attachment
         INFO  [STDOUT] **************************************
         INFO  [STDOUT] FROM CLIENT  FROM CLIENT  FROM CLIENT
         INFO  [STDOUT] **************************************