Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Data from and to a webservice

Hi everybody,
I know that with Talend, you can easily design a job and then call it via a web-service.
My question is: can we pass data to this job, and then receive data from it?
To make my point clearer, let's imagine a situation where I have a simple form with 2 or 3 fields. Each time this form is submitted, i want to send the entered data (using a webservice call) to a Talend job that will store the data in the proper databases, and then I want the job to send a confirmation response back.
Can I use Talend to implement this situation?
Thanks

Labels (2)
15 Replies
Anonymous
Not applicable

Hi Ihab
Can I use Talend to implement this situation?

yes, it can implement this situation with TOS. You can use the tWebServiceInput or another internet component to get data from web-service. and then, use the tSendMail component to send a confirmation response back.
I wonder what kind of data will you get from web-service. Please show more detailed information and what is your expected result. So, we can give you more precise response.
Feel free to post your question.
Best regards
shong
_AnonymousUser
Specialist III
Specialist III
Author

Thanks for your prompt response,
However, what I am trying to say is that i need to pass arguments(data) to the talend job when I call it as a webService ( And not call a webService from the talend job to get the data).
For the moment, I only succeded to call it as a webservice( by simply exporting it as a webService) without passing any arguments(data) to it.
In the same perspective, I need to be able to send a soap response(and not a mail response) that contains some data.
Is this possible?
Thanks again
Anonymous
Not applicable

Hi,
I had the same problem and finally found an awkward way to solve it. For the context-parameter named 'fileName1' call it like this and it works:
http://localhost/talend/services/MyFirstJob?method=runJob&args=--context_param%20fileName1=xxx
%20 = whitespace
Kind regards
Akapella.
PS: Have look into the source-code of your job-definitino (e.g. MyJob.java); at the end of the file you will find the method evalParam which reads parameters!
Anonymous
Not applicable

hi ihab
you can try this code it runs correctly:



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="org.apache.axis.client.Call" %>
<%@ page import="org.apache.axis.client.Service" %>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<META name="GENERATOR" content="IBM Software Development Platform" />
<META http-equiv="Content-Style-Type" content="text/css" />
<LINK href=" https://community.talend.com/theme/Master.css" rel="stylesheet" />
type="text/css">
<TITLE>t1.jsp</TITLE>


<%
try {
String endpoint = "http://localhost:8080/base/services/process";

Service service = new Service();
Call call = (Call) service.createCall();

call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName("runJob");
String to = request.getParameter("to");
String from = request.getParameter("from");
String cc = request.getParameter("cc");
String sujet = request.getParameter("sujet");
String message = request.getParameter("message");

Object[] myParams = new Object;
myParams = (Object) new String("--context_param to="+to);
myParams = (Object) new String("--context_param from="+from);
myParams = (Object) new String("--context_param cc="+cc);
myParams = (Object) new String("--context_param sujet="+sujet);
myParams = (Object) new String("--context_param message="+message);
String returns = (String) call.invoke(myParams);

System.out.println("Return: " + returns);
%>
Message enregistré<%
} catch (Exception e) {
System.err.println("erreur : "+e.toString());
}
%>

Fin du traitement
Anonymous
Not applicable

Hi everybody
I have also a data-flow project.
Getting some runtime parameters to the job via Args seems feasible but how to send back data?
I think the SendMail is not really what should happen here. File is out of question and database is also not the solution, neither the console - what is left ?
My question: How far away is a tWebServiceOutput Component ? Has anybody done it yet ?
Comments welcome
Benjamin
Anonymous
Not applicable

Hi Folks,
I'm with Benjamin on this topic. Is there a tWebServiceOutput component on the Talend component development schedule? If so, when is it scheduled to be completed.
If not, are you looking for the community to create one? This may not be a bad thing but if there is no agenda to create such a component, it would be best to give that information to the talend community so someone can start looking into creating such a component.
Simply put, I want to send results from this wonderful tool to my webservices and the tWebServiceOutput seems to be the answer. Thoughts or comments? (rants?)
Cheers
Darren
Anonymous
Not applicable

Have look at Export a job as webservice and tell us if it fits your need.
Anonymous
Not applicable

@Darren
you wrote: "... results from this wonderful tool to my webservices.." this would mean, Talend is the webservices client. This works already.
in the meantime I got a hint to use tBufferOutput . This component does produce a SOAP Output as used in Webservices, but it doesn't produces the according wsdl definition file...
So we have to create a job which ends in tBufferOutput, export that job as a webservice and deploy it on a webserver. If you use .../RunJob, you will see the results.
Arguments are passed as usual.
@plegall
Your answer is not targeting the question / problem. Maybe my explanation above makes it clearer.
Thanks for your Input
& cheers
B.
Anonymous
Not applicable

Thanks for the quick reply.
We took a look at the wiki and it describes how to create a webservice. We are looking to talk to an existing webservice (as a client).
For example, I have a talend job which gives me currency exchange rate values. I want to call a webservice in an external application and send it the currency exchange rate information. Let's assume that I do not have control of the external web service application and I do not have access to its database.
The talend job already exists and the external web service which accepts the currency exchange rate already exists but we need to link the two together.
Simply put, we are looking to take data from a talend job and send it to a NON-talend web service. We are looking for the opposite of tWebserviceInput; a simple way of calling a webservice and sending it data. There are complementary tFileInput/tFileOutput components but webservices has only an input component.
We looked a the tWebserviceInput component and it appears that for simple output it may be able to be used. However, the interface has no helpers and it generally assume a very simple call interface which is not appropriate for complex situations.
Thought and comments are always welcome.
Thanks everyone.
Darren