Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Mutual Authentication Not working with Third party Application

ARrow2
Giga Contributor

Hi All,

     I have created the Java KeyStore Files using the below commands

         keytool -genkey -alias snow -keyalg RSA -validity 365 -keystore snow.jks -storepass abc123 -keypass abc123
        keytool -export -alias snow -keystore snow.jks -storepass abc123 -file snow.cer

I have imported the snow.jks in the Certificates X509 certs on Servicenow side.

I have imported the Cer file on my Application.

When I tried to execute the rest API call call (Out bound) I am seeing the below error,

REST Msg Outbound - RESTMessageClient : Error executing REST request: unsupported protocol: 'chandrahttps': java.lang.IllegalStateException: unsupported protocol: 'chandrahttps': org.apache.commons.httpclient.protocol.Protocol.lazyRegisterProtocol(Protocol.java:149)
org.apache.commons.httpclient.protocol.Protocol.getProtocol(Protocol.java:117)
org.apache.commons.httpclient.HttpHost.<init>(HttpHost.java:107)
org.apache.commons.httpclient.HttpMethodBase.setURI(HttpMethodBase.java:280)
org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:220)

 

I am not able to execute any rest call from ServiceNow to my third party application using Mutual Authentication Can anyone help me with this.

 

Thanks,

Manohar 

   

5 REPLIES 5

Tony Chatfield1
Kilo Patron

Hi, if you share the code\configuration that is causing this error, it will be easier for the forum to review and assist you.

Hi Tony,

   

   ->  I have created the new X509 certificate on the Servicenow side, in that certificate I have imported my JKS file as Java Key Store. Please refer below.

find_real_file.png

-> After that, I have created one Protocol profile with that X509 certificate. Please refer below

find_real_file.png

I am using this protocol profile as a mutual authentication for my Script include like below

var request = new sn_ws.RESTMessageV2();
request.setHttpMethod('POST');
request.setMutualAuth("myhttps");

When i execute this script include from my workflow i got this certificate error.

Exception while registering protocol: myhttps Error: Password must not be null: no thrown error

Exception while registering protocol: myhttps Error: Get Key failed: null: no thrown error

Hi Tony,

   

   ->  I have created the new X509 certificate on the Servicenow side, in that certificate I have imported my JKS file as Java Key Store. Please refer below.

find_real_file.png

-> After that, I have created one Protocol profile with that X509 certificate. Please refer below

find_real_file.png

I am using this protocol profile as a mutual authentication for my Script include like below

var request = new sn_ws.RESTMessageV2();
request.setHttpMethod('POST');
request.setMutualAuth("myhttps");

When i execute this script include from my workflow i got this certificate error.

Exception while registering protocol: myhttps Error: Password must not be null: no thrown error

Exception while registering protocol: myhttps Error: Get Key failed: null: no thrown error

ARrow2
Giga Contributor

Hi All,

Can anyone help me with this error,

 

REST Msg Outbound - RESTMessageClient : Error executing REST request: unsupported protocol: 'myhttps': java.lang.IllegalStateException: unsupported protocol: 'myhttps': org.apache.commons.httpclient.protocol.Protocol.lazyRegisterProtocol(Protocol.java:149)
org.apache.commons.httpclient.protocol.Protocol.getProtocol(Protocol.java:117)
org.apache.commons.httpclient.HttpHost.<init>(HttpHost.java:107)
org.apache.commons.httpclient.HttpMethodBase.setURI(HttpMethodBase.java:280)
org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:220)
org.apache.commons.httpclient.methods.ExpectContinueMethod.<init>(ExpectContinueMethod.java:93)
org.apache.commons.httpclient.methods.EntityEnclosingMethod.<init>(EntityEnclosingMethod.java:119)
org.apache.commons.httpclient.methods.PostMethod.<init>(PostMethod.java:106)
com.glide.communications.HTTPRequest.post(HTTPRequest.java:67)
com.glide.rest.outbound.direct.DirectRESTRequestDispatcher.doPost(DirectRESTRequestDispatcher.java:131)
com.glide.rest.outbound.direct.DirectRESTRequestDispatcher.doRequest(DirectRESTRequestDispatcher.java:94)
com.glide.rest.outbound.direct.DirectRESTRequestDispatcher.invoke(DirectRESTRequestDispatcher.java:50)
com.glide.rest.outbound.RESTMessageClient.invoke(RESTMessageClient.java:100)
com.glide.rest.outbound.RESTMessageClient.execute(RESTMessageClient.java:78)
com.glide.rest.outbound.scriptable.ScriptableRESTMessageClient.jsFunction_execute(ScriptableRESTMessageClient.java:67)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)