JAX-WS Dynamic Proxy Client Example (original) (raw)

1. Introduction

Java API for XML Web Services (JAX-WS) is a Java programming language for creating web services, particularly SOAP services.

JAX-WS wsimport generates java stubs and binds the web service during the compile time. The generated client code binds to the WSDL at a specific service implementation. Clients need to regenerate the stubs when WSDL is updated.

JAX-WS provides libraries to construct services during run-time and invoke service’s operations via Dispatch interface. Dynamic web service clients don’t need to change when WSDL is updated.

In this example, I will demonstrate how to build a dynamic proxy web service client.

2. JAX-WS Server Application

Create a JAX-WS server application in three steps:

Refer to my other article for step-by-step instructions.

This step will starts a server with two services: http://localhost:9980/bookSerer.wsdl and http://localhost:9990/mathSerer.wsdl.

http://localhost:9980/bookSerer.wsdl file content.

bookServer.wsdl