달력

4

« 2024/4 »

  • 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
.. .. ..

[펌] : http://yally93.egloos.com/2991005

 

1. 역시 CXF를 다운 받아 압축을 풀어 놓는다.
2. 자바 및 서버를 설치한다.
3. WEB-INF/web.xml을 수정한다. 이렇게 되면 아래의 WS 가 들어간 URL은 모두 CXF를 타게 된다.
- 블로그의 특성상 <url-pattern>/WS/ * </url-pattern> 로 띄어쓰기를 빼고 수정하여 넣어라.

<web-app>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/beans.xml</param-value>
</context-param>

<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

<servlet>
<servlet-name>CXFServlet</servlet-name>
<!--display-name>CXF Servlet</display-name-->
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/WS/-</url-pattern>
</servlet-mapping>
</web-app>
4. WEB-INF/lib 폴더에 CXF 라이브러리(*.jar파일)를 집어 넣는다. 귀찮아서 모두 다 넣어 버렸다. ㅋㅋㅋ
- 일단 정리


5. WEB-INF/beans.xml 을 설정한다(web.xml에 이렇게 정의 하였다.).
- 테스트 이므로 cxf.xml, cxf-extension-soap.xml, cxf-servlet.xml 파일은 정의 하지 않았다.
- endpoint 를 주의해서 보기를 바란다. 이 부분이 해당클래스와 URL을 매핑하여 주는 부분인 듯 싶다.
- 클래스 생성 시 endpointInterface 를 통하여 넣을 수 있을 것도 같은데 그 쪽 테스트가 진행이 되지 않는다. 아직 모르겠다.
- endpoint 를 통하여 접속 URL이 어떻게 바뀌는지를 확인하여 본다.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxws:endpoint id="orderProcess" implementor="demo.order.OrderProcessImpl" address="/OrderProcess" />
<jaxws:endpoint id="testProcess" implementor="demo.order.TestProcessImpl" address="/TestProcess" />
</beans>
7. 두 개 정의된 XML중 간단한 TestProcess를 구현한다(나머지 하나는 알아서 필요하면 만들기를...).
- TestProcess.java
package demo.order;

 

import javax.jws.WebService;

@WebService
public interface TestProcess {
String getTest(String src);
}
- TestProcessImpl.java
package demo.order;

import javax.jws.WebService;

@WebService(endpointInterface = "demo.order.TestProcess")
public class TestProcessImpl implements TestProcess {
public String getTest(String src) {
return "TEST rtn:"+ src;
}
}

이렇게 되면 URL로 접속하여 볼 수가 있다.
현재 server.xml 에 포트등을 일부러(서버 두대를 띄우기 위하여) 8090으로 바꾸어 테스트를 진행하였으니 포트나 URL을 자세히 분석하기를 바란다.

먼저 web.xml에 WS를 CXF로 리턴시키기 때문에 아래의 URL을 확인한다. (sever의 path도 /로 잡혀 있어 아래의 URL을 만들었다.
http://localhost:8090/WS


OrderProcess 와 TestProcess가 보인다.
이 두 웹서비스는 processOrder 웹메소드와 getTest 웹메소드를 각각 하나씩 가지고 있음을 확인할 수가 있다.
이 정보에서 WSDL을 클릭하여 보면 http://localhost:8090/WS/TestProcess?wsdl 해당 wsdl URL을 얻을 수가 있으며 이 정보가 서로 주고 받는 입출력 정의가 된다.

이상 끝~~~~

 

'I.lib() > I.lib(Axis2)' 카테고리의 다른 글

AXIS2 정리 및 요약  (0) 2010.09.06
Axis + eclipse 이용 client 설정  (0) 2010.05.20
axis2 + eclipse Server 올리는 설정  (1) 2010.05.20
AXIS2 관련 ERROR  (2) 2010.05.19
Axis2 설치 / 설정  (2) 2010.04.27
.
:
Posted by .07274.