What is the easiest way to put & get files via WebDav using Talend?
I tried using the component tWebDavPut, which I downloaded from Talend Exchange, but received the error:
java.lang.RuntimeException: Could not generate DH keypair [...] Caused by: java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64, and can only range from 512 to 1024 (inclusive) [...]
Stack overflow suggests that this is a bug with JDK 7. (I am not able to post the link because I don't have enough posts on the forum yet.)
Unfortunately, of course, Talend 5.6 seems to be incompatible with JDK 8, in which this bug was corrected.
My only other solution has been to use a tSystem component & call a command-line utility like curl that can connect to WebDav. But if that's the only solution, why use Talend in the first place?
Last edited by porter.james (2015-11-20 16:00:56)
Talend 6 is compatible with Java 8. However I think you have many other options using Talend 5.6. You can make use of any Java APIs available to you using tJava, tJavaRow or tJavaFlex components (also routines, etc), you can also make use of HTTP methods. The component that you are currently trying looks very old and is probably not supported anymore. You could take a look at editing that component, but that is a little tricky if you have not edited components before.
Anything you can do with curl, you can do with Talend. You just need to know how. Let us know how you are connecting using curl and someone will be able to tell you how to achieve this using Talend.
Thanks so much for your response! We are on version 5.6 for now, I can ask about upgrading to 6 but not likely to happen immediately.
I agree, that component looks old & janky, better to use something more modern. I don't have experience editing components, but if there's an easy way to do this with tJava or one of the HTTP components that would be ideal.
My curl command looks like this:
curl -T <filename> -u <username>:<password> https://<url>
Sorry, I didn't see your post until I got home. I think I have a bare bones example of how you might be able to achieve this. I've not tested it with WebDav, but it should get you close if it doesn't get you all the way there. The layout can be seen in the below pic....
The tFileInputRaw is configured to read the file you want to send. It reads it as a byte array. Settings are below....
In the tSetGlobalVar I am setting the data to a globalMap variable. As seen below.....
The tRest configuration needs to be handled carefully. Unless this is configured precisely, it will not work and can be a real pain to sort out. These are my guesstimate at the best settings for you.....
Ignore the URL. That can be replaced with yours. The HTTP Headers are important. You need to ensure that the Content-Type is set to "application/octet-stream". That will permit binary data to be passed. You then need to use the Http Body field to place the globalMap variable you created with your byte data.
In your CURL command I noticed you were using Basic Http Authentication (or that is my assumption). In order to work with that with a tRest component, you will need to follow the example here (https://www.talendforge.org/forum/viewt … p?id=38724). Add a tJava to the job (maybe after the tSetGlobalVar) and use the code explained in the link. Then add an "Authorization" Http Header.
That last part I can't guarantee works (as I haven't tried it), but the first part should do.
I can't guarantee this will work perfectly first time, but this should enable you to trial and error it out. Good luck.
Hi Rilhia ans James,
This post saves my half day.
Am also trying to share csv file to webdav server, but not succeeded.
@james: were you added extra authorization header in HTTP Headers?
Replaced the content-type header with Authorization header?
Thanks in Advance.