Spring-WS 1.5 を使用しています。spring-servlet.xml に次の構成があります。
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.test.mypackage"/>
<bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
<constructor-arg ref="jaxbmarshaller"/>
</bean>
<bean id="jaxbmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
<value>com.test.myclass1</value>
<value>com.test.myclass2</value>
</list>
</property>
</bean>
<bean id="endpointMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
<property name="interceptors">
<list>
<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
</list>
</property>
</bean>
</beans>
「GenericMarshallingMethodEndpointAdapter」は、この構成でリクエストをアンマーシャリングし、レスポンスをマーシャリングしており、期待どおりに動作しています。ただし、エンドポイント メソッド ハンドラー内でリクエストをマーシャリングし、マーシャラーにアクセスしたいと考えています。マーシャラーにアクセスするにはどうすればよいですか。GenericMarshallingMethodEndpointAdapter に提供されたものにアクセスできますか?
@Endpoint
public class MyEndpoint {
private static final String NAMESPACE_URI = "http://www.test.org/9";
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "RequestData")
public JAXBElement<ResponseType> myEndpointHandler(JAXBElement<RequestType> request) {
/* how do I access the marshaller here to marshal the request */
}
}