Samples
Prev |  |

Links: Table of Contents | Single HTML | Single PDF

## Samples

This document explains the samples that are bundled along with Eclipse Implementation of XML Web Services 3.0.0-M3.

The samples included with Eclipse Implementation of XML Web Services that is distributed on GitHub documents how to use Eclipse Implementation of XML Web Services in a non-Jakarta EE servlet container using a proprietary deployment descriptor `sun-jaxws.xml` and servlet `com.sun.xml.ws.transport.http.servlet.WSServlet`. This means that you can these Eclipse Implementation of XML Web Services applications in any servlet container that has been enabled with Eclipse Implementation of XML Web Services. Applications that use the proprietary DD and servlet will run in a Eclipse Implementation of XML Web Services enabled Jakarta EE servlet container, but they will be non-portable. If you wish to use these Eclipse Implementation of XML Web Services samples in a Jakarta EE container in a Jakarta EE portable manner you need to modify them to use the standard Jakarta EE deployment descriptor; please refer to the Jakarta EE or GlassFish documentation/samples.

All these samples are tested to run on GlassFish v5.x and on Apache Tomcat 5.x.

## 1. Directory Structure

This section explains the directory structure of the `samples` directory in the bundle:

Table 29. List of Samples

Sample | Description
--- | ---
`docs` | jax-ws-ri-overview, this file
`asyncservice` | Demonstrates Eclipse Implementation of XML Web Services specific endpoint to achieve server side asynchrony. This sample requires Servlet 3.0 API supported container like GlassFish 5.x.
`wsimport_clientjar` | Demonstrates use of `-clientjar` option of wsimport.
`optional_webxml` | Demonstrates the simplified deployment of web services using Eclipse Implementation of XML Web Services deployment by not requiring the configuration of web.xml.
`fromwsdl-wsaddressing-policy` | Starting from WSDL shows how to develop a WS-Addressing enabled endpoint using standardized Addressing Metadata support.
`fromjava-wsaddressing` | Starting from Java endpoint how to develop W3C WS-Addressing endpoint.
`fromwsdl-wsaddressing` | Starting from WSDL shows how to develop a WS-Addressing endpoint using WS-Addressing WSDL Binding. This sample uses non-standard wsdl extension, also see standards based fromwsdl-wsaddressing-policy sample.
`fromjava` | Demonstrates how to build, deploy, and invoke a simple Web service starting from a Java service endpoint implementation using annotations.
`fromjavahandler` | Same as fromjava sample but with a simple logging handler on the client and server.
`fromwsdl` | Demonstrates how to build, deploy, and invoke a simple Web service starting from a WSDL using external customizations.
`fromwsdl_secure` | Same as fromwsdl sample but demonstrates how to build, deploy, and invoke an HTTPS Web service and client from a WSDL.
`fromwsdlhandler` | Same as fromwsdl sample but with a simple logging handler on the client and server.
`dispatch` | Demonstrates how to dynamically invoke web service endpoints.
`provider` | Demonstrates how to build, deploy, and invoke `jakarta.xml.ws.Provider` based Web service endpoint.
`asyncprovider` | Demonstrates how to build, deploy, and invoke a server side asynchronous `Provider` based Web service endpoint.
`annotations` | Same as fromjava but shows how to specify a different parameter name, operation name, targetNamespace, and other similar features.
`async` | Demonstrates how to generate async operations in a client SEI from a WSDL and invoke it from the client application.
`efficient-handler` | Demonstrates efficient handler using `com.sun.xml.ws.api.handler.MessageHandler`, which is an efficient protocol handler.
`external-customize` | Demonstrates how a client client application can customize a published WSDL using external binding file.
`external-metadata-fromjava` | Demonstrates how to develop web service without using java annotations - metadata are being provided with xml descriptors. This allows to expose as a web service already deployed implementations. This sample uses fromjava (better to say from java binary) approach.
`external-metadata-fromwsdl` | Demonstrates how to develop web service without using java annotations - metadata are being provided with xml descriptors. This allows to expose as a web service already deployed implementations. This sample uses fromwsdl approach.
`inline-customize` | Demonstrates how a client application and server endpoint can be generated from a WSDL with embedded binding declarations.
`mtom` | Demonstrates how to enable MTOM and swaRef.
`mtom-large` | Demonstrates how to transfer large attachments in streaming fashion using MTOM.
`mtom-soap12` | Same as mtom sample but shows how to specify SOAP 1.2 binding.
`fromjava-soap12` | Same as fromjava sample but shows how to specify SOAP 1.2 binding.
`fromwsdl-soap12` | Same as fromwsdl sample but shows how to specify SOAP 1.2 binding.
`supplychain` | Same as fromjava sample but using JavaBeans as parameter and return types. Also the service can be built and deployed using Endpoint API.
`mime` | Demonstrates how a MIME binding is defined in the WSDL to send `wsdl:part` as MIME attachments. This requires that the development model is 'starting from WSDL'.
`mime-large` | Demonstrates how to transfer large attachment in streaming fashion using `wsi:swaref`.
`wsimport_catalog` | Demonstrates a how a WSDL and schema URI's can be resolved using catalog mechanism using wsimport ant tasks' catalog attribute and also using ant's core type `xmlcatalog`.
`catalog` | Shows the catalog capability on the client side; Catalog is used every time the implementation tries to access a resource identified by URI that is believed to contain either a WSDL document or any other document on which it depends .
`restful` | Shows an example of a REST Web Service implemented as a Jakarta XML Web Services `Provider` and accessed via a Jakarta XML Web Services `Dispatch` client. The `Request` uses an HTTP `GET` Request Method and uses the Jakarta XML Web Services `MessageContext` properties `PATH_INFO` and `QUERY_STRING`.
`stateful` | This sample shows the Eclipse Implementation of XML Web Services's stateful webservice support feature.
`schema_validation` | This sample demonstrates Eclipse Implementation of XML Web Services's validation feature that validates the incoming/outgoing messages are as per schema.
`dual-binding` | This sample demonstrates the Eclipse Implementation of XML Web Services's featuer to expose the same service class under `SOAP/HTTP` and `XML/HTTP` binding.
`large_upload` | This sample demonstrates uploading a large file to the server.
`type_substitution` | This sample demonstrates type substitution and sending java types that are not directly referenced by the WSDL.
`xmlbind_datasource` | This sample demonstrates a REST based webservices using `XML/HTTP` binding along with `Provider`/`Dispatch`.

