You can develop Web services clients based on the Web Services for Java 2 Platform, Enterprise Edition (J2EE) specification and the supported Web services development programming models.
Web services for J2EE clients are defined by Java Specification Requirements (JSR) 109 and are known as managed clients because they run in a J2EE container. These clients are packaged as enterprise archive (EAR) files and contain components that act as service requesters. These components can be a J2EE client application, a Web component such as a servlet or JavaServer Pages (JSP), or a session Enterprise JavaBeans (EJB). Web services managed clients use JSR 109 APIs and deployment information to look up and invoke a Web service.
For the managed clients, the service lookup is through Java Naming and Directory Interface (JNDI) lookup. Read about setting up UserName token Web services security, digital signature Web services security and Lightweight Third-Party Authentication (LTPA) token Web services security. The following is an example of a context lookup that is JSR 109 compliant:
InitialContext ctx = new InitialContext(); FredsBankServiceLocator locator =(FredsBankService)ctx.lookup("java:comp/env/service/FredsBankService"); FredsBank fb = locator.getFredsBank(url); long balance = fb.getBalance();
When you are instantiating a context lookup for a managed client, do not use new() for the service locator. Here is an example that is not JSR 109 compliant (new ServiceLocator):
Properties prop = new Properties(); InitialContext ctx = new InitialContext(prop); FredsBankServiceLocator locator = new FredsBankServiceLocator(); FredsBank fb = locator.getFredsBank(url); long balance = fb.getBalance();
Without the lookup() call, the client has no access to the deployment descriptor. The Web services security configuration is in the Web services deployment descriptor.
J2SE clients that use the JAX-RPC run time to invoke Web services and do not run in any J2EE container are known as unmanaged clients. A Web services unmanaged client is a stand-alone Java client that can directly inspect a WSDL file and formulate the calls to the Web service by using the JAX-RPC APIs directly. These clients are packaged as JAR files which do not contain any deployment information.
For a Java application to act as a Web service client, a mapping between the Web Services Description Language (WSDL) file and the Java application must exist. The mapping is defined by the Java API for XML-based RPC (JAX-RPC) specification. You can use a Java component to implement a Web service by specifying the component interface and binding information in the WSDL file and designing the application server infrastructure to accept the service request. This entire process is based on the Web Services for J2EE specification. The JAX-RPC specification defines the mapping between a WSDL file, Java code and XML Schema types.
After you develop a Web services application client, and the client is statically bound, the service endpoint used by the implementation is the one that is identified in the WSDL file that you used during the development process. During or after installation of the Web services application, you might want to change the service endpoint. You can change the endpoint with the administrative console or the wsadmin scripting tool.
In this information ...Subtopics
Related tasks
Related reference
| IBM Redbooks, demos, education, and more |