2016-06-15 13 views
1

게이트웨이와 서비스를 설정했지만 웹 메서드는 래핑 된 객체가 아니라 단지 4 개의 문자열입니다. 같은 java.lang.String의 "-Spring 통합 아웃 바운드 게이트웨이가 4 개의 문자열 매개 변수를 사용하여 웹 서비스 메소드를 포함시키는 방법은 무엇입니까?

JAXB는 오류를

"형식을 마샬링 할 수 없습니다 : [com.sun.istack.internal.SAXException2 연결을 제외하고 javax.xml.bind.MarshalException "제기 그것이 아닌 @XmlRootElement 주석] "

public interface WebMethodGateway { 

    @Gateway 
    @Payload("#args[0] + #args[1] + #args[2] + #args[3]") 
    public Response invoke(String arg1, String arg2, String arg3, String arg4); 

} 

integration.xml 모든

<int-ws:outbound-gateway id="outboundGateway" 
    request-channel="requestChannel" 
    reply-channel="responseChannel" 
    uri="http://localhost:8080/Service?wsdl" 
    message-sender="messageSender" 
    marshaller="marshaller" 
    unmarshaller="marshaller"/> 

<bean id="messageSender" class="org.springframework.ws.transport.http.HttpComponentsMessageSender"> 
    <property name="connectionTimeout" value="5000"/> 
    <property name="readTimeout" value="10000"/> 
</bean> 


<int:channel id="requestChannel"/> 
<int:channel id="responseChannel"/> 

<oxm:jaxb2-marshaller id="marshaller" context-path="myProject.ws.bean" /> 

<int:gateway id="webMethodGateway" 
    default-request-channel="requestChannel" 
    default-reply-channel="responseChannel" 
    service-interface="myProject.ws.gateway.WebMethodGateway" /> 

답변

0

먼저 없기 때문에 요소 4 Strings, 단일 연결 문자열 :

@Payload("#args[0] + #args[1] + #args[2] + #args[3]") 

또 다른 우려 사항입니다.

<int-ws:outbound-gateway>은 웹 서비스 SOAP입니다. 따라서 XML. 오른쪽 JaxB는 XML을 생성하지만 단순 문자열이 아닌 도메인 엔티티에 해당합니다.

문자열 payload으로 JaxB를 건너 뛸 수 있지만 실제로는 <soap:body> 콘텐츠를 나타내는 XML이어야합니다.