Tutorial

SOAP Webservices in Java Example using Eclipse

Published on August 3, 2022
author

Pankaj

SOAP Webservices in Java Example using Eclipse

Soap Webservices in java can be developed in may ways. We learned about JAX-WS SOAP Web Services in our last tutorial, today we will learn how we can create SOAP web service and it’s client program using Eclipse. Here we will not use JAX-WS, we will be using Apache Axis that is integrated in the Eclipse and provide quick and easy way to transform a application into Java Web Service and create client stubs with test JSP page for testing purpose.

SOAP Webservices in Java

soap webservices in java, soap web service example, soap webservice example eclipse I am using Eclipse Mars Release (4.5.0) for this tutorial but I think these steps will work with older versions of eclipse too. Also make sure you have added Apache Tomcat or any other servlet container as server in the Eclipse. Let’s start with our Eclipse Web Service implementation now.

SOAP Web Service Example

Let’s get started with our SOAP web service example in Eclipse. First of all we will create a simple Dynamic Web Project in Eclipse that will contain the business logic for our application. soap webservices in java, soap web services example, soap web service example, soap web service eclipse Click on Next button above and you will get next page to provide your web project name and Target Runtime. Notice that I am using Apache Tomcat 8, you can use any other standard servlet container too. soap web service, soap web services in java, soap webservices Click on Next and you will be asked to provide “Context Root” and Content Directory location. You can leave them as default. soap web services in java, soap webservices in java Click on Finish and Eclipse will create the project skeleton for you. Let’s get started with our business logic. So for our example, we would like to publish a web service that can be used to add/delete/get an object. So first step is to create a model bean.

package com.journaldev.jaxws.beans;

import java.io.Serializable;

public class Person implements Serializable{

	private static final long serialVersionUID = -5577579081118070434L;
	
	private String name;
	private int age;
	private int id;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	
	@Override
	public String toString(){
		return id+"::"+name+"::"+age;
	}

}

Notice that above is a simple java bean, we are implementing Serializable interface because we will be transporting it over the network. We have also provided toString method implementation that will be used when we will print this object at client side. Next step is to create service classes, so we will have an interface as PersonService and it’s simple implementation class PersonServiceImpl.

package com.journaldev.jaxws.service;

import com.journaldev.jaxws.beans.Person;

public interface PersonService {

	public boolean addPerson(Person p);
	
	public boolean deletePerson(int id);
	
	public Person getPerson(int id);
	
	public Person[] getAllPersons();
}

Below is the implementation service class, we are using Map to store Person objects as data source. In real world programming, we would like to save these into database tables.

package com.journaldev.jaxws.service;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import com.journaldev.jaxws.beans.Person;

public class PersonServiceImpl implements PersonService {

	private static Map<Integer,Person> persons = new HashMap<Integer,Person>();
	
	@Override
	public boolean addPerson(Person p) {
		if(persons.get(p.getId()) != null) return false;
		persons.put(p.getId(), p);
		return true;
	}

	@Override
	public boolean deletePerson(int id) {
		if(persons.get(id) == null) return false;
		persons.remove(id);
		return true;
	}

	@Override
	public Person getPerson(int id) {
		return persons.get(id);
	}

	@Override
	public Person[] getAllPersons() {
		Set<Integer> ids = persons.keySet();
		Person[] p = new Person[ids.size()];
		int i=0;
		for(Integer id : ids){
			p[i] = persons.get(id);
			i++;
		}
		return p;
	}

}

That’s it for our business logic, since we will use these in a web service, there is no point of creating web pages here. Notice that we have no reference to any kind of web services classes in above code.

SOAP Webservices in Java using Eclipse

Once our business logic is ready, next step is to use Eclipse to create a web service application from this. Create a new project and select Web Service wizard. Eclipse soap webservices, soap web service eclipse example Click Next button and you will get a page where web service and it’s client details have to be provided. This is the most important page in creating web service. Make sure you select “Web Service type” as “Bottom up Java bean Web Service” because we are implementing with bottom up approach. There are two ways to create web service:

  1. Contract last or Bottom up approach: In this approach we first create the implementation and then generate the WSDL file from it. Our implementation fits in this category.
  2. Contract first or Top Down Approach: In this approach, we first create the web service contract i.e. WSDL file and then create the implementation for it.

