[Lab-Analysis] Deploying a Bottum-up SOAP Web Service in Glassfish Server from Eclipse

We will quickly review the results of the lab @ http://javajee.com/lab-deploying-a-simple-soap-web-service-in-glassfish-....


The Web Service

We had deployed the below simple web service in Glassfish server using eclipse and all it took was to use an annotation @WebService to make it a web service. 

package com.javajee.webservices.soap;

import javax.jws.WebService;

public class MyWebService {

    public String myServiceMethod() {

      return "From myServiceMethod";


We did not had to do any other configurations because Java EE 5 and above compliant application servers such as Glassfish, comply to JSR 109 (Web services 1.2/1.3) and JSR 224 (JAX-WS 2.0/2.1/2.2). However, to deploy web service on a web container like tomcat, you will need to do some additional steps, which we will see later.

Also, traditionally we used to create an interface called Service Endpoint Interface (SEI) and an implementation class called Service Implementation Bean (SIB) that implements this interface. However, current standard allows us to create web services using just a POJO with annotations without a separate interface. We will see the SIB with SEI apprach in another example. 


Endpoint and WSDL URLs

Endpoint URL can be considered as an url where you can access your web service.  

Endpoint URL for our service is: http://localhost:8080/WebServiceDemo/MyWebServiceService

Note: 'Service' is appended to the class name MyWebService.


Web Services Description Language (WSDL) describes our web service.

WSDL URL for our service is: http://localhost:8080/WebServiceDemo/MyWebServiceService?wsdl

Note: '?wsdl' is appended to the endpoint URL


Generated WSDL

Generated WSDL will look as below:


Tester Output (SOAP Request and SOAP Response)

The tester will show you the actual SOAP request sent and SOAP response received from the web service.

As you can see, SOAP request and SOAP response are XML messages with some SOAP specific elements. We will see them in more detail later.


Important notes: 

Even if you do multiple requests to the deployed SOAP web service, it will all be handled by the same instance.

Glassfish tester has some limitations and a standard testing tool such as SOAP UI or even the Eclipse Web Service Explorer is preferred. For instance, an exception thrown in your web service is returned back as SOAP fault element. While the response is actually a SOAP message with SOAP fault element, Glassfish will show the complete stack trace instead of the original SOAP response message.

These tools are also handy when you are deploying web services on a server that does not provide an inbuilt tester (for example Apache Tomcat web container). Hence. we will also see SOAP UI and the Eclipse Web Service Explorer.



Don't rely on these screenshots. Do it yourself and see the result yourself.

Don't worry if you have not understood everything we have discussed here; we will be discussing all of these in detail.

See additional excercise section for more problems to try out.

Quick Notes Finder Tags

Activities (1) advanced java (1) agile (3) App Servers (6) archived notes (2) ArrayLists (1) Arrays (2) Best Practices (12) Best Practices (Design) (3) Best Practices (Java) (7) Best Practices (Java EE) (1) BigData (3) Chars & Encodings (6) coding problems (2) Collections (15) contests (3) Core Java (All) (53) course plan (2) Database (12) Design patterns (8) dev tools (3) downloads (2) eclipse (9) Essentials (1) examples (14) Exception (1) Exceptions (4) Exercise (1) exercises (6) Getting Started (18) Groovy (2) hadoop (4) hibernate (77) hibernate interview questions (6) History (1) Hot book (5) http monitoring (2) Inheritance (4) intellij (1) java 8 notes (4) Java 9 (1) Java Concepts (7) Java Core (8) java ee exercises (1) java ee interview questions (2) Java Elements (16) Java Environment (1) Java Features (4) java interview points (4) java interview questions (4) javajee initiatives (1) javajee thoughts (3) Java Performance (6) Java Programmer 1 (12) Java Programmer 2 (8) Javascript Frameworks (1) Java SE Professional (1) JPA 1 - Module (6) JPA 1 - Modules (1) JSP (1) Legacy Java (1) linked list (3) maven (1) Multithreading (16) NFR (1) No SQL (1) Object Oriented (9) OCPJP (4) OCPWCD (1) OOAD (3) Operators (4) Overloading (2) Overriding (2) Overviews (1) policies (1) programming (1) Quartz Scheduler (1) Quizzes (17) RabbitMQ (1) references (2) resources (1) restful web service (3) Searching (1) security (10) Servlets (8) Servlets and JSP (31) Site Usage Guidelines (1) Sorting (1) source code management (1) spring (4) spring boot (3) Spring Examples (1) Spring Features (1) spring jpa (1) Stack (1) Streams & IO (3) Strings (11) SW Developer Tools (2) testing (1) troubleshooting (1) user interface (1) vxml (8) web services (1) Web Technologies (1) Web Technology Books (1) youtube (1)