Reputation: 81
HI, I have webservices calling one another using jaxws. The problem is that I pass around compex object, classes. And each time I get the object belongs to another package (proxy1.jaxs.myClass...) so i have to write converts forth and back. is there a simple way to convert between the proxy object, to origanl object or another proxy object? thanks, hope i explained myself.
Upvotes: 3
Views: 859
Reputation: 1714
I guess that you want to reuse you own Java Bean in client instead of using artifacts generated by JAX-WS/JAX-B.
The solution is to specify to JAX-B that you want to use specific classes for bean representation. Look at JAX-B Bindings, solution should look like:
<jxb:bindings schemaLocation="YourService_schema1.xsd" node="/xs:schema">
<jxb:bindings node="//xs:complexType[@name='yourType']">
<jxb:class ref="com.myoriginalpackage.YourType">
</jxb:class>
</jxb:bindings>
There are other samples for handling specific Java types on this page: http://confluence.highsource.org/display/HJ3/Apache+CXF+Tutorial+-+Building+JAX-WS,+JAXB+and+JPA-based+web+service+with+Apache+CXF,+Spring+and+Hyperjaxb3
Upvotes: 1
Reputation: 340933
Dozer is pretty good, if the classes are similar, you can even get away without complex XML configuration. But keep in mind that you will have to unit test Dozer mapping, as it works with reflection and you must be sure all the fields are properly mapped.
XSLT - if you only pass objects around without any logic, maybe a simple transformation working on the SOAP XML level will do the trick?
Upvotes: 1