cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5441
Views
27
Helpful
19
Replies

Workflow HTTP Post with Authorization in the header?

milne.james
Level 1
Level 1

I need to create a workflow to consume a REST resource. JSON specifically as the body. My REST service requires a static authentication header in normal base64 encoding, however, I don't see the availability to add to the header in the Finesse workflow configuration. Is this possible? If so how?

19 Replies 19

Hi ,

 

I have now loaded the Certificates for out API server onto Finesse but it still isn't working as shown below.

 

2019-07-03T16:46:28.182 +01:00: : finesse-server.local: Jul 03 2019 16:46:27.983 +0100: ExternalRESTAPISampleGadget : handleNewDialog()
2019-07-03T16:46:28.185 +01:00: : finesse-server.local: Jul 03 2019 16:46:27.986 +0100: ExternalRESTAPISampleGadget : CustomerID=1234567890
2019-07-03T16:46:28.186 +01:00: : finesse-server.local: Jul 03 2019 16:46:27.987 +0100: ExternalRESTAPISampleGadget : AgentID=TESTM
2019-07-03T16:46:28.187 +01:00: : finesse-server.local: Jul 03 2019 16:46:27.988 +0100: ExternalRESTAPISampleGadget : json{"p_customer_id":"1234567890","p_operator":"TESTM"}
2019-07-03T16:46:28.187 +01:00: : finesse-server.local: Jul 03 2019 16:46:27.988 +0100: ExternalRESTAPISampleGadget : contentBody{"p_customer_id":"1234567890","p_operator":"TESTM"}
2019-07-03T16:46:28.188 +01:00: : finesse-server.local: Jul 03 2019 16:46:27.989 +0100: ExternalRESTAPISampleGadget : makeRequest()
2019-07-03T16:46:28.188 +01:00: : finesse-server.local: Jul 03 2019 16:46:27.989 +0100: ExternalRESTAPISampleGadget : Authorization: Basic xxxxxyyyyyxxxx123456789ccccc
2019-07-03T16:46:28.190 +01:00: : finesse-server.local: Jul 03 2019 16:46:27.991 +0100: ExternalRESTAPISampleGadget : Content Type: application/json
2019-07-03T16:46:28.190 +01:00: : finesse-server.local: Jul 03 2019 16:46:27.991 +0100: ExternalRESTAPISampleGadget : Content: {"p_customer_id":"1234567890","p_operator":"TESTM"}
2019-07-03T16:46:28.190 +01:00: : finesse-server.local: Jul 03 2019 16:46:27.991 +0100: ExternalRESTAPISampleGadget : makeRequest(): Making a REST API request to: https://api-server.local/Post/PK_CISCO_API/REQUEST

2019-07-03T16:46:28.243 +01:00: : finesse-server.local: Jul 03 2019 16:46:28.044 +0100: ExternalRESTAPISampleGadget : handleResponse(): The response status code is: 500
2019-07-03T16:46:28.244 +01:00: : finesse-server.local: Jul 03 2019 16:46:28.045 +0100: ExternalRESTAPISampleGadget : handleResponse(): Got a failure response.

 

 

I wasn't sure whether this syntax in the sample  (ExternalRespApiSampleGadget.js)

 

params[gadgets.io.RequestParameters.HEADERS].Authorization = options.authorization;

 

Should be

 

params[gadgets.io.RequestParameters.HEADERS]["Authorization"] = options.authorization;

 

but neither option works.

 

Can you advise on how I could possibly trace the cause of this error as the Tomcat logs don't really tell me anything.

 

For instance does this mean certificate or Basic Authentication problem?

 

INFO: Got Exception fetching https://api-server.local/Post/PK_CISCO_API/REQUEST - 34ms

javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated

at sun.security.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:421)

at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:128)

at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:339)

at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:123)

 

 

Hi,

 

SSLPeerUnverifiedException is usually a certificate issue.

 

As far as how to debug this further, I'd suggest using the browser's debugger/fiddler/wireshark to see the traffic between Finesse and your API server. Also, does your API server have APIs that are not secure? If so, it might be good to see if it works via the Finesse gadget to confirm that it is a certificate issue.

 

Thanx,

Denise

Hi Denise,

 

I have done a packet capture on the Finesse server and it looks like the API server is not responding to the initial "Client Hello" from the Finesse server in the SSL handshake. We have checked that  the API server can be reached on Port 443 and this appears to be ok.

 

I am waiting for more feedback from the API developers to try and find a way forward. In the meantime do you know if there is any param that I can use with io.makeRequest so that we ignore SSL errors?

 

Best Regards

 

Boyd

 

Best Regards

 

Boyd

 

Hi Denise,

 

I have done a packet capture on the Finesse server and it looks like the API server is not responding to the initial "Client Hello" from the Finesse server in the SSL handshake. We have checked that  the API server can be reached on Port 443 and this appears to be ok.

 

I am waiting for more feedback from the API developers to try and find a way forward. In the meantime do you know if there is any param that I can use with io.makeRequest so that we ignore SSL errors?

 

Best Regards

 

Boyd

 

 


I am waiting for more feedback from the API developers to try and find a way forward. In the meantime do you know if there is any param that I can use with io.makeRequest so that we ignore SSL errors?


Unfortunately I don't know if that is possible. I tried searching the web for an answer, but couldn't find anything.

 

Thanx,

Denise