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.
Related
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.
My messaging provider gives me two different kinds of WSDLs to use.
http://my.amazonaws.com:8000/webservice/?wsdl
http://my.amazonaws.com:8000/webservice/?singleWsdl
The first one is an embedded WSDL. Can NOT use it to generate WSDL2java packages and
can NOT use JAX-WS to create a connection.
The second one is a single WSDL. It can generate Java packages with CXF 3.0's WSDL2java and can use JAX-WS to create a connection. It works very well.
Please let me know what is the difference between these two kinds of WSDLs.
Without knowing what those links return we can only guess, but here are some details that might help you....
Suffixing the web service endpoint with ?wsdl get's you a WSDL file. The WSDL can be generated by the framework at runtime based on the web service skeleton code or can be an actual physical file that the server just sends back when the URL parameter is specified.
The WSDL contains an XML Schema that can be specified either inside the WSDL itself or as separate files that are imported by the WSDL. And now a problem occurs...
Some web service stub generators can only handle a full WSDL, with the Schema inside. If the WSDL imports other files the tools can't resolve the imports and fails. This made web services hard to consume because clients had issues creating stubs to interact with the web service. So much so that service providers either used an actual WSDL to respond to the ?wsdl request or started writing all sorts of hacks and plugins to make the web service generate the full WSDL.
But some providers didn't even bother so clients had to write the hacks to parse the WSDL or they had to download all files, assemble them manually into a single file and use that instead.
With time people recognized this as a problem and frameworks adapted to provide the full WSDL, not one with imports. But this generated another problem. Changing what the ?wsdl URL returned could break all those hacks created around it to fix the import problem. For this reason another convention was chosen to return the full WSDL: ?singleWsdl.
So there are frameworks that generate a full WSDL, some that generate it with imports, some allow you to specify an actual physical file, some that support the ?singleWsdl convention, some that don't. Not relevant to this question, but just for completion, there is also a ?wsdl2 convention that get's you a WSDL 2.0 definition (?wsdl get you a WSDL 1.1). Some frameworks support ?wsdl2, some don't.
My guess is the issues you have are caused by Schema imports, but without the WSDLs themselves I can't tell. Hope at least that these details help you better identify the problem.
I am implementing new authentication methods for WSO2 Carbon. I know there is a pretty good explanation and sample piece of code in this post.
The problem is, what if I want to generate stub and service client components from the sample BE authenticator? What are the steps to follow? Any tools (java2wsdl / wsdl2java, maven plugins,...) or reference tutorial that can help to achieve this in the most straightforward way?
I know there are several existing authenticators (IWA, webseal,...), but they already come with some stub/ui built in the existing repositories. I would be rather interested in being able to develop/generate all the components more or less from scratch rather than having to modify existing code, which is often prone to errors.
Thanks
This is some high level thing.. but hope this is useful.
1st you can develop the BE component as OSGI bundle. Then you can deploy it in /repository/components/dropins directory. Here you need to have a service.xml file to expose as web service (Please refer WebSeal BE component)
Then configure following property in the carbon.xml file.. if BE service has been defined as admin service
true
Open browser and locate your WSDL of new service
https://{ip}:{port}/services/{service name}.wsdl
Then use wsdl2java tool to create the stub class for you. There is a UI tool in WSO2AS product to do it.
Use stub as a dependency for your FE
I have a project where I have kept web service in two separate package. One package contain customer face web services and another contains in house usage web services. I want jersey to only scan the customer facing package and generate WADL.
In general I was not able to find any way to split wadl generation logic by configuration. But here is hack you can perform. There is class called GenerateWadlTask.java This basically does the wadl generation logic for jersey. You can just extend this class in your custom application wadl generation task and use it as per your logic. For code example just download the jersey server source jar and look at the class. The logic is pretty straight forward.
hope this help.
EDIT:- There is a maven plugin called enunicate http://enunciate.codehaus.org/
That will make your life easy.
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".