Passing a parameter to a Talend SOAP service

Highlighted
Six Stars

Passing a parameter to a Talend SOAP service

I created a simple web service in Talend by following the (very well written, I must say) instructions here.

I named my service 'txn' and it accepts a numeric refNumber and returns the txn record from Mysql db. All works perfectly using SoapUI.

Now, I wanted to create a java web service client using Eclipse. The problem comes with passing the parameter to the web service. From the code generated by eclipse, the parameter is of type TxnOperationRequest, yet I want to pass an int type reference number. So I get the error: 

The method txnOperation(TxnOperationRequest) in the type TxnPortType is not applicable for the arguments (int)

As far as I can tell, the types and methods are autogenerated in Talend, despite me setting the refNumber type to int when creating the service (see images below).

My question is how do I convert the parameter into usable types? 

 

Snip1.PNGSnip2.PNG

 

Edit:

I found where the problem was: I had not created an instance of type TxnOperationRequest

 

txnPortType txnService = locator.gettxnPort();
txnOperationRequest request = new txnOperationRequest(refNumber); //refNumber is an integer parameter being passed from the calling method
txnOperationResponse response = txnService.txnOperation(request); // request will be passed to the web service
System.out.println(response.getAccountNumber()); // use get methods to extract the fields from the webservice

 

 


Accepted Solutions
Six Stars

Re: Passing a parameter to a Talend SOAP service

Solved by ceating an instance of type txnOperationRequest:

txnPortType txnService = locator.gettxnPort();
txnOperationRequest request = new txnOperationRequest(refNumber); //refNumber is an integer parameter being passed from the calling method
txnOperationResponse response = txnService.txnOperation(request); // request will be passed to the web service
System.out.println(response.getAccountNumber()); // use get methods to extract the fields from the webservice

 


All Replies
Six Stars

Re: Passing a parameter to a Talend SOAP service

Solved by ceating an instance of type txnOperationRequest:

txnPortType txnService = locator.gettxnPort();
txnOperationRequest request = new txnOperationRequest(refNumber); //refNumber is an integer parameter being passed from the calling method
txnOperationResponse response = txnService.txnOperation(request); // request will be passed to the web service
System.out.println(response.getAccountNumber()); // use get methods to extract the fields from the webservice

 

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

An API-First Approach to Modernizing Applications

Learn how to use an API-First Approach to Modernize your Applications

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read