Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
slim025
Contributor
Contributor

Talend ESB using PUT method in the tRestClient component

Hello EveryOne,

 

I would like to transform this Java code using only Talend components.

I would like to call the tRestClient component using the PUT method.

 

Does anyone know how to do this? In the existing job, we use the tWebserviceInput component (wsdl type). We would like to replace it with a REST type Web Service. 

 

I would like to know how to handle exceptions with tRestClient. Could you help me with this?

 

Here is my code:

 

// EndPoint

 

String endPoint = context.endPoint;

RoutineServiceLocator locator = new RoutineServiceLocator();

locator.setRoutineEndpointAddress(endPoint);

Routine_PortType Routine_PortType = locator.getRoutine();

RoutineSoapBindingStub sub = (RoutineSoapBindingStub)Routine_PortType;

 

//Inputs

 

// ID file created

 

String tempFile = "";

 

if("DI".equals(context.typeDI))

{

tempFile = context.workspace_path + context.codeFlux + "/SL_QUOTIDIEN_ALIM_DI.xml";

}

else if("BN".equals(context.typeDI))

{

tempFile = context.workspace_path + context.codeFlux + "/SL_QUOTIDIEN_ALIM_BN.xml";

}

 

// Building the String from the XML file

String xmlDI = routines.Sillage.XMLtoString(tempFile);

 

// System.out.println("query to GTPAPP = \n" + xmlDI);

 

// Call to Web Service for the creation of IDs

String reponseGTPAPP = sub.createDIRoutine(xmlDI, context.WSGTP_TIMEOUT);

 

 

 

// System.out.println("Response GTPAPP = \n" + reponseGTPAPP);

// Creation of the XML file

 

 

 

String pathFile = "";

String pathFileXMLSent="";

 

if("DI".equals(context.typeDI))

{

pathFileXMLSent=context.archivi_space_path+context.codeFlux+"/PUBLICATION/SL_QUOTIDIEN_REQ_DI_"+TalendDate.getDate("yyyyMMdd_hhmmss")+".xml";

pathFile = context.archivi_space_path+context.codeFlux+"/PUBLICATION/SL_QUOTIDIEN_REP_DI_"+TalendDate.getDate("yyyyMMdd_hhmmss")+".xml";

}

else if("BN".equals(context.typeDI))

{

 

pathFileXMLSent=context.archivi_space_path+context.codeFlux+"/PUBLICATION/SL_QUOTIDIEN_REQ_BN_"+TalendDate.getDate("yyyyMMdd_hhmmss")+".xml";

 

pathFile = context.archivi_space_path+context.codeFlux+"/PUBLICATION/SL_QUOTIDIEN_REP_BN_"+TalendDate.getDate("yyyyMMdd_hhmmss")+".xml";

 

}

 

//Save the query

Sillage.stringToXml(pathFileXMLSent, xmlDI);

 

//Save the response

Sillage.stringToXml(pathFile, reponseGTPAPP);

 

// return 

row9.reponse = reponseGTPAPP;

row9.pathFile = pathFile;

 

 

I thank you in advance,

 

Best regards,

 

PS: It is urgently and I did not find a solution around me.

Labels (4)
1 Reply
slim025
Contributor
Contributor
Author

😥