Kuga,

If you are yourself defining the webservice, then you can use tools like java2wsdl (or similar) to generate the service and then use wsdl2java to generate the client classes based on that service. I did that years ago, and it works ok.

If you don't have control over the webservice:

* You can't just change the WSDL to make it map to the POJO you want. The best you can do with changing the WSDL is to do what I did to make small changes to the WSDL (like removing certain unused parts of it if they cause conflicts during the client code generation) although it is much better to not have to do that if possible.

* OR You can just write classes that translate the POJOs autogenerated by wsdl2java (or similar ant task/maven 2 plugin) into your own POJOs. This is what I've done, because it gives greatest control, but it can be time-intensive, and over the long-term, it can take a while to maintain, so I strongly recommend just using the POJOs that are autogenerated if possible.

* OR You can use a tool like Dozer ( http://sourceforge.net/projects/dozer ) to map the autogenerated POJOs to your custom POJOs. I can't provide anymore info than this, because I wasn't a fan of the XML config- I'd much prefer annotations, but I don't' *think* Dozer supports that yet.

* OR You could basically write your own bean mapping tool that could work with CXF, but that would probably take ages to write.

I don't know of any other info that could help you at the moment though.

cc:'ing the cxf users list - if you're not a member of that list you should join and get in the conversation there.

Hope this helps,

Gary


Kugaprakash Visagamani wrote:

Hi Gary,

I am registered member in the CXF Nabble forum, and had posted a question/issue that I have last week, but haven’t gotten any response.

After looking at your question “mapping from complex response objects to custom value objects - is it worth it? what is the clearest/easiest/most” felt that you may be able to help me with my issue.

Any help is *HIGHLY* appreciated.

Here is the issue:

We have several existing Java POJO classes in client side.

Now we are planning to use the WSDL, as such we have defined the WSDL definition, based on server side schema, and then generated Java objects. I would not be able to just use these generated classes in the client side instead of my POJO, as some of the POJO has some business logic also involved in them.

As such can I use my POJO instead of the WSDL generated Java objects. Where do we need to add these mappings in the WSDL file.

Thanks for the help.

Best Regards

Kuga



--
Gary Weaver
Internet Framework Services
Office of Information Technology
Duke University

Reply via email to