## 2. Prerequisites

Here is the list of prerequisites that needs to be met before any of the samples can be invoked:

1. Download Java SE 8 or later. Set `JAVA_HOME` to the Java SE installation directory.

2. Set `JAXWS_HOME` to the Eclipse Implementation of XML Web Services installation directory.

## 3. Installing Eclipse Implementation of XML Web Services 3.0.0-M3

- Follow the Installation Instructions from Release Notes.

- Make sure that your container is configured for port 8080 as samples are hardcoded with this port info. Otherwise, you need to change samples to use the correct port by replacing '8080" with your port in all the files included in the sample.

## 4. Running the sample

Each sample has a `readme.txt` in its directory that details the instructions specific to the sample. Each sample can be built, deployed and invoked using the `ANT_HOME/bin/ant` and `build.xml` ant script in the root directory of the sample. Each ant script supports the following set of targets:

Target | Description
--- | ---
`server` | Builds and deploy the service endpoint WAR on GlassFish v5.x installation referenced by `$AS_HOME`
`server -Dtomcat=true` | Builds and deploy the service endpoint WAR on Tomcat installation referenced by `$CATALINA_HOME`
`client` | Builds the client
`run` | Runs the client

Some samples (e.g. fromjava, supplychain) can be built, deployed using `jakarta.xml.ws.Endpoint` API. These samples support extra targets:

Target | Description
--- | ---
`server-j2se` | Builds and deploys the `Endpoint` API based service endpoint (doesn't terminate until server-j2se-stop is called)
`server-j2se-stop` | Stops the `Endpoint` API based service endpoint (need to run from a different window)

It is essential for the service endpoint to be deployed on Application Server before clients can be built because clients use the WSDL exposed from the service endpoint deployed in the Application Server. So please make sure that your Application Server is either running before the `server` target is invoked or run it after the `server` target is invoked. You will have to wait a few minutes for the Application Server to deploy the service endpoint correctly before building the client.

We appreciate your feedback, please send it to metro-dev@eclipse.org.

Prev |  |
Extensions | Home |