soap web service example, soap webservices in java In the service implementation, provide the implementation class PersonServiceImpl fully classified path. Make sure you move the slider in service and client type to left side so that it can generate client program and also UI to test our web service. Check for the configurations in web service implementation, you should provide correct details for Server runtime, Web service runtime and service project. Usually they are auto populated and you don’t need to make any changes here. For client configurations, you can provide the client project name as you like. I have left it to default as SOAPExampleClient. If you will click on the link for web service runtime, you will get different options as shown in below image. However I have left it as the default one. soap web service, soap web service example Click on Next button and then you will be able to choose the methods that you want to expose as web service. You will also be able to choose the web service style as either document or literal. You can change the WSDL document name but it’s good to have it with implementation class name to avoid confusion later on. soap web service example, soap webservices in java Click on Next button and you will get server startup page, click on the “Start server” button and then next button will enable. soap webservice java, soap webservices in java Click on Next button and you will get a page to launch the “Web Services Explorer”. soap web service example, soap webservices in java, wsdl example Click on Launch button and it will open a new window in the browser where you can test your web service before moving ahead with the client application part. It looks like below image for our project. soap web service example, soap webservices in java We can do some sanity testing here, but for our simple application I am ready to go ahead with client application creation. Click on the Next button in the Eclipse web services popup window and you will get a page for source folder for client application. soap web service example, soap webservices in java, soap web service client Click on Next button and you will get different options to choose as test facility. I am going ahead with JAX-RPC JSPs so that client application will generate a JSP page that we can use. soap webservices, soap webservices in java Notice the methods getEndpoint() and setEndpoint(String) added that we can use to get the web service endpoint URL and we can set it to some other URL in case we move our server to some other URL endpoint. Click on Finish button and Eclipse will create the client project in your workspace, it will also launch client test JSP page as shown below. soap webservices client, soap web service example, soap webservices in java You can copy the URL and open in any browser you would like. Let’s test some of the services that we have exposed and see the output.

Eclipse SOAP Web Service Test

  • addPerson soap webservice example

  • getPerson soap web service example, soap webservices in java

  • getAllPersons soap web service example, soap webservices in java Notice that Person details are not printed in the results section, this is because it’s auto generated code and we need to refactor it a little to get the desired output. Open Result.jsp in the client project and you will see it’s using switch case to generate the result output. For getAllPersons() method, it was case 42 in my case. Note that it could be totally different in your case. I just changed the code for case 42 as shown below.

    case 42:
            gotMethod = true;
            com.journaldev.jaxws.beans.Person[] getAllPersons42mtemp = samplePersonServiceImplProxyid.getAllPersons();
    if(getAllPersons42mtemp == null){
    %>
    <%=getAllPersons42mtemp %>
    <%
    }else{
            String tempreturnp43 = null;
            if(getAllPersons42mtemp != null){
            java.util.List<com.journaldev.jaxws.beans.Person> listreturnp43= java.util.Arrays.asList(getAllPersons42mtemp);
            //tempreturnp43 = listreturnp43.toString();
            for(com.journaldev.jaxws.beans.Person p : listreturnp43){
            	int id = p.getId();
            	int age = p.getAge();
            	String name=p.getName();
            	%>
            	<%=id%>::<%=name %>::<%=age %>
            	<%
            	}
            }
            }      
    break;
    

    After that we get below output, note that Eclipse is doing hot deployment here, so I didn’t had to redeploy my application. soap web service example, soap webservices in java

So it looks like our web service and client applications are working fine, make sure to spend some time in looking at the client side stubs generated by Eclipse to understand more.

SOAP Web Service WSDL and Configs

