One Star

Asynchronous Web Service

Hi,
I would like to run the web service generated by Talend in asynchronous.
Why ?
Because, I just want to lauch the web service, I don't want the return.
Do you have an idea ?
If it's possible I would like to launch this web service from the tInputWebService component of Talend Open Studio. Else, I'll develop a routine.
Thx very much.
7 REPLIES
Not applicable

Re: Asynchronous Web Service

Hi,
I have the same issue, I reopened the topic if someone know.
I just want to launch a web service in asynchronous because I don't want to wait for the return.
Thank you very much
One Star

Re: Asynchronous Web Service

Do You have any idea in this subject?
I'am lookin for solution of long time running etl job exposed via WS interface for bpel process. But when I invoke this WS in synchronous way, i will get time out exception ;(
One Star

Re: Asynchronous Web Service

Talend webservice rely on the axis1 library for now and it doesn't handle async calls.
A workaround can be to load all lib from axis 2 (which can make async call), and do something like this :
http://www.ibm.com/developerworks/webservices/library/ws-axis2/?ca=dgr-btw01AWSAxis2&S_TACT=105AGX59...
One Star

Re: Asynchronous Web Service

A symplier workaround I just tested, is to use threads and the standart tWebserviceInput component.
Go to "advanced settings" to generate the code. It will create a few java classes in the routines.
And create one like this :
package routines;
public class MyAsyncWeather extends Thread{
public String result;
private String cityCode;

public MyAsyncWeather(String cityCode)
{
this.cityCode = cityCode;
}

public void run() {
try
{
System.out.println("Thread starts : ");
routines.WeatherSoap_PortType weatherSoap = new routines.WeatherLocator().getWeatherSoap();
//routines.WeatherSoap_BindingStub stub = (routines.WeatherSoap_BindingStub)weatherSoap;
result = weatherSoap.getWeather(cityCode);
System.out.println("Thread ends : "+result);
}
catch(Exception e)
{
System.err.println(e.getLocalizedMessage());
}
}
}

Then u can start the call with a tJava and this few lines :
MyAsyncWeather myAsyncWeather = new MyAsyncWeather("Paris");
myAsyncWeather.start();

U need a "fake" tWebserviceInput component to exist in the job to load all the needed library. But use a "if" trigger with a always false condition to make sure it'll never starts.
One Star

Re: Asynchronous Web Service

What if we can send response message just after getting invoke message, but not after finishing a job. Then do our job and after it invoke some external service (using WebServiceInput).
In my case the problem is, that i would like to invoke TOS WS from BPM and i get time out when must wait for response from big etl job. So if my job will send response, which for my bpm process will be information, that etl job started. Then process will wait for message, that etl job is finished and then in the process conditions to run next services will be met.
But in my solution we plane to use also Jboss ESB, and i hope there will be some possibility to use it as asynchronous WS gateway or rather export etl jobs to esb and use jms components for messaging.
Our BPM is Intalio, which in Community Edition is not possible to use JMS (only WS).
Maybe we should consider to use jBPM in the place of Intalio, but we think that BPM modelling pallete in Intalio is reacher, than in jBPM ....
One Star

Re: Asynchronous Web Service

Hum, if I understood correctly it's up to your BPM to make an asynch webservice call.
Deployed Talend webservices can be call asynchronously, it's a client task to choose to either call it sync or async.
If you'r really tied from your client side, a workaround can be to deploy a talend job which launch in background the real working job. Probably using a tSystem, or creating a custom Thread routine launching the job.

Re: Asynchronous Web Service

Hi, I'm recently using TOS for ESB, and I want to create a async Job that receives a REST/JSON Request and after storing it to a JMS Queue, it responds to the client with the status of message storing in the queue. I'm using tRestRequest, tJMSOutput and tRestResponse components. My problem is that this job should be running all the time and there is no response. Any idea how to respond to the client while the job is running?