File tree Expand file tree Collapse file tree
src/main/java/com/example Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
2+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
4+ <modelVersion >4.0.0</modelVersion >
5+ <groupId >com.example</groupId >
6+ <artifactId >calculator</artifactId >
7+ <version >1.0-SNAPSHOT</version >
8+ <dependencies >
9+ <dependency >
10+ <groupId >org.apache.cxf</groupId >
11+ <artifactId >cxf-rt-frontend-jaxws</artifactId >
12+ <version >3.4.5</version >
13+ </dependency >
14+ <dependency >
15+ <groupId >org.apache.cxf</groupId >
16+ <artifactId >cxf-rt-transports-http</artifactId >
17+ <version >3.4.5</version >
18+ </dependency >
19+ </dependencies >
20+ <build >
21+ <plugins >
22+ <plugin >
23+ <groupId >org.apache.maven.plugins</groupId >
24+ <artifactId >maven-compiler-plugin</artifactId >
25+ <version >3.8.1</version >
26+ <configuration >
27+ <source >1.8</source >
28+ <target >1.8</target >
29+ </configuration >
30+ </plugin >
31+ </plugins >
32+ </build >
33+ </project >
Original file line number Diff line number Diff line change 1+ package com .example ;
2+
3+ import javax .jws .WebMethod ;
4+ import javax .jws .WebService ;
5+
6+ @ WebService
7+ public interface CalculatorService {
8+ @ WebMethod
9+ int sum (int a , int b );
10+
11+ @ WebMethod
12+ int sub (int a , int b );
13+ }
Original file line number Diff line number Diff line change 1+ package com .example ;
2+
3+ import javax .jws .WebService ;
4+
5+ @ WebService (endpointInterface = "com.example.CalculatorService" )
6+ public class CalculatorServiceImpl implements CalculatorService {
7+
8+ @ Override
9+ public int sum (int a , int b ) {
10+ return a + b ;
11+ }
12+
13+ @ Override
14+ public int sub (int a , int b ) {
15+ return a - b ;
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ package com .example ;
2+
3+ import javax .xml .ws .Endpoint ;
4+
5+ public class CalculatorServicePublisher {
6+ public static void main (String [] args ) {
7+ Endpoint .publish ("http://localhost:8080/ws/calculator" , new CalculatorServiceImpl ());
8+ System .out .println ("Service is published!" );
9+ }
10+ }
You can’t perform that action at this time.
0 commit comments