Finally you will notice that WSDL file is generated in the web service project as below. PersonServiceImpl.wsdl code:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="https://service.jaxws.journaldev.com" xmlns:apachesoap="https://xml.apache.org/xml-soap" xmlns:impl="https://service.jaxws.journaldev.com" xmlns:intf="https://service.jaxws.journaldev.com" xmlns:tns1="https://beans.jaxws.journaldev.com" xmlns:wsdl="https://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="https://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="https://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
 <wsdl:types>
  <schema elementFormDefault="qualified" targetNamespace="https://service.jaxws.journaldev.com" xmlns="https://www.w3.org/2001/XMLSchema">
   <import namespace="https://beans.jaxws.journaldev.com"/>
   <element name="addPerson">
    <complexType>
     <sequence>
      <element name="p" type="tns1:Person"/>
     </sequence>
    </complexType>
   </element>
   <element name="addPersonResponse">
    <complexType>
     <sequence>
      <element name="addPersonReturn" type="xsd:boolean"/>
     </sequence>
    </complexType>
   </element>
   <element name="deletePerson">
    <complexType>
     <sequence>
      <element name="id" type="xsd:int"/>
     </sequence>
    </complexType>
   </element>
   <element name="deletePersonResponse">
    <complexType>
     <sequence>
      <element name="deletePersonReturn" type="xsd:boolean"/>
     </sequence>
    </complexType>
   </element>
   <element name="getPerson">
    <complexType>
     <sequence>
      <element name="id" type="xsd:int"/>
     </sequence>
    </complexType>
   </element>
   <element name="getPersonResponse">
    <complexType>
     <sequence>
      <element name="getPersonReturn" type="tns1:Person"/>
     </sequence>
    </complexType>
   </element>
   <element name="getAllPersons">
    <complexType/>
   </element>
   <element name="getAllPersonsResponse">
    <complexType>
     <sequence>
      <element maxOccurs="unbounded" name="getAllPersonsReturn" type="tns1:Person"/>
     </sequence>
    </complexType>
   </element>
  </schema>
  <schema elementFormDefault="qualified" targetNamespace="https://beans.jaxws.journaldev.com" xmlns="https://www.w3.org/2001/XMLSchema">
   <complexType name="Person">
    <sequence>
     <element name="age" type="xsd:int"/>
     <element name="id" type="xsd:int"/>
     <element name="name" nillable="true" type="xsd:string"/>
    </sequence>
   </complexType>
  </schema>
 </wsdl:types>

   <wsdl:message name="addPersonResponse">

      <wsdl:part element="impl:addPersonResponse" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="getAllPersonsResponse">

      <wsdl:part element="impl:getAllPersonsResponse" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="deletePersonResponse">

      <wsdl:part element="impl:deletePersonResponse" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="addPersonRequest">

      <wsdl:part element="impl:addPerson" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="getPersonResponse">

      <wsdl:part element="impl:getPersonResponse" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="getPersonRequest">

      <wsdl:part element="impl:getPerson" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="deletePersonRequest">

      <wsdl:part element="impl:deletePerson" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="getAllPersonsRequest">

      <wsdl:part element="impl:getAllPersons" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:portType name="PersonServiceImpl">

      <wsdl:operation name="addPerson">

         <wsdl:input message="impl:addPersonRequest" name="addPersonRequest">

       </wsdl:input>

         <wsdl:output message="impl:addPersonResponse" name="addPersonResponse">

       </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="deletePerson">

         <wsdl:input message="impl:deletePersonRequest" name="deletePersonRequest">

       </wsdl:input>

         <wsdl:output message="impl:deletePersonResponse" name="deletePersonResponse">

       </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getPerson">

         <wsdl:input message="impl:getPersonRequest" name="getPersonRequest">

       </wsdl:input>

         <wsdl:output message="impl:getPersonResponse" name="getPersonResponse">

       </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getAllPersons">

         <wsdl:input message="impl:getAllPersonsRequest" name="getAllPersonsRequest">

       </wsdl:input>

         <wsdl:output message="impl:getAllPersonsResponse" name="getAllPersonsResponse">

       </wsdl:output>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="PersonServiceImplSoapBinding" type="impl:PersonServiceImpl">

      <wsdlsoap:binding style="document" transport="https://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="addPerson">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="addPersonRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="addPersonResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="deletePerson">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="deletePersonRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="deletePersonResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getPerson">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getPersonRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="getPersonResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getAllPersons">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getAllPersonsRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="getAllPersonsResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="PersonServiceImplService">

      <wsdl:port binding="impl:PersonServiceImplSoapBinding" name="PersonServiceImpl">

         <wsdlsoap:address location="https://localhost:8080/SOAPExample/services/PersonServiceImpl"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>

