Calling a https REST service with Talend Open Studio

One Star

Calling a https REST service with Talend Open Studio

Hi,
I just would like to call an existing RESTful webservice using tRESTRequest and tRESTResponse...
(with a HTTPS endpoint with the calling POST method and Basic Authentication) but when I execute it in Talend Open Studio, I have the error below.
Could you tell me how I can correct it please ?

org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:209)
at test1.wssepasearch_0_1.WSSepaSearch$Thread4RestServiceProviderEndpoint.run(WSSepaSearch.java:630)
Caused by: java.lang.RuntimeException: Protocol mismatch for port -1: engine's protocol is http, the url protocol is https
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.finalizeConfig(JettyHTTPDestination.java:162)
at org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTTPTransportFactory.java:308)
at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:93)
at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:72)
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:159)
... 1 more
Caused by: java.io.IOException: Protocol mismatch for port -1: engine's protocol is http, the url protocol is https
at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory.createJettyHTTPServerEngine(JettyHTTPServerEngineFactory.java:271)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.retrieveEngine(JettyHTTPDestination.java:127)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.finalizeConfig(JettyHTTPDestination.java:160)
... 5 more

Regards
Cédric JOUBERT
Employee

Re: Calling a https REST service with Talend Open Studio

Hi, AFAIK HTTPS can only be supported in case of tRESTResponse in the container, so you need to deploy the job into the container.
Cheers, Sergey
One Star

Re: Calling a https REST service with Talend Open Studio

Thanks for your reply.
In fact, I've tried to deploy it in the container but I still have the same error :
- I've exported my project and put my jar it in the Deploy directory of the container (Runtime_ESBSE)
- Ive launched the Karaf console, and after typing the "list" command, I can see my service as Active but Blueprint = Failure. In the testb.log, I obtain the same error
Am I missing something ?
Employee

Re: Calling a https REST service with Talend Open Studio

Hi
Do you export it as a bundle or a jar ? It needs to be a bundle. Also, make sure tRESTResponse address is relative, this is needed for the container HTTPS service be effective. It it does not work for you then please create a JIRA and attach a test job
Thanks, Sergey
One Star

Re: Calling a https REST service with Talend Open Studio

I've selected "OSGI Bundle for ESB" but i've created a jar file, is is correct ?
For the component tRESTResponse, i let all the params set by default. In which field can i enter this address please ?
Employee

Re: Calling a https REST service with Talend Open Studio

It is in the component properties...However it is not something should affect the successful deployment, it is for HTTPs be effective...
Cheers, Sergey
One Star

Re: Calling a https REST service with Talend Open Studio

I will look tomorrow, thanks for your help.
One Star

Re: Calling a https REST service with Talend Open Studio

Hi,
I think I did probably not use the well components to do what I need... (and have probably not well explained what I need) :
I do not want to create a REST service... but I just need to create a job that creates a simple ESB WebService, which calls an existant https REST service. something like that ?
tESBProviderRequest -> tXMLMAP -> tRESTClient -> tXMLMAP -> tESBProviderResponse
Is it the correct way to call my https REST service ?
Could you tell me how to configure such a job ?
(or maybe tell me where I could find any example or tutorial from which I can start please ?)
Regards
Employee

Re: Calling a https REST service with Talend Open Studio

As it happens, unfortunately tRESTClient is not capable of calling to HTTPS targets where key and trust stores are needed.
I've opened a major bug request.
Thanks, Sergey
One Star

Re: Calling a https REST service with Talend Open Studio

Thanks a lot for your help.
Employee

Re: Calling a https REST service with Talend Open Studio

Np, thanks for spotting the problem. I've been running few demos with tRESTClient calling out to HTTPS targets but they were 'plain' HTTPS ones; hope we can fix it fast enough,
Cheers, Sergey
One Star

Re: Calling a https REST service with Talend Open Studio

oh ok... :-)
I'm trying to deal with the tFileFetch component... apparently, some users tested this solution with success...
I would be interested form me to find some examples of such a solution (before the RESTClient fix coming).