2012-04-11 5 views
3

Camel과 CXF를 사용하여 웹 서비스를 개발하고 "코드 우선"방식을 사용하고 있습니다. 모든 것이 단일 매개 변수를 갖는 메소드에 대해 잘 작동합니다. 그러나 여러 매개 변수가있는 메서드는 첫 번째 매개 변수 만 받고 다른 메서드는 null을 반환합니다. 예외는 발생하지 않습니다.여러 매개 변수가있는 CXF 웹 서비스

<route> 
    <from uri="cxf:bean:serverEndPoint" /> 
    <log message=">>> data is : ${body}"/> 
    <choice> 
    <when> 
     <simple>${in.header.operationName} == 'doSomething'</simple> 
     <to uri="bean:TestWSBean?method=doSomething"/> 
    </when> 
    ... 
</route> 

서버 엔드 포인트는 다음과 같이 정의된다 :

<cxf:cxfEndpoint id="serverEndPoint" 
       address="http://localhost:9000/casServer/" 
       serviceClass="com.test.iface.TestWebService"> 
    <cxf:inInterceptors> 
     <ref bean="loggingInInterceptor"/> 
    </cxf:inInterceptors>     
    <cxf:outInterceptors> 
     <ref bean="loggingOutInterceptor"/> 
    </cxf:outInterceptors>     
</cxf:cxfEndpoint> 

그리고 구현 콩 자체 : 여기

내 경로입니다

@WebService 
public interface TestWebService { 
    public String doSomething(String one, String two); 
} 

내 질문은 아주 기본적인, 무엇을 여러 매개 변수를 보낼 수 있어야합니까?

답변

2

requestwrappper 주석을 사용해야합니다. cxf의 wsdl_first 예제에서 생성 된 코드를 살펴보십시오. 주석과 적절한 래퍼 클래스를 생성합니다.

@RequestWrapper (localName를 = "updateCustomer는"의 targetNamespace는 = "http://customerservice.example.com/는"클래스 이름은 "com.example.customerservice.UpdateCustomer"=)

+0

감사 기독교, 그것은 나를 위해 작동 . 그러나 많은 경우 주석이 필요하며 이는 내 경우에는 수용 할 수 없다 (코드 생성). 단일 클래스로 여러 매개 변수를 래핑하도록 인터페이스를 다시 고려해야합니다. – Daniel

+0

사용 방법은? 낙타가 경로 안에 보낼 수있는 헤더가 필요합니까? –

관련 문제