what are the advantages of using maven to generate a WS client from a WSDL? - web-services

My WSDL contains 20 web services and I have to generate a WS client to invoke those web services.
I started with wsdl2java to generate the sub then I developed the JSP files and servlets and it seems to work, I am using Axis2 with Tomcat 7 on Eclipse, but many developers use Maven to do the work so I wonder what are the advantages of using Maven to create the client ?
I am a newbie so can you please explain to me this point in a level that I can understand.

Maven itself won't do it for you, it may only be used to trigger generate code for you. So it does not matter whether you use ant or maven or gradle from command line or within eclipse - in the end you always call the same mechanism to generate the portable artifacts from the WSDL.

Related

Have WSDL, need to generate services (step by step instructions)

Any documentation on creating a service and deploy to JBoss from WSDL? I have found several on the net, struggling to choose the correct/optimal approach. Using spring is also okay.
I have created WSDL from eclipse based on my requirements. Now, How do i generate request/response from WSDL? and then stubs. I also can use Intellij if it simplifies things.
I did generate a service, but i had to strip out so many jar files (jboss related) from my ear file before deploying to make it work. Any help generating ear file will be helpful too.
JDK 1.6; JBoss 5.1; Eclipse Indigo or Intellij Idea (11.1.4)
I know this question has been asked several times, but as i mentioned tons of information on the web, getting confused with several approaches.
If you are using Maven, you can use the jaxws-maven-plugin to generate artifacts. You can find a simple maven project for generating artifacts from a WSDL, here (wsimport)
Step-by-step:
Generate Java artifacts from your WSDL. (Use wsimport tool or Maven plugin)
Implement the generated Service Endpoint Interface.
Deploy.
If you want to start with Spring-WS, the obvious starting point is the documentation. You probably want to use a marshalling framework like JAXB to generate classes based on your WSDL. Based on those classes you can create #Endpoint annotated classes. In such an endpoint, you can create methods which are annotated with #PayloadRoot and #RequestPayLoad - based on that combination it will be mapped to a specific operation in the WSDL. Check out this page in the documentation for more information on annotating methods.

consuming wsdl in spring mvc

My IDE set up is
Eclipse Indigo
Spring IDE for indigo
Spring STS for indigo
maven integration for eclipse
maven integration for eclipse wtp
Created a sample spring mvc project and performed maven clean and maven build.
I have a wsdl from client which i have included in a project that uses cxf-wsdl2java to generate the proxy code. Not sure if this is the right way to approach this. The web service is on 'axis'
Looking for tutorial on how to consume the wsdl and make the method calls in spring mvc project using maven. also is cxf the right way to approach this? particularly the wsdl2java approach
It is usually a good practice to use the wsdl2java with maven (except that I would have not copied the wsdl inside the resources, but I would have kept it on the distant server). As this if the wsdl change, you will ne notified directly with your build.
For your client, just configure your endpoint. see the 'Configuring a Spring Client' doc from cxf : http://cxf.apache.org/docs/jax-ws-configuration.html
You might want to look into the Spring Web Service project found here:
http://static.springsource.org/spring-ws/site/
Ihere is a tutorial (located here: http://static.springsource.org/spring-ws/site/reference/html/tutorial.html) on their website which goes through both creating a contract first web service, as well as a consumer of that web service.
Hope this helps!

Webservice, Axis & OSGI (knopflerfish)

I first warn you because I'm a beginner. So, I don't know if I'll be specific on all points. Here is my problem:
I have a wsdl file. Currently, I use Tomcat and Axis to deploy it. So for that, I use the wsdl2java tool of axis that generates me the "skeleton" of the webservice. And then I write on the generated files the code of the various methods of the webservice. Finally, I deploy the webservice on tomcat with Axis. Everything seems to work more or less.
The problem is that I want to deploy this webservice using the bundle axis of osgi (knopflerfish). But I don't know how to do it.
Should we use again the wsdl file and generate a code with a tool like wsdl2java but adapted to knopflerfish? or should I use the "skeleton" that I've created before with Axis and adapte it for osgi? And generally speaking, how can we use the axis bundle of knopflerfish?
To be honest, I do not find many things over internet about it. So that's why I write to the community :(
Thank you in advance for your help.
Found a article on http://www.ibm.com/developerworks/webservices/library/ws-OSGi/ for deploying a Webservice as OSGI bundles. This uses Eclipse Equinox as the OSGi container and Apache CXF as a web services framework and its deployed in Apache Servlet Container.Hope this meets requirement of depolying Webservices as OSGI service .

Create SOAP webservice starting from WSDL using Groovy?

We have a wsdl for which we need to create a server implementation. In previous projects we used wsdl2java from Apache CXF, but now we want to keep it all in Groovy. Is there a way in which we can create a server implementation and keep it all in Groovy? Or are there any other ways we can achieve this?
The ultimate goal would be that we can hook this implementation into a Grails application that will serve as the server for clients.
Yes. You can either use the plugin or use cxf directly.
If you follow that tutorial, you can always use wsdl2java and just rename the generated files to be .groovy files and update the syntax to be more groovified. They will still work like normal. Also, as you may or may not know, you don't have to copy the jars directly to your lib directory as it says in the tutorial, you can just use normal Grails dependency management.
I think a better fit for you would be Groovy WS Lite. Spring-ws is also an option, it is a powerful library and reasonably well documented, since grails is spring at the end of day, this may integrate very well with grails. Shameless plug: This is web service integration testing tool I created which uses groovy and spring-ws. You can see the code to get a "working example".

Using Axis to generate a web service implementation that calls another web service

I need to provide an implementation of a web service for which I have the WSDL, to run under Weblogic 9.2.
I aim to use the Axis (1, not 2) tools for this , having tried and failed to make it work with thw weblogic web service generation tools (due to an inability to set the authentication - see my other question here),
This web service needs to make calls to another web service (for which I also have the WSDL).
I can use the Axis tools to generate the client stubs etc.
But how do I do the two in combination? Is there a tutorial or other step by step guide? I have googled and found some mailing list postings, but they're about specific issues.
If someone's done it, could they share the relevant parts of their build.xml for this?
If I used the weblogic web service generation tools, there's a tool that in one go generates the skeleton implementation of the web service and the client stubs for the web service it calls - is there something similar in Axis?
Any gotchas if I just try to mash up the skeleton and client generation output from WSDL2Java?
Update:
Got this to work.
Used the Eclipse tools to build the client, then the service, allowing the second to overwrite the duplicate files from the first. We then had some issues with the client_deploy.wsdd file (see my other question How do I refer to a client_deploy.wsdd file that's in WEB-INF?) and with jar versions (needed to update the jars that Axis uses to newer version), then it just worked.
Speaking for axis2, you can create the client stub like this (I reckon axis1 is not much different):
/wsdl2java.sh -uri webservice.wsdl -p com.your.client.package -d adb -s -o output_folder_client
Once you have the client package you should be able to use it in your own webservice implementation by just importing it, creating a client instance and submitting requests.