I wanted to clear something about Asynchronous Webservices.
I read that weblogic give you the ability to create Asynchronous Webservices.
but I also read that it's only supported as log as the client and the server of the webservice both working under Weblogic container.
Is that true?
is it possible to create Asynchronous Webservices without having the need to have the same system(weblogic, jboss) both at client adn server side?
In case it's possible I would like to get details how is it working..
thanks,
ray.
Neither WS-Addressing nor Weblogic have anything to do with enabling async services. See the Asynchronous Client documentation for JAX-WS. There are two basic approaches supported: Static stubs and the Dispatch API. Static stubs require the use of customizations and will result in additional methods being added to the service endpoint interface. These methods expose both polling and callback functionality for async invocation.
I understood that I can invoke async webservice as long as both the server and the client supports: WS-Addressing specification.
ray.
Related
I'm read official oracle tutorial, but dont understand this full. I'm glad if we answer my questions.
Question 1. What's conceptual difference between JAX-WS Web Service and RMI? Both RMI and JAX-WS can invoke remote method.
Question 2. Why we cant use servlets only for the features, that can be implemented by JAX-WS? Just declare init servlet's methods.
Question 3. As i understand, web service JAX-WS can't get http response and http request whithout servlets, for example. It's just set of endpoints classes, whose contains WebMethods with their implementation. I.e. if we want to communicated with service through web-client we must declare appropriate servlet for this needs. This servlet will parse http request, invoke appropriate #WebMethod generate and sent http response. Is it correct?
Question 4. Is WSDL document just xml-file whose contain description availabl #WebMethod by this WEbService and all?
Question 5. From the official tutorial:
A client creates a proxy (a local object representing the service) and then simply invokes methods on the proxy.
Does client create a proxy based on service's WSDL-document?
My take on the answers in order:
RMI invokes methods of remote Java objects directly from objects in other Java virtual machines and uses object serialization to marshal and unmarshal parameters. Notice how all of this is Java-specific. JAX-WS is about a Java API for leveraging standards (SOAP, WSDL, etc) to facilitate broader interoperability instead. As a result, applications of all kinds can talk to each other--not just Java to Java.
With JAX-WS, you are using servlets. It's just that the specification provides an abstraction on top of the Servlet API. It is always better to work with abstractions than with low-level implementation details. This frees you up to work on the interesting stuff and helps you avoid mistakes.
I don't quite follow this question, but HttpServlet is the Java EE abstraction for all HTTP communication. So JAX-WS, JAX-RS, and other specifications rely on HttpServlet. You don't have to specify the servlets or anything. That's one of the many low-level details the abstractions free you from.
WSDL is a standard that transcends platform or implementation. In other words, it has no idea about #WebMethod or any other implementation-specific details. It just defines the interface for interacting with the service.
Yes. WSDL's aren't meant to be consumed by humans. They define the interface for interacting with the service, and clients (Java, .NET, whatever) use these to auto-generate stubs for you to use to call the services defined in the WSDL. The client generates the SOAP request for you and processes the SOAP response for you.
I have a website that is that is architected using an n-layer approach. The problem I have is that I need the client to make a call to the application layer, one of the other layers will then make a call to another web service somewhere in the world. The other web service could take some time to come back so what I would like to do, if possible, something along the lines of the following using async requests:
The client is HTML & JavaScript, the server layers are written in C# (.NET 4.5), the 3rd party web services are just web services I need to consume
How would you go about writing this?
Any help will be much appreciated
It doesn't look like the server-side code needs to call the external service asynchronously. I'm not seeing an advantage in doing that.
The client-side code would call the server-side code asynchronously, of course. (An AJAX request, using jQuery for example.) And it would await the response form that service in an asynchronous manner before handling that response. But since the server-side code in this request is only serving that one request, it can do so synchronously.
Indeed, if the server-side code were itself also asynchronous then it would return control to the client-side code immediately before it has anything useful to give it. Which means the client-side asynchronous handler can't do anything. Instead, when the server-side code gets a response from the external service, it would need to push that response to the client-side code. Which is possible with websockets and whatnot, but probably a lot more complex than this situation requires.
Only the first link in the chain needs to be asynchronous in order to provide the user experience of asynchronicity, the rest of the system doesn't need to be.
Whenever you have a "client/server" boundary, you have the option of making the server asynchronous as well as the option of making the client asynchronous. Those decisions are independent.
I'll make the assumption that your third-party webservice is scalable, or that your server has other things to do besides just this one request. In that case, I'd recommend that your server be asynchronous.
Asynchronous programming is natural with async/await in ASP.NET 4.5. Depending on your third-party service, you may want to use HttpClient or the async-compatible WCF or webservice proxies. Both ASP.NET MVC and WebAPI support asynchronous calls for your service.
On the client side, you have no choice; JavaScript in the browser must be asynchronous.
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.
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.
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.