Six Stars

[resolved] File as service input parameter

Hi,
I have to create a service which has as input a text file.
Text File ---> ESB Service ------> Oracle Database
Is there a file type accepted as  input in talend ESB service ?
or should I convert the file content as XML data .
Any idea, please advise
Many thanks
4 REPLIES
Community Manager

Re: [resolved] File as service input parameter

Hi 
If you use tESBRequestProvider to build a SOAP webservice, the component requires a document as input request, read the file content and convert the data to a document on tXMLMap, and then pass it to webservice as input request.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: [resolved] File as service input parameter

Hi,
I have to implement this use case:
A dotnet program -----> Esb Service ----> ORACLE Database
The dotnet program collect data from user. Among input data there is a File path, then I convert this file to a byte array.
I create a service with Talend ESB which accept a base64Binary as input.
I passed the file converted as a binary of byte to the service.
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.talend.org/service/"xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="BytesReaderService" targetNamespace="http://www.talend.org/service/">

<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.talend.org/service/"xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://www.talend.org/service/">
<xsd:element name="BytesReaderServiceOperationRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="in" type="xsd:base64Binary"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="BytesReaderServiceOperationResponse">
<xsd:complexType>


Now I need to consume this byte array as an input file or stream in my service.
Any idea to do this ?
or is there an other way to send a file as a service input parameter?
Please help !
Thank you in advance
Community Manager

Re: [resolved] File as service input parameter

Hi
Refer to this topic, you need base64 encoding to encode & decode the input byte array, the job looks like:
your input program--main--tJavaRow-main->tXMLMap-main->tESBConsumer--main-->....other components.
on tJavaRow, encode and decode the input byte array.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] File as service input parameter

hi! 
i've read a lot of threads regarding webservices and files as input parameters. but i can't get anything to work. i want to create a webservice that accepts a *.csv file, it's name and does something with it. could someone please show or explain a minimal example of how to do that?
i assume that the input has to be some xml like this:
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<filename>test.jpg</filename> 
<file>…some base64 string …</file> 
</data>
i don't know where to start. creating a service with Talend ESB? creating a job and use some component? i can't find any example on the net, that's frustrating Smiley Sad
i'd really appreciate a short step by step example of how to achieve that.
i've already created webservices with tRestRequest and sent some string to them. that works fine. but a file is something different and i think that this it not what REST should be used for.
thank you very much!!!