Asynchronous Web service in Java - web-services

How to create Asynchronous web service in java using eclipse??
I have created a normal web service in Java using eclipse. I am calling an external jar, which is taking long time to complete the process. By that time my web service is getting an exception throwing timed out exception.
In order to over come the problem, decided to create asynchronous web service, but couldn,t find proper details. Please help.

no one responded to the question...
Found tentative solution for this....in order to over come the timed out exception, as soon as the request is received by the web service immediate response a unique id is sent acknowledging the request. A thread is initiated inside the web service for the corresponding request, which will take care of the process and stores the response in a table with a unique id for the request.

Related

Asynchronous Web Service & Web Service without response?

The concept of Asynchronous Web Service is a web service where the client does not have to wait to receive a response from the server. in AJAX this is implemented by having a callback function to process the response. So the server indeed still sends the response to the client.
Is it possible to have an Asynchronous Web Service without response? Is there any platform that provide this?
Thank you.
I have done asynch web services in the past. They are very useful. YOu do not need a detailed response but you at least need an HTTP response, like 200 OK. If the client that makes the request provides some sort of ID or key for that request, then the client can use the same ID/key to later on query for the result/response of the request.
As far as frameworks that provide this, I do not know of any. In the past I would just have a shared memory store, like Memcache, to store the state and result of the request. As long as the state is shared across all nodes, any node can then process the call back request.
EDIT: Providing a key in the request can be done in either REST or SOAP environment. HTTP provides multiple places where a key can be communicated.
GET query param (REST)
HTTP header (SOAP/REST)
Added to the message body of a POST request. This can be done through two ways.
param in the message body (REST)
variable or attribute in serialized object (SOAP/REST))

How to handle SOAP service within persistent Perl web application with cookies?

Due to the fall of SOAP::WSDL which had generated me real Perl modules I have to look for something other in order to handle a SOAP service. The generated modules won't work starting from Perl v5.18.
I have the following situation with my web application.
I have a PSGI compatible, Dancer2 driven, persistent web application.
The web application handles multiple concurrent customers.
The web application is between the customer and an external SOAP service.
The SOAP service uses customer sessions via cookies which have to be integrated on the web application internally for the customer.
The web application holds an WSDL file copy of the SOAP service.
I'm looking for a module that creates an interface out of the WSDL file and handles parameter/schema validation and communication with the SOAP service. I would like to call a method (SOAP call) with parameters (SOAP call parameters) and receive a cleaned data or object structure of the response.
The problem is that the web application needs to handle multiple concurrent customer cookie sessions. So I need a module which offers the possibility to override the cookie jar for that particular request and extract the cookies after the request without causing interference with other concurrent requests.
I found XML::Compile which I can initialize as a singleton at web application start up. But with this solution I ran into problems with interfering other customer requests. So the requests are not separated. Initializing XML::Compile for every request is not the solution either because it will parse the WSDL and generate handlers over and over again for every request the customer sends to the web application.
Is there any solution/module that fits my needs or do I miss something with XML::Compile and it's possible with it?
Are you using Catalyst?
I've been happy using Catalyst::Controller::SOAP and its companion Catalyst::Model::SOAP to build SOAP/WSDL servers and consumers, being able to integrate Perl Applications even with Microsoft Document Literal-Wrapped thing.
Even if not using Catalyst you may probably learn from its code. It uses XML::Compile::WSDL11.

Invoking REST web service in IBM Integration Bus

I am here with a query of how to invoke a REST web service using a message flow in IBM's Integration bus.
My requirement is as follows:
Firstly I have a SOAP web service which I expose. This SOAP web service when gets invoked I want to call another web service which is a REST web service.
I developed two message flows.
The first one (a sample dummy message flow) in which I have a SOAP Input node, a Java Compute node and a SOAP Reply node. In this scenario, when I try to this SOAP web service and pass some Input then I get the same Input which I hope is an expected behavior.
Now the second flow is with a SOAP Input node, a HTTP Request node (for invoking a REST web service) and finally a SOAP Reply node. (3 nodes again in this flow).
I wanted to know if I am correctly implementing the second message flow here. If not, what else I need to add to this message flow so that my thing gets done nicely. If need to add some SOAP extract/envelope node to this flow.
The EXCEPTION I get whilst I try to invoke my SOAP web service is as follows:
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: BIP3113E: Exception detected in message flow SingleArgMsgFlow.SOAP Input (broker IB9NODE)
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:190)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:131)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:120)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:90)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:141)
at $Proxy27.processRqst(Unknown Source)
at org.tempuri.singleargmsgset.SingleArgInvoker.main(SingleArgInvoker.java:15)
Any help would greatly be appreciated!! :)

Can a wcf client handle 2 version of a SOAP response from the same url?

I imported a service reference to a SOAP web service from the customer and coded my client based on that.
After going to production, they said they will launch a new version of the web service with changes to the output type of one of the requests I make to the service (among new messages that I don't consume).
I know I can update my service reference and update my client code to process the updated wsdl and launch an update to my client at the same time the web service updates.
But, is it possible to instrument the WCF code in some way so that I can handle both versions of the response without having to coordinate the update of my client with the update of the web service?
In most cases, NO. It depends on what has changes in the service interface? In most cases you'll need (and want) to upgrade your client. You can always ask them to support more versions of their interfaces.

Notify server to client via Web service

I made a WebService chat. At the client side I am running a thread to check periodically if there any new messages available.
I want to know is there are any way to notify clients via Web Service.
I found something call 'Solicit Response' related to web service. But I am not aware how it works.
Any help is appreciated.
Thank you
In web services, the clients strictly request, they don't listen. What you need is some way for the server to "push" to the client. You're looking for something like Comet which isn't part of a web service per se.
Edit
Here's a relevant stackoverflow discussion.