Hello,
I am having trouble unmarshalling a request using Spring Web Services with JiBX. The error I get is JiBX unmarshalling exception: No unmarshaller for element {namespace}getInfo
The soapUI request looks as follows:
<ns1:getInfo>
<ns2:query>
<ns2:category>
<ns2:type>
...
</ns2:query>
</ns1:getInfo>
As you can see, I've got two root tags but I'm binding only the <query> tag and its inner elements in the JiBX mapping. I believe the
<getInfo> tag should be automatically resolved by Spring-WS as it represents the element mapped on the WSDL operation and the payload bound by JiBX should start at the <query>. I know that Axis and XFire can map the root tag which represents the operation automatically without the need to bind it with Jibx but is it possible to accomplish this with Spring WS?
I was able to fix this problem by binding the <getInfo> element in JiBX but if I do that then I would have to change all the interfaces linked to the
service class and pass a 'wrapper' object request as an argument, which is what I would like to avoid. I am now thinking about writing an interceptor which would intercept the request and remove the root tag on the fly but this may cause some overhead I guess.
Here you have the ws-servlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
<!-- JIBX MARSHALLER/UNMARSHALLER -->
<bean id="marshaller" class="org.springframework.oxm.jibx.JibxMarshaller ">
<description>
The Jibx marshaller is used by the endpoints.
</description>
<property name="targetClass">
<value>com.james.Query</value>
</property>
</bean>
<bean id="unmarshaller" class="org.springframework.oxm.jibx.JibxMarshaller ">
<description>
The Jibx unmarshaller is used by the endpoints.
</description>
<property name="targetClass">
<value>com.james.Response</value>
</property>
</bean>
<!-- ENDPOINT -->
<bean id="myEndPoint" class="com.james.MyEndPoint">
<description>
</description>
<property name="myService" ref="myServiceProxy" />
</bean>
<!-- ENDPOINT MAPPINGS -->
<bean class="org.springframework.ws.server.endpoint.mapp ing.PayloadRootAnnotationMethodEndpointMapping">
<description>
Detects @PayloadRoot annotations on @Endpoint bean methods.
</description>
<property name="interceptors">
<list>
<bean class="org.springframework.ws.server.endpoint.inte rceptor.PayloadLoggingInterceptor"/>
</list>
</property>
<property name="order" value="1"/>
</bean>
<!-- ENDPOINT ADAPTER -->
<bean class="org.springframework...GenericMethodMarshall ingEndpointAdapter">
<description>
This adapter allows for methods that need and returns marshalled jibx objects.
</description>
<constructor-arg ref="marshaller"/>
<constructor-arg ref="unmarshaller"/>
</bean>
<!-- ===================== WSDL DEFINITION ============================== -->
<bean id="myWsdl" class="org.springframework.ws.wsdl.wsdl11.SimpleWs dl11Definition">
<constructor-arg value="/WEB-INF/james.wsdl"/>
</bean>
the endpoint class:
public class MyEndpoint {
private MyService myService;
/* to be placed in interface later on */
private final String GET_INFO_REQUEST = "getInfo";
private final String NAMESPACE = "http://www.james.com/services";
@PayloadRoot(localPart = GET_INFO_REQUEST, namespace = NAMESPACE)
public Response getInfo(Query request) {
...
return response;
}
As for the WSDL and JiBX all seem perfectly mapped except for the getInfo element.
Thanks for any help.


Reply With Quote
) you will not find a single mention of the word "method" or "operation". It's WSDL that introduced this RPC-like model, and Microsoft introduced the wrapped style to turn document/literal into something which can be used for method invocation.