If you will open it in design mode in Eclipse, it will look like below image. soap web service example, soap webservices in java, eclipse wsdl design You can also access web service WSDL file through browser by appending ?wsdl to the web service endpoint. soap web service example, soap webservices in java, WSDL example You will also note that web.xml is modified to use Apache Axis as front controller for web service.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns="https://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="https://xmlns.jcp.org/xml/ns/javaee https://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>SOAPExample</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <display-name>Apache-Axis Servlet</display-name>
    <servlet-name>AxisServlet</servlet-name>
    <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/servlet/AxisServlet</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>*.jws</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>Axis Admin Servlet</display-name>
    <servlet-name>AdminServlet</servlet-name>
    <servlet-class>org.apache.axis.transport.http.AdminServlet</servlet-class>
    <load-on-startup>100</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>AdminServlet</servlet-name>
    <url-pattern>/servlet/AdminServlet</url-pattern>
  </servlet-mapping>
</web-app>

Below image shows the web service and client project with all the auto generated stubs and JSP pages to test the web service. soap web service example project eclipse, soap webservices in java soap web service example client project eclipse, soap webservices in java That’s all for soap webservices in java example using Eclipse, as you can see that all the hard part was done by Eclipse automatically and all our focus was to write business logic for our web service.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author(s)

Category:
Tutorial

While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
JournalDev
DigitalOcean Employee
DigitalOcean Employee badge
January 14, 2016

Very Helpful . One Doubt: How i can set costum fault message in above code .

