12.07.2015 Views

Anyframe CXF Plugin

Anyframe CXF Plugin

Anyframe CXF Plugin

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

RESTful Services7.2.HTTP Binding(JRA) 활용한 RESTful 서비스 구현표준 방식이 아닌 방법으로 가장 쉽고 용이한 방식으로 JRA(Java REST Annotation) 설정을 이용하여RESTful 서비스를 작성할 수 있게 한다.Java REST Annotation의 특징 을 살펴보면 다음과 같다.• Web Service로 노출시킬 서비스 인터페이스 클래스의 각 method별로 JRA 설정을 하여 RESTful WebService를 구현한다.• 인터페이스 클래스의 메소드 별로 @Get/@Post/@Put/@Delete와 @HttpResource Annotation을 설정한다. HttpResource의 location 속성 정보가 RESTful Web Service로 접근하는 path 정보가 된다.• 인터페이스 클래스 메소드가 리턴 타입이 존재하는 경우 @WebResult Annotation을 설정한다.(리턴타입이 void 인 경우 불필요함)다음은 HTTP Binding(JRA)를 활용하여 RESTful 서비스 구현 시 Server와 Client 단에서 어떻게 사용해야 하는지에 대한 사용법이다.• Server Configuration• Client Configuration• 유의 사항7.2.1.Server ConfigurationMovie Service를 JAX-WS Frontend와 JRA 설정을 사용하여 RESTful Web Services로 노출시켜보도록 한다.7.2.1.1.Samples다음은 Movie Service의 인터페이스 클래스 정의에 대한 예제이다.• Interface Class다음은 Movie Service의 인터페이스 클래스를 작성한 MovieService.java 의 일부이다. Annotation 설정에 유의하도록 한다.import org.codehaus.jra.Get;import org.codehaus.jra.Post;import org.codehaus.jra.HttpResource;@WebService(targetNamespace = "http://anyframe.sample.movie.restful.httpbinding.jra")public interface MovieService {@Get@HttpResource(location = "/movies")@WebResult(name = "Movies")public Movies findMovieListAll() throws Exception;@Get@HttpResource(location = "/movies/{movieId}")@WebResult(name = "Movie")public Movie findMovie(FindMovie findMovie) throws Exception;@Post@HttpResource(location = "/movies")55

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!