2

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?

eventhorizon
  • 2,977
  • 8
  • 33
  • 57

4 Answers4

2

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.

Michael Lemaire
  • 746
  • 1
  • 6
  • 18
  • That would have been the answer I was looking for - but fortunately, I don't have to tame webmethods anymore. :-) THX! – eventhorizon Nov 24 '21 at 19:00
1

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.

Hugo Ferreira
  • 1,584
  • 16
  • 17
  • First: Thank you for your message! But my problem is that the http method throws an exception. After that there is no header information in the pipeline... I expected what you described... :-) – eventhorizon Jun 17 '15 at 17:21
  • 1
    I see… well, it would too easy right? :-) Are you sure you are populating the `auth` input document correctly? Or that the target server is actually being reached? Maybe you’re stumbling on some ACL restriction that is causing the exception and it’s not really an _unauthorized_ error from the target url but rather from wM itself? I don’t have access right now to an installation to test things out, but maybe if you post the full error message we can get some more clues from there… – Hugo Ferreira Jun 17 '15 at 23:28
  • Of course! The auth data is incorrect! That is one of my testcases! :-) – eventhorizon Jun 19 '15 at 18:37
1

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

eventhorizon
  • 2,977
  • 8
  • 33
  • 57
0

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

Ivan Herlambang
  • 368
  • 2
  • 8