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

 

Cloud Free Trial

Try Talend Cloud free for 30 days.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

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