- Ali

    JournalDev
    DigitalOcean Employee
    DigitalOcean Employee badge
    January 21, 2016

    Hi Pankaj, You are magic man. Thanks for the article.

    - Jozef

      JournalDev
      DigitalOcean Employee
      DigitalOcean Employee badge
      February 16, 2016

      Very much Helpful…

      - Kriya

        JournalDev
        DigitalOcean Employee
        DigitalOcean Employee badge
        February 16, 2016

        Kidilamm Article…

        - Vishnu

          JournalDev
          DigitalOcean Employee
          DigitalOcean Employee badge
          February 24, 2016

          please provide a download link for the same…

          - lanka

            JournalDev
            DigitalOcean Employee
            DigitalOcean Employee badge
            March 18, 2016

            Your articles are really easy to understand and helpful. Keep it up the good work. Thanks for your help.

            - Uday Pandya

              JournalDev
              DigitalOcean Employee
              DigitalOcean Employee badge
              May 22, 2016

              not too clear to understood as your other articles used to be. sorry.

              - James Paul

                JournalDev
                DigitalOcean Employee
                DigitalOcean Employee badge
                June 10, 2016

                Pankaj your tutorial are easy to understand with example. Thanks for creating these stuff.

                - Monalisa

                JournalDev
                DigitalOcean Employee
                DigitalOcean Employee badge
                June 10, 2016

                Thanks for nice words Monalisa.

                - Pankaj

                  JournalDev
                  DigitalOcean Employee
                  DigitalOcean Employee badge
                  August 1, 2016

                  Hi, It one really nice thanks!!.

                  - lakshmanan

                    JournalDev
                    DigitalOcean Employee
                    DigitalOcean Employee badge
                    August 26, 2016

                    Nice explanation… Thank you.

                    - anreddy

                      JournalDev
                      DigitalOcean Employee
                      DigitalOcean Employee badge
                      August 30, 2016

                      Thank you for great explanation :)

                      - Adarsh

                        JournalDev
                        DigitalOcean Employee
                        DigitalOcean Employee badge
                        September 15, 2016

                        Great tutorial. I would also like to see one where you start with the XSD/WSDL and do it that way. I have tried but cannot get it to work.

                        - Tim

                        JournalDev
                        DigitalOcean Employee
                        DigitalOcean Employee badge
                        September 25, 2016

                        could you please give an example for integrating multiple web services in to a single web service.

                        - praveen nair

                          JournalDev
                          DigitalOcean Employee
                          DigitalOcean Employee badge
                          October 15, 2016

                          Hello Pankaj, Thank you very much for the tutorial :) . I did it with web module 2.4 as 3.1 was giving me IWAB0020E Error in adding servlet in web.xml. java.lang.NullPointerException. could you tell me what would be the reason with 3.1? Thanks

                          - Riteeka Rathod

                          JournalDev
                          DigitalOcean Employee
                          DigitalOcean Employee badge
                          September 6, 2018

                          Even i also got the same message. Pankaj, Can you please give me the reply to that above message. Thanks

                          - Prasad

                            JournalDev
                            DigitalOcean Employee
                            DigitalOcean Employee badge
                            October 21, 2016

                            HI Can we have the download link for all the files mentioned above? This will be very helpful to us

                            - Katchapakesan

                              JournalDev
                              DigitalOcean Employee
                              DigitalOcean Employee badge
                              November 18, 2016

                              Excellent! There are many tutor on the web, but they help me not, but your! I got it with Luna, Tomcat 7 too!

                              - Timo

                                JournalDev
                                DigitalOcean Employee
                                DigitalOcean Employee badge
                                December 1, 2016

                                thank you so much for this lovely post…

                                - Padam Verma

                                  JournalDev
                                  DigitalOcean Employee
                                  DigitalOcean Employee badge
                                  December 7, 2016

                                  Hi, could please tell me how to create soap request in simple example. Thanks,

                                  - saj

                                    JournalDev
                                    DigitalOcean Employee
                                    DigitalOcean Employee badge
                                    December 22, 2016

                                    Marvellous ! had cheked quite a few tutorials earlier , but you nailed it! Thanks Man!

                                    - Vishal

                                      JournalDev
                                      DigitalOcean Employee
                                      DigitalOcean Employee badge
                                      February 10, 2017

                                      i want to do soap web service by using excel sheet and i need to read it excel and dispaly it in liferay portlet

                                      - Syed Arif

                                        JournalDev
                                        DigitalOcean Employee
                                        DigitalOcean Employee badge
                                        February 19, 2017

                                        Thank Buddy, This is very useful

                                        - Shan

                                          JournalDev
                                          DigitalOcean Employee
                                          DigitalOcean Employee badge
                                          March 1, 2017

                                          Thanks

                                          - Harshana

                                            JournalDev
                                            DigitalOcean Employee
                                            DigitalOcean Employee badge
                                            March 10, 2017

                                            Hello Pankaj, Thanks for the article. I have a question, If I want to add one more field in person java bean let say address field, DO i need to generate WSDL file once again from scratch? Thanks in advance…

                                            - Raj

                                              JournalDev
                                              DigitalOcean Employee
                                              DigitalOcean Employee badge
                                              March 14, 2017

                                              Hi, Thanks for this above tutorial. I am getting this error… IWAB0489E Error when deploying Web service to Axis runtime axis-admin failed with {https://xml.apache.org/axis/}HTTP (500)INKApi Error Please help me.

                                              - Paramesh

                                              JournalDev
                                              DigitalOcean Employee
                                              DigitalOcean Employee badge
                                              March 29, 2017

                                              I am getting the below error: IWAB0489E Error when deploying Web service to Axis runtime axis-admin failed with {https://xml.apache.org/axis/}HTTP (400)Bad Request

                                              - Bibhu

                                                JournalDev
                                                DigitalOcean Employee
                                                DigitalOcean Employee badge
                                                March 27, 2017

                                                Excellent and very easy for new person to soap webservices. GOod Job

                                                - Mastan

                                                  JournalDev
                                                  DigitalOcean Employee
                                                  DigitalOcean Employee badge
                                                  June 8, 2017

                                                  Hi, thanks for this awesome tutorial. I have some trouble when i put this “JSONObject jo = new JSONObject()”, i get this error from my result : soapenv:Server.userException java.lang.reflect.InvocationTargetException DESKTOP-QUK0MAM When i remove JSONObject, it works. What happen with JSONObject? Thanks.

                                                  - Peter Susanto

                                                    JournalDev
                                                    DigitalOcean Employee
                                                    DigitalOcean Employee badge
                                                    July 17, 2017

                                                    It was a very nice article. For a beginner like me it was easy to follow and learn SOAP. Thank you so much for developing this article

                                                    - Deepak

                                                      JournalDev
                                                      DigitalOcean Employee
                                                      DigitalOcean Employee badge
                                                      July 31, 2017

                                                      Very nice article. One question: Will there be two different projects named “SOAPExample” and “SOAPExampleClient”? and how to export and deploy the service as a WAR file if there is two different projects?

                                                      - Sujoy Pal

                                                        JournalDev
                                                        DigitalOcean Employee
                                                        DigitalOcean Employee badge
                                                        September 5, 2017

                                                        Two changes I had to make to get this to work. #1: On the Eclipse dialog to choose your client and server runtimes you are told to select “Axis 2” for the client side. You are not told to select Axis 2 for the server side! Select Axis 2 on the server side (or you will get a classic error “unable to find… /WEB-INF/server-config.wsdd”. ) #2. Before starting the server part, install Axis 2 by following these instructions: a. Download the Axis 2 binary distribution from here https://axis.apache.org/axis2/java/core/download.cgi b. Extract the axis zip to somewhere on your drive you can share it across projects (like JDK, or maven, etc) c. Enter Eclipse and go to Window > Preferences > Web Services > Axis2 Preferences In the Axis2 runtime location field, point to your Axis2 installation directory (the one you created in step b) Click Apply. Also… the “Web Services Explorer” is hard to find. It’s under the Run menu at the bottom. Source: https://stackoverflow.com/a/22457369/2233199

                                                        - gbs

                                                        JournalDev
                                                        DigitalOcean Employee
                                                        DigitalOcean Employee badge
                                                        October 11, 2017

                                                        NO, you have to select Apache Axis only in both server and client, not Axis 2.

                                                        - Aditya

                                                          JournalDev
                                                          DigitalOcean Employee
                                                          DigitalOcean Employee badge
                                                          October 11, 2017

                                                          This is a good post

                                                          - nuth

                                                            JournalDev
                                                            DigitalOcean Employee
                                                            DigitalOcean Employee badge
                                                            October 13, 2017

                                                            Could you please elaborate more about SOAP

                                                            - Gautam

                                                              JournalDev
                                                              DigitalOcean Employee
                                                              DigitalOcean Employee badge
                                                              March 1, 2017

                                                              Thanks

                                                              - Harshana

                                                                JournalDev
                                                                DigitalOcean Employee
                                                                DigitalOcean Employee badge
                                                                March 10, 2017

                                                                Hello Pankaj, Thanks for the article. I have a question, If I want to add one more field in person java bean let say address field, DO i need to generate WSDL file once again from scratch? Thanks in advance…

                                                                - Raj

                                                                  JournalDev
                                                                  DigitalOcean Employee
                                                                  DigitalOcean Employee badge
                                                                  March 14, 2017

                                                                  Hi, Thanks for this above tutorial. I am getting this error… IWAB0489E Error when deploying Web service to Axis runtime axis-admin failed with {https://xml.apache.org/axis/}HTTP (500)INKApi Error Please help me.

                                                                  - Paramesh

                                                                  JournalDev
                                                                  DigitalOcean Employee
                                                                  DigitalOcean Employee badge
                                                                  March 29, 2017

                                                                  I am getting the below error: IWAB0489E Error when deploying Web service to Axis runtime axis-admin failed with {https://xml.apache.org/axis/}HTTP (400)Bad Request

                                                                  - Bibhu

                                                                    JournalDev
                                                                    DigitalOcean Employee
                                                                    DigitalOcean Employee badge
                                                                    March 27, 2017

                                                                    Excellent and very easy for new person to soap webservices. GOod Job

                                                                    - Mastan

                                                                      JournalDev
                                                                      DigitalOcean Employee
                                                                      DigitalOcean Employee badge
                                                                      June 8, 2017

                                                                      Hi, thanks for this awesome tutorial. I have some trouble when i put this “JSONObject jo = new JSONObject()”, i get this error from my result : soapenv:Server.userException java.lang.reflect.InvocationTargetException DESKTOP-QUK0MAM When i remove JSONObject, it works. What happen with JSONObject? Thanks.

                                                                      - Peter Susanto

                                                                        JournalDev
                                                                        DigitalOcean Employee
                                                                        DigitalOcean Employee badge
                                                                        July 17, 2017

                                                                        It was a very nice article. For a beginner like me it was easy to follow and learn SOAP. Thank you so much for developing this article

                                                                        - Deepak

                                                                          JournalDev
                                                                          DigitalOcean Employee
                                                                          DigitalOcean Employee badge
                                                                          July 31, 2017

                                                                          Very nice article. One question: Will there be two different projects named “SOAPExample” and “SOAPExampleClient”? and how to export and deploy the service as a WAR file if there is two different projects?

                                                                          - Sujoy Pal

                                                                            JournalDev
                                                                            DigitalOcean Employee
                                                                            DigitalOcean Employee badge
                                                                            September 5, 2017

                                                                            Two changes I had to make to get this to work. #1: On the Eclipse dialog to choose your client and server runtimes you are told to select “Axis 2” for the client side. You are not told to select Axis 2 for the server side! Select Axis 2 on the server side (or you will get a classic error “unable to find… /WEB-INF/server-config.wsdd”. ) #2. Before starting the server part, install Axis 2 by following these instructions: a. Download the Axis 2 binary distribution from here https://axis.apache.org/axis2/java/core/download.cgi b. Extract the axis zip to somewhere on your drive you can share it across projects (like JDK, or maven, etc) c. Enter Eclipse and go to Window > Preferences > Web Services > Axis2 Preferences In the Axis2 runtime location field, point to your Axis2 installation directory (the one you created in step b) Click Apply. Also… the “Web Services Explorer” is hard to find. It’s under the Run menu at the bottom. Source: https://stackoverflow.com/a/22457369/2233199

                                                                            - gbs

                                                                            JournalDev
                                                                            DigitalOcean Employee
                                                                            DigitalOcean Employee badge
                                                                            October 11, 2017

                                                                            NO, you have to select Apache Axis only in both server and client, not Axis 2.

                                                                            - Aditya

                                                                              JournalDev
                                                                              DigitalOcean Employee
                                                                              DigitalOcean Employee badge
                                                                              October 11, 2017

                                                                              This is a good post

                                                                              - nuth

                                                                                JournalDev
                                                                                DigitalOcean Employee
                                                                                DigitalOcean Employee badge
                                                                                October 13, 2017

                                                                                Could you please elaborate more about SOAP

                                                                                - Gautam

                                                                                  JournalDev
                                                                                  DigitalOcean Employee
                                                                                  DigitalOcean Employee badge
                                                                                  November 29, 2017

                                                                                  Thank you for the tutorial! Easy to follow and explicative.

                                                                                  - Sergio Martini Popoli

                                                                                    JournalDev
                                                                                    DigitalOcean Employee
                                                                                    DigitalOcean Employee badge
                                                                                    December 6, 2017

                                                                                    Excellent and Easy… :-)

                                                                                    - mahes

                                                                                      JournalDev
                                                                                      DigitalOcean Employee
                                                                                      DigitalOcean Employee badge
                                                                                      December 7, 2017

                                                                                      Create a new project? Dynamic web project or Java project?

                                                                                      - Ajay

                                                                                      JournalDev
                                                                                      DigitalOcean Employee
                                                                                      DigitalOcean Employee badge
                                                                                      December 18, 2017

                                                                                      Dynamic web project

                                                                                      - Ajay Venkatesh

                                                                                        JournalDev
                                                                                        DigitalOcean Employee
                                                                                        DigitalOcean Employee badge
                                                                                        February 7, 2018

                                                                                        How consume oracle on demand crm using soap web service in java using apache axis 1.4 with authentication.

                                                                                        - Raj Singh

                                                                                          JournalDev
                                                                                          DigitalOcean Employee
                                                                                          DigitalOcean Employee badge
                                                                                          May 9, 2018

                                                                                          I have made the changes accordingly for gellAllPersons in result.jsp case 15: gotMethod = true; com.nttdata.model.Person[] getAllPersons15mtemp = samplePersonServiceIMPLProxyid.getAllPersons(); if(getAllPersons15mtemp == null){ %> <% }else{ String tempreturnp16 = null; if(getAllPersons15mtemp != null){ java.util.List listreturnp16= java.util.Arrays.asList(getAllPersons15mtemp); //tempreturnp16 = listreturnp16.toString(); for(com.nttdata.model.Person p : listreturnp16){ int id = p.getId(); int age = p.getAge(); String name=p.getName(); %> :::: <% } } } still it is returning null. Please help me out

                                                                                          - abhinay

                                                                                            JournalDev
                                                                                            DigitalOcean Employee
                                                                                            DigitalOcean Employee badge
                                                                                            September 18, 2018

                                                                                            Well i cant really get the code right for showing all persons. Heres the code: case 42: gotMethod = true; com.model.VO.Person[] getallPerson42mtemp = samplePersonServiceImplProxyid.getallPerson(); if(getallPerson42mtemp == null){ %> <% }else{ String tempreturnp43 = null; if(getallPerson42mtemp != null){ java.util.List listreturnp43= java.util.Arrays.asList(getallPerson42mtemp); tempreturnp43 = listreturnp43.toString(); } for(com.model.VO.Person p : listreturnp43){ int id = p.getId(); int age = p.getAge(); String name=p.getName(); %> :::: <% } } In the for loop, its giving me error on listreturnp43 saying it cannot be resolved to a variable. I did exactly what you illustrated. Any suggeestions?

                                                                                            - Neel Nagan

                                                                                              JournalDev
                                                                                              DigitalOcean Employee
                                                                                              DigitalOcean Employee badge
                                                                                              September 19, 2018

                                                                                              how to make soap webservices to use rest api url

                                                                                              - Saurabh

                                                                                                JournalDev
                                                                                                DigitalOcean Employee
                                                                                                DigitalOcean Employee badge
                                                                                                October 25, 2018

                                                                                                Excellent Example

                                                                                                - Vijay

                                                                                                  JournalDev
                                                                                                  DigitalOcean Employee
                                                                                                  DigitalOcean Employee badge
                                                                                                  November 15, 2018

                                                                                                  I am getting the exception after trying to add a peson in webservice: Exception: java.lang.InstantiationException: com.amadeus.ocg.standard.access.newwebservice.PersonServiceImpl Message: java.lang.InstantiationException: com.amadeus.ocg.standard.access.newwebservice.PersonServiceImpl PersonServiceImpl is an interface by default. How can I correct this issue?

                                                                                                  - Harshit

                                                                                                    JournalDev
                                                                                                    DigitalOcean Employee
                                                                                                    DigitalOcean Employee badge
                                                                                                    November 22, 2018

                                                                                                    How can my rest web service consume a soap client request

                                                                                                    - Sas

                                                                                                      JournalDev
                                                                                                      DigitalOcean Employee
                                                                                                      DigitalOcean Employee badge
                                                                                                      December 5, 2019

                                                                                                      Hi Pankaj, a clear and excellent intro. Thank you, Csaba

                                                                                                      - Csaba Botos

                                                                                                        JournalDev
                                                                                                        DigitalOcean Employee
                                                                                                        DigitalOcean Employee badge
                                                                                                        December 31, 2019

                                                                                                        Using the current eclipse version (201912), I am unable to create a client. Tried it two times following different paths after launching the service, but didn’t get a form to create the client as described.

                                                                                                        - dklein

                                                                                                          JournalDev
                                                                                                          DigitalOcean Employee
                                                                                                          DigitalOcean Employee badge
                                                                                                          May 26, 2020

                                                                                                          Hi pankaj This tutorial is really helpful, but I want any examples with google web toolkit with soap, Will you provide some hint or tutorial on GWT application I. E rpc call with soap service How soap service can be call in gwt application

                                                                                                          - Himmat

                                                                                                            Join the Tech Talk
                                                                                                            Success! Thank you! Please check your email for further details.

                                                                                                            Please complete your information!

                                                                                                            Become a contributor for community

                                                                                                            Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

                                                                                                            DigitalOcean Documentation

                                                                                                            Full documentation for every DigitalOcean product.

                                                                                                            Resources for startups and SMBs

                                                                                                            The Wave has everything you need to know about building a business, from raising funding to marketing your product.

                                                                                                            Get our newsletter

                                                                                                            Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

                                                                                                            New accounts only. By submitting your email you agree to our Privacy Policy

                                                                                                            The developer cloud

                                                                                                            Scale up as you grow — whether you're running one virtual machine or ten thousand.

                                                                                                            Get started for free

                                                                                                            Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

                                                                                                            *This promotional offer applies to new accounts only.