Invoking Rest service using SAML authentication

Six Stars

Invoking Rest service using SAML authentication

I want to invoke a Rest API and it needs SAML authentication. I tried using tRestClient by enabling SAML authentication but when i deploy the jar in runtime and started the container I got the following error ""

org.apache.cxf.interceptor.Fault: Failed to create service.
at org.talend.esb.security.saml.STSRESTOutInterceptor.handleMessage(STSRESTOutInterceptor.java:101)[226:security-common:6.1.0.SNAPSHOT]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)[54Smiley Surprisedrg.apache.cxf.cxf-core:3.1.2]
at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:636)[73Smiley Surprisedrg.apache.cxf.cxf-rt-rs-client:3.1.2]
at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1091)[73Smiley Surprisedrg.apache.cxf.cxf-rt-rs-client:3.1.2]
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:894)[73Smiley Surprisedrg.apache.cxf.cxf-rt-rs-client:3.1.2]
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:865)[73Smiley Surprisedrg.apache.cxf.cxf-rt-rs-client:3.1.2]
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:428)[73Smiley Surprisedrg.apache.cxf.cxf-rt-rs-client:3.1.2]
at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:611)[73Smiley Surprisedrg.apache.cxf.cxf-rt-rs-client:3.1.2]
at abc.saml_authentication_0_1.SAML_Authentication.tRESTClient_1Process(SAML_Authentication.java:1142)[9:abc.SAML_Authentication:0.1.0]
at abc.saml_authentication_0_1.SAML_Authentication.runJobInTOS(SAML_Authentication.java:1591)[9:abc.SAML_Authentication:0.1.0]
at org.talend.esb.job.controller.internal.SimpleJobTask$JobRunner.run(SimpleJobTask.java:81)[218Smiley Surprisedrg.talend.esb.job.controller:6.1.0.SNAPSHOT]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)[:1.7.0_75]
at java.util.concurrent.FutureTask.run(Unknown Source)[:1.7.0_75]
at org.talend.esb.job.controller.internal.SimpleJobTask.run(SimpleJobTask.java:63)[218Smiley Surprisedrg.talend.esb.job.controller:6.1.0.SNAPSHOT]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)[:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)[:1.7.0_75]
at java.lang.Thread.run(Unknown Source)[:1.7.0_75]
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:87)[90Smiley Surprisedrg.apache.cxf.cxf-rt-wsdl:3.1.2]
at org.apache.cxf.ws.security.trust.AbstractSTSClient.createClient(AbstractSTSClient.java:646)[89Smiley Surprisedrg.apache.cxf.cxf-rt-ws-security:3.1.2]
at org.apache.cxf.ws.security.trust.AbstractSTSClient.issue(AbstractSTSClient.java:728)[89Smiley Surprisedrg.apache.cxf.cxf-rt-ws-security:3.1.2]
at org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:61)[89Smiley Surprisedrg.apache.cxf.cxf-rt-ws-security:3.1.2]
at org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:55)[89Smiley Surprisedrg.apache.cxf.cxf-rt-ws-security:3.1.2]
at org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:51)[89Smiley Surprisedrg.apache.cxf.cxf-rt-ws-security:3.1.2]
at org.talend.esb.security.saml.STSRESTOutInterceptor.handleMessage(STSRESTOutInterceptor.java:90)[226:security-common:6.1.0.SNAPSHOT]
... 16 more
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'http://localhost:8040/services/SecurityTokenService/UT?wsdl'.: java.io.FileNotFoundException: http://localhost:8040/services/SecurityTokenService/UT?wsdl
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2198)[159Smiley Surprisedrg.apache.servicemix.bundles.wsdl4j:1.6.3.1]
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2390)[159Smiley Surprisedrg.apache.servicemix.bundles.wsdl4j:1.6.3.1]
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2422)[159Smiley Surprisedrg.apache.servicemix.bundles.wsdl4j:1.6.3.1]
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:231)[90Smiley Surprisedrg.apache.cxf.cxf-rt-wsdl:3.1.2]
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:163)[90Smiley Surprisedrg.apache.cxf.cxf-rt-wsdl:3.1.2]
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:85)[90Smiley Surprisedrg.apache.cxf.cxf-rt-wsdl:3.1.2]
... 22 more
Caused by: java.io.FileNotFoundException: http://localhost:8040/services/SecurityTokenService/UT?wsdl
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)[:1.7.0_75]
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)[:]
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)[:]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)[:]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)[:]
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)[:]
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)[:]
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)[:]
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2188)[159Smiley Surprisedrg.apache.servicemix.bundles.wsdl4j:1.6.3.1]
... 27 more

 

 

Moderator

Re: Invoking Rest service using SAML authentication

Hello,

Are you able to execute your ESB job in studio successfully? Could you please indicate on which talend ESB build version you got this issue? Your talend studio and runtime on the same server?

Best regards

Sabrina

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Highlighted
Six Stars

Re: Invoking Rest service using SAML authentication

Hi,

Thanks for reply. 

Studio and runtime version is 6.1.0 and they are on same machine.

I was also not able to execute the job in studio but I think that's because the Saml authentication option is available in Runtime only (it's mentioned likewise in UseAuthentication section of tRESTClient component).

 

I just succeed in making it worked in Java code recently. I.e. SAML authentication is done in Java code and the digest key is used in tRest component while calling the api

 

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now