Eclipse에서 간단한 웹 서비스 및 웹 서비스 클라이언트 생성 및 배포
게시 됨: 2019-10-20Eclipse IDE에서 간단한 Web Service
및 Web Service Client
를 만들고 배포하려면 아래의 간단한 단계를 따르십시오.
1 단계
Apache Tomcat을 설치하고 서버 탭의 Eclipse에 추가합니다. 저는 Tomcat version 9.0.10
을 사용하고 있습니다.
2 단계
동적 웹 프로젝트 생성(이름: CrunchifyWS
)

3단계
/src
폴더 아래에 자바 파일을 생성합니다. /src 폴더 -> 새로 만들기 -> 클래스를 마우스 오른쪽 버튼으로 클릭합니다.
- 패키지:
crunchify.com.web.service
- 이름:
CrunchifyHelloWorld.java

4단계
CrunchifyHelloWorld.java
파일을 열고 간단한 메인 메소드를 생성합니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
package crunchify . com . web . service ; /** * @author Crunchify.com */ public class CrunchifyHelloWorld { public float addValue ( float value ) { return ( value + 10 ) ; } public float subtractValue ( float value ) { return ( value - 10 ) ; } } |
5단계
-
CrunchifyHelloWorld.java -> Web Services -> Create Web Service
파일을 마우스 오른쪽 버튼으로 클릭합니다. - 아래 다이어그램에 언급된 대로 옵션을 선택합니다.
- 완료 클릭

6단계
모든 프로세스를 완료하는 데 시간이 걸릴 수 있으며 새 프로젝트 " CrunchifyWSClient
"가 생성된 것을 볼 수 있습니다. 다음은 최종 프로젝트 구조입니다.

7단계
CrunchifyWS
및 CrunchifyWSClient
두 프로젝트 모두 서버에 자동으로 배포되어야 합니다.
또한 Eclipse는 URL이 http://localhost:8080/CrunchifyWSClient/sampleCrunchifyHelloWorldProxy/TestClient.jsp?endpoint=http://localhost:5922/CrunchifyWS/services/CrunchifyHelloWorld인 Web Service Test Client Window
을 자동으로 엽니다.
8단계
이제 addValue(float)
,tractValue( subtractValue(float)
) 를 클릭하고 업데이트된 결과를 확인하기 위한 입력을 제공합니다.

모든 준비가 완료되었습니다. 이 단계에 어려움이 있으면 알려주십시오.
호출 버튼을 클릭한 후 아래 오류가 발생합니까?
1 2 |
Result Exception : java . net . ConnectException : Connection refused ( Connection refused ) Message : ; nested exception is : java . net . ConnectException : Connection refused ( Connection refused ) |

아래 단계를 따르십시오.
- 톰캣 우클릭
- 추가 및 제거를 클릭하여 추가된 애플리케이션 확인
- 청소...를 클릭합니다.
- 게시 클릭
- 다시 시작을 클릭하십시오

응용 프로그램 또는 나중에 다시 시작한 후 WebService를 다시 실행하는 방법은 무엇입니까?
다음은 편리한 URL입니다. http://localhost:8080/CrunchifyWSClient/sampleCrunchifyHelloWorldProxy/TestClient.jsp

CrunchifyHelloWorld.wsdl을 다운로드하려면 다음 위치에 있습니다.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
<? xml version = "1.0" encoding = "UTF-8" ?> < wsdl : definitions targetNamespace = "http://service.web.com.crunchify" xmlns : apachesoap = "http://xml.apache.org/xml-soap" xmlns : impl = "http://service.web.com.crunchify" xmlns : intf = "http://service.web.com.crunchify" xmlns : wsdl = "http://schemas.xmlsoap.org/wsdl/" xmlns : wsdlsoap = "http://schemas.xmlsoap.org/wsdl/soap/" xmlns : xsd = "http://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 = "http://service.web.com.crunchify" xmlns = "http://www.w3.org/2001/XMLSchema" > < element name = "subtractValue" > < complexType > < sequence > < element name = "value" type = "xsd:float" / > < / sequence > < / complexType > < / element > < element name = "subtractValueResponse" > < complexType > < sequence > < element name = "subtractValueReturn" type = "xsd:float" / > < / sequence > < / complexType > < / element > < element name = "addValue" > < complexType > < sequence > < element name = "value" type = "xsd:float" / > < / sequence > < / complexType > < / element > < element name = "addValueResponse" > < complexType > < sequence > < element name = "addValueReturn" type = "xsd:float" / > < / sequence > < / complexType > < / element > < / schema > < / wsdl : types > < wsdl : message name = "subtractValueResponse" > < wsdl : part element = "impl:subtractValueResponse" name = "parameters" > < / wsdl : part > < / wsdl : message > < wsdl : message name = "addValueResponse" > < wsdl : part element = "impl:addValueResponse" name = "parameters" > < / wsdl : part > < / wsdl : message > < wsdl : message name = "addValueRequest" > < wsdl : part element = "impl:addValue" name = "parameters" > < / wsdl : part > < / wsdl : message > < wsdl : message name = "subtractValueRequest" > < wsdl : part element = "impl:subtractValue" name = "parameters" > < / wsdl : part > < / wsdl : message > < wsdl : portType name = "CrunchifyHelloWorld" > < wsdl : operation name = "subtractValue" > < wsdl : input message = "impl:subtractValueRequest" name = "subtractValueRequest" > < / wsdl : input > < wsdl : output message = "impl:subtractValueResponse" name = "subtractValueResponse" > < / wsdl : output > < / wsdl : operation > < wsdl : operation name = "addValue" > < wsdl : input message = "impl:addValueRequest" name = "addValueRequest" > < / wsdl : input > < wsdl : output message = "impl:addValueResponse" name = "addValueResponse" > < / wsdl : output > < / wsdl : operation > < / wsdl : portType > < wsdl : binding name = "CrunchifyHelloWorldSoapBinding" type = "impl:CrunchifyHelloWorld" > < wsdlsoap : binding style = "document" transport = "http://schemas.xmlsoap.org/soap/http" / > < wsdl : operation name = "subtractValue" > < wsdlsoap : operation soapAction = "" / > < wsdl : input name = "subtractValueRequest" > < wsdlsoap : body use = "literal" / > < / wsdl : input > < wsdl : output name = "subtractValueResponse" > < wsdlsoap : body use = "literal" / > < / wsdl : output > < / wsdl : operation > < wsdl : operation name = "addValue" > < wsdlsoap : operation soapAction = "" / > < wsdl : input name = "addValueRequest" > < wsdlsoap : body use = "literal" / > < / wsdl : input > < wsdl : output name = "addValueResponse" > < wsdlsoap : body use = "literal" / > < / wsdl : output > < / wsdl : operation > < / wsdl : binding > < wsdl : service name = "CrunchifyHelloWorldService" > < wsdl : port binding = "impl:CrunchifyHelloWorldSoapBinding" name = "CrunchifyHelloWorld" > < wsdlsoap : address location = "http://localhost:8080/CrunchifyWS/services/CrunchifyHelloWorld" / > < / wsdl : port > < / wsdl : service > < / wsdl : definitions > |
이 작업을 실행하는 데 문제가 있으면 알려주십시오.
