How to handle rpc/literal webservice with JAXB2 and Spring-WS - web-services

We need to access a legacy webservice that uses the RPC/literal webservice style and also to provide webservice endpoints for it. If you use webservices of document/literal style with Spring WebserviceTemplates / WebserviceEndpoints, you can use JAXB2 to generate / marshal / unmarshal the webservice requests. But how do you do this with RPC/literal style? The org.jvnet.jaxb2.maven2:maven-jaxb2-plugin does not seem to be able to generate Java classes for the requests / responses.

With rpc/literal you will be stuck in the dark ages of Axis 1.4
Spring-WS or Jax-WS won't help you here as the concentrate on WS-I Basic Profile compliant document/literal services.

Related

how to return RESTFUL response from a JAX-WS WebService

I have a JAX-WS WebService running and I want to add a RESTFUL method in it to return HTTP response, without writing a new service.
Is there any way to do it?
Thanks a lot
JAX-WS is an API for SOAP Webservices, with are based on XML transmission of information, not some data over http - the REST way.
What is your services stack? Metro, axis2?
If you use CXF it provides you the possibility to serve both kinds.
Also you may join the two technologies in the same application.

Common framework for POST over HTTP and SOAP over HTTP webservices

We have a bunch of services that support Post over HTTP similar to normal web app processing where in a form is sent via post and also SOAP over HTTP via the IBM soap gateway, our design is slightly messy today as we had combined a lot of processing logic tied to the transport protocol where we parse the XML contents via DOM parser and have seperate classes for Post and SOAP over HTTP, etc. We want to streamline this such that we have a common service class independent of transport that serves for both SOAP and POST over HTTP. I did find that Apache CXF supports both JAX-RS and JAX-WS via single service class. Does this mean I can use the JAX-RS similar to Form posting over HTTP and JAX-WS for the SOAP. The idea is we don't want to change any of the existing consumers client code and just stream line at the provider end. Any suggestion to this regard is welcome. Thanks.

Axis2 Web services

can anyone please explain axis2 web service.
Is axis2 SOAP or REST??
Its very confusing. In REST it support multiple formats.
But SOAP supports only a XML Formats.
From apache axis2 web site
Apache Axis2™ is a Web Services / SOAP / WSDL engine, the successor to
the widely used Apache Axis SOAP stack.
By the way you can use RESTful with apache axis2.

regarding webservices

I've started learning about webservices recently. Have few question about that:
For webservice, is it always necessary that source should provide wsdl or any other way possible to consume it without needing wsdl?
Till a while ago, I was doing server side XMLhttp post in classic ASP to do modifications in external application & to push data in my application from external application. I'm confused - is that very different from webservice or can be called a sort of webservice(ofcourse without based on SOAP). Any major difference or it is just protocol difference bw webservice and server side XMLhttp post?
Web services can be made asynchronous?(Something like AJAX call through javascript)
Are there any different types of webservices ? (for e.g is there difference bw, webservice providing stock quotes and webservice provided by google)
1.For webservice, is it always necessary that source should provide wsdl or any other way possible to consume it without needing wsdl?
WSDL is a document that publishes an interface. As long as a client complies to the inteface, it is guaranteed to be able to "talk" to the web service. Having said that WSDL is a formal way for a specification when there are many stakeholders. You can proceed without one, as long as you somehow know what the web service expects. Just wrap the application data in a SOAP envelope and send it to the web service. As long as you send what the web service expects (in the SOAP envelope or the application data) and in the way they are expected e.g. transport HTTP etc. it does not matter for the WS if you have used a WSDL or not.
2.Till a while ago, I was doing server side XMLhttp post in classic ASP to do modifications in external application & to push data in my
application from external application. I'm confused - is that very
different from webservice or can be called a sort of
webservice(ofcourse without based on SOAP). Any major difference or it
is just protocol difference bw webservice and server side XMLhttp
post?
In very simple terms web service is XML over some application protocol (usually HTTP). Could be SOAP based or REST. To understand more on this you should read about Service Oriented Applications
3.Web services can be made asynchronous?(Something like AJAX call through javascript)
They could but it is more complicated than that.
4.Are there any different types of webservices ? (for e.g is there difference bw, webservice providing stock quotes and webservice
provided by google)
Not sure what you ask here. Each web service offers something.
I will try to be very simple here:
The W3C defines a "Web service" as "a software system designed to
support interoperable machine-to-machine interaction over a network".
That means first requisite for any software to be web-service is that it should not depend upon platform or software i.e a web service made on java stack can be consumed by client in .net stack on windows or java stack on android.
If your server side implementation XMLhttp post suffice this ,its a
web service.
Types of Web services
Actually, there is no overall and clear categorization on types of web services. But two most popular are :
SOAP based web services. :It use XML messages that follow the Simple Object Access Protocol (SOAP) standard, an XML language defining a message architecture and message formats(WSDL).
REST based web services. With evolution of WEb 2.0 emphasis has been moving away from SOAP based services towards representational state transfer (REST) based communications.[3] REST services do not require XML, SOAP, or WSDL service-API definitions.Read here to get a easy explanation of REST
Need of WSDL to consume SOAP web services?
To consume a SOAP service we only require SOAP endpoint and XML message format. WSDL is a pre-requisite for automatic client side code generation through Java and .NET SOAP frameworks.
Asynchronous web services
Making web services asynchronous is possible.But complexity depends upon frameworks used, for example AXIS2 in JAVA has easy implementation of this.

Consume Java CXF WS exposed over SOAP from ServiceStack client

Context:
I'd like to use ServiceStack to build a SOAP client in order to consume an existing Java CXF WebService, exposed over SOAP with defined WSDL (I have no control over the WS itself). I may need to add a couple of extra headers the SOAP envelope for authorization purposes.
Question:
Would all of the above be possible, and if so, what are the gotchas? If there are any specific examples, links would be welcome.
Actually the other way round of having other clients consuming ServiceStack web services would make more sense.
Using ServiceStack to consume other clients is not an ideal strategy. ServiceStack server and client supports a coarse-grained, DTO-first approach, it wouldn't handle variations in this theme that other frameworks spit out.