Login with  Log in with facebook
Hiring Manager? SIGN UP HERE
Mar/13

27

Creating a Simple SOAP Web Service using Maven in 5 Steps

SOAP

SOAP stands for simple object access protocol.

In this SOAP Service we'll have 4 classes

   TimeService.java

   TimeServiceImpl.java

   TimePublisher.java

   TimeClient.java

pom.xml

pom.xml for this project is barebones as java 6 onwards provide native support for soap using jax-ws.

 

  
<project xmlns="http://www.w3.org/2001/XMLSCHEMA-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.q1a</groupId>
<artifactId>soapwebservice</artificatId>
<packaging>war</packaging>
</project>
 
TimeService.java
TimeService is end point interface which like other interfaces in Java defines the contract for behavior this services provides.


package com.q1a.service;

import javax.jws.Webservice;
import javax.xml.bind.annoation.XmlElement;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding;
@SOAPBinding( style = Style.RPC)
@WebService
public interface TimeService {

@WebMethod
public String getTimeAsString();

@WebMethod
public long getTimeAsElapsed();
}
 

Schedule a Demo

Schedule a Demo with us

Name *
Email *
Phone *
Company *
Details