This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
We are developing a solution to a client which is going to be deployed in JBoss 4.2.2 on Java6. The solution has to deliver certain messages to the clients legacy systems by invoking a webservice. So far all I have got from them are the wsdl and some xsd.
So far I have created a project which is going to host the webservice locally. Just a dummy one returning dummy data. I used the wsimport tool to generate the java code for me server side. All I did was to write an implementation class. All that works fine and is deployed to JBoss.
My struggle is the client side. When I use the wsimport tool and point to a local wsdl file (c:\projects.......Service.wsdl), the generated code has a lot of references to this file (c:\projects.......Service.wsdl). When I run a test it fails because it points to some local file system stuff and not the one deployed in JBoss.
I could of course point to the wsdl deployed in JBoss (http://localhost:8080......Service?wsdl) when I run wsimport but that only helps me when I run the stuff locally. What to do when you deploy it to the client? Then the hostname will change for sure.
What is recommended way of handling this. Should you run wsimport with the clients hostname and wsdl path?
Yes, either you run wsimport using the URL of the deployed web service. However, you may still have problems if you move the service, in which case you will have to regenerate or edit the generated artifacts.
Another solution is to use the Oasis XML Catalog facility that is mandated by the JAX-WS specification. See section 4.4 in the JAX-WS 2.1 specification document.
This way you can map the URIs of your WSDL(s) and XML schema(s) and if you change the location of the service, you do not have to regenerate artifacts but only edit the catalog file.
Joined: May 18, 2009
Thanks a lot for your answer. I'm still a bit confused though. I read the specification and I don't think I understand it. Can you perhaps explain it in more detail or post a link with an example regarding the Oasis catalog. Haven't been able to find that much on the topic.
So far though I have managed to solve my problem by using a BindingProvider
String endpointURL = "configurable path to webservice";
BindingProvider bp = (BindingProvider)client;
I pass on the "wsdlLocation" parameter to wsimport pointing to the wsdl which I ship in the jar (wsdlLocation="xsd/webservice.wsdl"). notice the relative path. Of course, this is only possible if you have a copy of the wsdl.
I'm still very interested in learning more about the Oasis XML Catalog so I hope you can fill me in.
Joined: Oct 04, 2006
I have wanted to write up an example myself for some time now, but so far, I haven't had time
I guess you already found some webpages yourself - this was the best one I could find doing a quick search:
http://xerces.apache.org/xerces2-j/faq-xcatalogs.html I'll get back if I run into something useful for you.
Note that, according to section 4.4 of the JAX-WS 2.1 specification, this mechanism is already implemented in JAX-WS so you only need to supply an XML Catalog file in order to use this mechanism.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Best practices regarding client code generation to a third party webservice and deployment issues