webMethods pub.client.http throws error on 401

2.7k Views Asked by At

I am using webMethods from the SAG and it seems if the service

pub.client.http

throws an exception on status code 401 "Unauthorized".

This leads me to the problem that I cannot handle the status code because nothing is written to the pipeline.

getLastError

does contain the string "Unauthorized" but not the status code. Except that I do not want to start parsing exception messages...

Any ideas?

4

There are 4 best solutions below

0
On BEST ANSWER

Asked a SAG senior consultant. This is the normal behavior. There is no flag which you can set to enforce suppression of this exception...

3
On

The output parameter header from the pub.client.http call should contain the information you’re after:

header   Document Conditional. HTTP response headers.

Key                    Description

lines                   Document Fields in the response header, where key names represent
                           field names and values represent field values.
status                 String HTTP status code of the response.
statusMessage   String HTTP status message of the response.

See the webMethods Integration Server Built-In Services Reference page 122 for more details.

1
On

According the comment from @Hugo Ferreira probably there are ACL restriction whether inside your webMethods environment, or your client URLs.

Things you should consider:

  1. Do your webMethods server located inside closed environment wherein need to get connected to proxy to get to the outgoing request. Which is likely you can investigate by run web-browser program directly from your wM server towards the URL address (i.e using SSH to run firefox in my case and popup appeared)

    Authentication request popup

  2. The client that your request will go to, have HTTP for authentication requests


Solution

To pass this all you need to do is input the auth user/password or any other auth mechanism i.e kerberos, token, etc. inside the pub.client:http

auth pass username/password

1
On

You can suppress the exception and have the HTTP 401 status returned like any other HTTP response. Go to the IS Admin Extended Settings and set:

watt.net.http401.throwException=false

Note this is a server-wide setting, so it will affect all your applications/services that use pub.client:http.