I try to build a CXF-based client application for an existing web-service using 'Contract-First' pattern.
The XSDs are quite complex so I am looking for a way to utilize something like SDO, avoiding code-generation for a WSDL. WSDL2Java tool makes 20K-line classes.
I have already used SDO in IBM WebSphere ESB, I wish I could reuse my previous code.
I can't find a way of doing this with CXF,
only this: http://cxf.apache.org/docs/sdo.html.
The text regarding SDO seems to be outdated because WSDL2Java tool does not support a "-db sdo" parameter anymore.
It says:
WSDL2Java -o D:/wsdl2java_out -d sdo -uri WS.wsdl
...
Caused by: org.apache.axis2.wsdl.codegen.CodeGenerationException: No proper databinding has taken place
You are using the Axis2 wsdl2java command and not the CXF wsdl2java.
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.
I've just generated the java source files to build a Web Service client, using the wsimport of jdk1.7.
wsimport -keep /path/to/wsdl
For make the SOAP request I used the clasess under generated folder. Everything went ok, with a response 200 :)
But then, I wanted to use (for ... 'fun') CXF (v.2.7) wsdl2java tool to make exactly the same, but using this tool it doesn't generate the classes needed for the SOAP Request, it doesn't create the generated folder either.
wsdl2java -keep -verbose /path/to/wsdl
Also I notice that the class ObjectFactory that the tools create by its own, are different. Using wsdl2java creates a much short file.
So, why are those tools generating different results ??
I dont clearly understand the difference about this two, can u help me ??
The wsdl used is importing xsd files, that have a well-know problem, which I've resolved thanks to this blog entry
here
Thanks for your answer
I have a wsdl file. And I wish to create web service from this wsdl file via Grails.
Can anyone help me?
For starters, it's "Grails", not "Groovy on Grails". See http://burtbeckwith.com/blog/?p=1213
The cxf-client plugin uses Apache CXF and has a ton of features. It's easy to use and has a wsdl2java script that you can use to generate client code.
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.
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".