Which feature make one to use Spring WS over JAX-WS - java

For SOAP Based Web Services, why one should choose Spring WS over JAX-WS.
I had gone through some article even Spring WS doc feature but still I am not clear.
If I need to convince someone to use Spring WS I can't.
So I want the difference in simple terms that any Web Service Developer can understand.
Thanks in advance.

I am not going into the details of JAX-WS versus Spring-WS.
You might want to refer to the link here for details on that and google it.
From my personal experience :
Spring-WS Advantages over JaxWS
You want to use a databinding other than JAXB (JibX, Castor or
others)
You want extreme fine grained control on the endpoint mapping strategy
You are choosing a WSDL first approach (though many argue that JAXWS also supports a WSDL first approach, it is generally accepted to be more flexible in spring-ws)
JaxWS over SpringWS
You want to go for a java first approach
You want to make your code flexible (since JAXWS is a specification you can have multiple implementations)
You want to use other annotation driven development of JAX-WS

Related

Web service from WSDL

I want to generate service implementation from WSDL (Top down approach) in Java but I dont want to use any tool. For example If we want to create stubs we can use wsimport.
Please let me know if this is a duplicate question.
Thanks
If you don't want to use any tool to generate code or stubs, maybe you would like to use Spring WebServices. This way you only create an EndPoint able to process WS messages, that is, you only worry about implementing server logic.
With this approach you can define beans to marshalling, using jaxb2 (or another), and the EndPoint brings you functionality to receive not XML payload, but Java Objects instead.
If you don't want to genereta code or stubs, I think Spring WS is nice for you.
If you don't want to use any tool at all, then sorry for my answer, but I believed what you didn't want is to generate code.
Below is the Maven plugins which create Java from WSDL:
Axis :
Axis plugin
CXF
CXF plugin

WSDL to java conversion

I want to convert WSDL file into java classes file.Suggest me the package used for it. I found one that is axis 2.0 .But i want to more packages used to do this job. please suggest me any article where i can find about the comparison related to different-2 packages for their performance.
Thanks
Use wsimport.
I worked on two packages axis 2 and cxf .I used WSDL2JAVA tool for conversion and find that Axis2 is structured modularly, has many features and can be used as an application server for Web Services. A special feature of Axis2 is the support of exchangeable binding frameworks, for example XMLBeans. Axis2 together with the XMLBeans framework is well suited for Web Services which are using very complex schema definitions. The disadvantages of Axis2 are its complexity as well as the insufficient JAX-WS support. Therefore anyone who wants to work with JAX-WS should choose Apache CXF or the reference implementation.
Those who prefer a seamless integration with the Spring framework are well advised with Apache CXF. Furthermore CXF is slim and easy to use. CXF is the tool of choice if a SOAP engine has to be embedded into existing software.
Thanks.

Java Framework for integrating WSDL, REST, etc

At work, we currently have a WSDL interface as well as a semi-RESTful interface that we're looking to expand upon and take it to the next level.
The main application runs using Servlets + JSPs as well as Spring.
The idea is that the REST and WSDL are interfaces for an API that will be designed. These (and potentially other things in future) are simply a method through which clients will be able to integrate with the interface.
I'm wondering if there are any suggestions or recommendations on frameworks / methodologies, etc for implementing that under-lying API or does it make sense simply to create some Spring beans which is called either by WSDL or REST?
Hope that makes sense.
Have a look at Eunicate it is great . You are using spring , Spring has had support of SOAP for a while and Spring 3 has support of REST (Creating and Consuming).
Your approach makes sense. Probably the most important advice is to make the external API layer as thin as possible. You can use Axis, Apache CXF, Jersey, etc. to handle the implementation of the REST or SOAP protocols, but the implementation of those services should just load the passed in data into a common request object, and pass that into a separate service that handles the request and returns a response object which the external API layer will marshall into the correct format for you.
This approach works especially well when you have a competitor providing similar services and you want to make it easy for their customers to switch. You just build a new external API that mirrors the competitors, and simply translates their format to your internal api model and provided your services are functionally equivalent, you're done.
This is a really late response, but I have a different view on this topic. The traditional way as we know it is to unmarshall xml to java and marshall java to xml. However if the wsdl changes then it would effectively be a structural change in the code which would again require a deployment.
Instead of the above approach if we list the fields mentioned in the wsdl in a presistent store, load the mappings in memory and prepare our structures based on these mappings we would have to have many less changes for this..Thus IMO instead of using existing libraries a configurable approach to unmarshalling and marshalling should be taken.

How to generate WADL file?

I wrote RESTful web service using RESTeasy implementation and turn EJB into JSON. And now I'm on the way of development client side.
I'm using Netbeans. How I can generate WADL file? And after I would generated client stub without any problem.
Please, could you suggest me how I can do this? Or maybe you know different easy way.
Thanks a lot!
Artem
Just FYI if you are trying to create a RESTful system, then generating client proxies using WADL will eliminate a significant number of the benefits REST provides.
However, if you are using the term REST as a way to describe a Http API (HAPI) service then go right ahead and use WADL. I'm not saying this to be pedantic about terminology, I just want you to be aware that, if this the case, you are free to ignore all the "it's not RESTful" because you are not trying to do REST, and that's cool.
If you are trying to make a system where the client and server components can evolve independently over the next 5 to 10 years, then maybe REST is right for you in which case WADL is probably not what you want.

How to create documented WSDL using XFire

I use XFire to create a webservice wrapper around my application. XFire provides the webservice interface and WSDL at runtime (or creates them at compile time, don't know exactly).
Many of our customers don't know webservices very well and additionally they simply don't read any external documentation like Javadoc. I know that it's possible to add documentation (for parameters and methods) directly to the WSDL file.
I thought about Annotations or Aegis XML files but I don't know how... Do you know a way?
Edit: I just found this JIRA issue but the last activity was 2006. Any ideas?
XFire is slowly headed for /dev/null. Use CXF instead. In other words, XFire is being deprecated in favor of CXF - it's pretty much the same developers.
Since you use the Java-first approach, I suggest you generate you WSDL once and for all with CXF's java2wsdl tool, then you put your documentation in that and tell CXF to use that documented WSDL instead of letting CXF generate its own (undocumented) WSDL at runtime/deploy-time.
This page has pretty much everything you need to know about creating a web service in CXF.
And my last hint regarding CXF - use Aegis for data binding instead of JAXB. It doesn't work for complex POJO.
In my experience we have no problem with complex POJO and JAXB, the only problem is that the code starts to be cluttered with JAXBElements. On the other hand, Aegis documentation is pretty sparse and not well-maintained with relation to CXF.
Let's me add my two cents regarding XFire. We had very serious issue with XFie under JDK6 (both Tomcat 6.0 and 5.5).Please take a glance at that issue. In our case XFire with 4+ web services under JDK6 leads to hanging application servers (thread deadlocks etc.). It's interesting, but under JDK5 everything was OK.
And I completely agree with Christian Vest regarding migration to CXF from XFire. It has sense in many cases e.g. ESB Mule 2 doesn't support native XFire connectors anymore (see also).
And I wish to add that migration from XFire to CXF is not straitforward way (e.g. CXF has jar dependences that conflict with some hibernate releases see also), but it's doable. In our case we did it for couple days without code correction (Spring only configuration).
And my last hint regarding CXF - use Aegis for data binding instead of JAXB. It doesn't work for complex POJO.

Categories