I have been using JiBX with Spring WS for a couple of years now. Here is a simple example (I typed this in TextPad, so there may be a few typos):
Spring config:
Code:
<bean id="fooEndpoint" class="com.foo.FooEndpoint">
<constructor-arg ref="fooResponseMarshaller" />
<constructor-arg ref="fooRequestUnmarshaller" />
</bean>
<bean id="fooResponseMarshaller" class="org.springframework.oxm.jibx.JibxMarshaller">
<property name="bindingName" value="JiBXbindingFoo" /
<property name="targetClass" value="com.foo.FooResponse" />
</bean>
<bean id="fooRequestUnmarshaller" class="org.springframework.oxm.jibx.JibxMarshaller">
<property name="bindingName" value="JiBXbindingFoo" /
property name="targetClass" value="com.foo.FooRequest" />
</bean>
FooEndpoint extends org.springframework.ws.server.endpoint.AbstractMar shallingPayloadEndpoint
Code:
package com.foo;
import org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint;
public class FooEndpoint extends AbstractMarshallingPayloadEndpoint {
@Override
protected Object invokeInternal(Object requestObject) throws Exception {
FooRequest fooRequest = (FooRequest) requestObject;
FooResponse fooResponse = new FooResponse();
fooResponse.setResponse(fooRequest.getRequest());
return fooResponse;
}
Code:
public class FooRequest {
private String request;
public String getRequest() {
return request;
}
public void setRequest(String request) {
return request;
}
}
Code:
public class FooResponse {
private String response;
public String getResponse() {
return response;
}
public void setResponse(String response) {
return response;
}
}
JiBX binding file: (jibx-binding.xml, for example)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<binding name="JiBXbindingFoo">
<mapping name="FooRequest" class="com.foo.FooRequest" ordered="true">
<property name="request" field="request" />
</mapping>
<mapping name="FooResponse" class="com.foo.FooResponse" ordered="true">
<property name="response" field="response" />
</mapping>
</binding>
Note, if you use Eclipse and test with an embedded Tomcat server, you will need to add a Builder to your workspace so that every time you do a clean, the JiBX binding compiler will run automatically. If you use Maven, then this is easy to do. If interested I can post this as well
Hope this helps
Alan