Learning to use tWebserviceInput Component - Help with examples?

One Star

Learning to use tWebserviceInput Component - Help with examples?

Hi everyone and thank you for your help in this forum. I learn alot here.
Today I am trying to learn how to manipulate the tWebserviceInput Component. I learn best from examples, as I am a cut and paste kind of guy.
This is the link to a sample login using JAVA and this what I am trying to do using TOS.
I am having trouble creating SOAP envelope needed for the login authentication.
If could see multiple examples of how this is done and the Code section from the component, I could teach myself how to do this. Any instructional material you can point me to would be great!!
Links to other tutorials, forum posts, blogs or anything.
Finally, if someone would like to tutor me this for pay, I would be amenable to that too.
One Star

Re: Learning to use tWebserviceInput Component - Help with examples?

there are easier ways to call a web service than to create its complete body through DOM API.
1. The easiest way is when you have a correct and complete WSDL, then you can use tESBConsumer artefact. You just provide a WSDL and rest usually works, but there are a few constraints:
- the web service must use CXF supported standards only and WSDL must declare all requirements (the service implementation cannot expect data which are not declared in WSDL)
- no funny stuff in SOAP header (here I mean custom data in header), because tESBConsumer uses its dispatch (sending mechanism) in payload mode, so you can manipulate only body of the message. As I've seen in your sample you do nothing with the SOAP header, so it shouldn't be a problem.
- until you send all necessary data in body and header is used only for supported standards (as WS-RM, WSS, ..) it works nicely. By default you may use basic authentication or NTLM.
- TOS cannot (or - has difficulties to) parse deep data structures from scattered XSD files, so if you have deep or complicated data structure, you better prepare yourself sample request and response XML and create XML datatypes from the prepared samples.
We have in use few services - one requires a customer header and one requires unsupported feature. For these services we've created an 'adapter' proxy service exposed by camel route, decoupling non-standard features and service endpoint.
2. tWebService_Input - for default settings it seems to be able to call web service with simple input and output. Maybe I'm wrong in this, but I don't use this component very often.
3. tWebService_Input with Advanced checkbox selected - it generates Axis2 client classes in the 'routines' package, so you can programatically call the web service (see http://axis.apache.org/axis2/java/core/) . Unfortunatelly the client classes are generated without the header switch. While I see the example you've sent, event authentication data are in body so it should be not a problem.
Axis2 API allows you to manipulate HTTP headers (such as cookies), but it's easier to do it in camel route. For not standard features I'd rather create a web service proxy (my own web service) and provides a simpler way to reuse service inside WASB or between other systems.
Anyway I would consider more convient to generate your own web service client and use it as java code as to compose the SOAP message manually - it is certainly more convient and robust.

Carpe diem
One Star

Re: Learning to use tWebserviceInput Component - Help with examples?

And BTW there are few things done wring in the example. You've rather not copy/paste, but try to understand intention of the exmaple. Some parameters I feel missing, such as
SOAPElement bodyEl = body.addChildElement(soapFactory.createName("login", "tns", ""));

creates an element with prefix, but with empt namespace .. well - I feel it missing. You shouldn't trust every example to be correct, not even mine Smiley Tongue
One Star

Re: Learning to use tWebserviceInput Component - Help with examples?

Thanks for your response. I appreciate your help. The example actually comes from the vendor's system to be accessed. I tried a few things you mentioned.
1. I looked at tESBConsumer. It looks like it would be simple but, I have no idea how to setup this component. How do you create a SOAPMessage to pass tokens or filters or is it created another way?
2. tWebserviceInput with advanced mode. When I try to create a soap message in code, i get errors because I did not use the import statements. I can't use import statements because it is the wrong place in the code. I am clueless there
3. tJavaFlex. Here I have some success. I put the import statements on the advanced tab. I get the response SOAPMessage, but now I don't know how to extract the data. tExtractXML needs a column name to parse XML. How do I save the SOAPMessage object to a string and then output to a column so that it can be consumed by tExtractXML Component? Or is there a better way to extract the data from the SOAPMessage?
4. tSOAP component. How do I create a non static soap message and pass it to this component?
Thank you again.
One Star

Re: Learning to use tWebserviceInput Component - Help with examples?

Hi scott,
1) use always a triplet - tXMLMap->tESBConsumer->tXMLMap or tXMLMap->tESBConsumer->tExtractXMLFields where tXMLMap you set the payload type by assigning a XSD schema or sample XML request / response. well - if the structure is deep, TOS has problem to parse it all, so I usually create a simple web service proxy as an OSGi model or a web application. Then it is much easier to address the web services by a tESBConsumer artefact. Still - you manupulate only the message payload, not complete message, so I assume you could set interceptors and handlers in a spring configuration file into the exported archive, but I didn't succeeded yet.
2) for advanced mode - I found out it is ieasier to create a separate service proxy module. So I've abbadoned it. tWebServiceInput component may have its use, as I found out that jobs exported as WAR archive can be run as:
http://server/<archive>/services/<Job name>?method=runJob&arg1=--context_param <some parameters>
than on first sight - the tWebService input does a good job. But it uses an Axis framework and may poison common OSGi classes (you will end up with LinkageError), so don't use it if possible.
4) as a string content you may enter a context variable or any java code (e.g. from your code routines)
Carpe diem

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey


Talend named a Leader.

Get your copy


Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables


How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration


Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.