스프링 통합과 함께 Jaxb2Marshaller
을 사용하고 있습니다. 나는 인바운드 게이트웨이 웹 서비스를 가지고 있는데, 누군가 그것을 호출하면 자동으로 JAXB 생성 클래스로 구문 분석 할 것이다.Spring Integration 웹 서비스 - Jaxb2Marshaller - 어떻게 SAX Parser를 사용할 수 있습니까?
그러나 소스로 디버깅 할 때 DOM을 사용하여 Jaxb2Marshaller
이 표시됩니다. SAX를 사용하여 XML 데이터를 Java 객체에 바인딩하는 것으로 생각했지만 SAX가 빠릅니다. 왜 Jaxb2Marshaller
가 DOM을 사용합니까? 어떻게하면 SAX를 사용하도록 구성 할 수 있습니까?
Unmarshaller에 체크로
자료의 인스턴스를 필요로한다. 메시지 페이로드가 소스의 인스턴스가 아니면 변환이 시도됩니다. 현재 String, File 및 org.w3c.dom.Document 페이로드는 입니다. Source에 대한 사용자 정의 변환은 SourceFactory의 구현을 주입하여 지원됩니다. SourceFactory가 UnmarshallingTransformer의 속성은 기본적으로 은
SourceFactory
에 대한 DomSourceFactory로 설정됩니다 명시 적으로 설정되지 않은 경우 주 우리는 그것을, 그것은 단지 현재 볼 수 DomSourceFactory
및 StringSourceFactory
입니다. SaxSourceFactory
은 없습니다.
SAX를 Jaxb2Marshaller
과 함께 사용할 수 없으므로, 맞습니까?
미래에 SaxSourceFactory
이 될 예정입니까? 아니면 절대? 내가 Jaxb2Marshaller
을 확인할 때
이상한 것은, 내가 코드가 이미 SAX에게
XMLReader xmlReader = null;
InputSource inputSource = null;
if (source instanceof SAXSource) {
SAXSource saxSource = (SAXSource) source;
xmlReader = saxSource.getXMLReader();
inputSource = saxSource.getInputSource();
}
else if (source instanceof StreamSource) {
StreamSource streamSource = (StreamSource) source;
if (streamSource.getInputStream() != null) {
inputSource = new InputSource(streamSource.getInputStream());
}
else if (streamSource.getReader() != null) {
inputSource = new InputSource(streamSource.getReader());
}
else {
inputSource = new InputSource(streamSource.getSystemId());
}
}
을 처리 참조, 내가 SAX와 JAXB와 함께 봄의 통합 웹 서비스를 사용하여 구성 할 수있는 마지막 질문은? 내가 놓친 게 있니?
여기 내 구성입니다 :
<ws:inbound-gateway id="inbound-gateway" request-channel="RequestChannel" reply-channel="ResponseChannel"
marshaller="marshaller" unmarshaller="marshaller" />
<int:channel id="RequestChannel" />
<int:channel id="ResponseChannel" />
<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="contextPath" value="com.example.webservice.api"/>
</bean>
이 이름 MessageDispatcherServlet.DEFAULT_MESSAGE_FACTORY_BEAN_NAME
으로 AxiomSoapMessageFactory
콩을 구성,
@lexicore 당신이 :-)에 나를 도울 수 –
색소폰 빨리하지 않습니다 .. . 색소폰은 종종 사용자 정의 구현에 필요한 모든 추가 응용 프로그램 논리 때문에 느립니다. –
오해가있는 것 같습니다. 당신은''를 보여 주지만'UnmarshallingTransformer'에 대해서 이야기합니다. 첫 번째 것은 Spring WS'MarshallingUtils.unmarshal()'에 완전히 위임 됨 –