webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  HTTP client using ApiKey header Auth

    Posted Thu March 25, 2021 07:07 AM

    Hi,

    I’m trying to call a REST Api throught https protocol using the API-key auth.
    If I try to call it throught a curl command it works and it response with an error in json format.

    I expect to get the same error in webMethods.

    I have configured a client:http invoke, where I have set an header field called “API-KEY” but when I try to execute the service I get this error :

    com.wm.app.b2b.server.ServiceException: com.wm.net.NetException: [ISC.0064.9314] Authorization Required

    Btw I should get the error also if I don’t set any API-key, but in webMethods I get the authorization required error.

    What should I do to fix the error?

    Thanks in advance


    #Service-Designer
    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: HTTP client using ApiKey header Auth

    Posted Fri March 26, 2021 12:53 PM

    Hello,
    Authorisation errors are treated as exceptions in webMethods flow. The exception is showing that the error is the same. You need to wrap your call in a try catch if you want to trap this error.

    If you are using the API Gateway to enforce your authorisation policy then you need to set the header key as
    ‘x-Gateway-APIKey’

    You will then get a 200 response.

    regards
    John
    Product Manager
    Integration & Microservice Runtime


    #webMethods
    #Integration-Server-and-ESB
    #Service-Designer


  • 3.  RE: HTTP client using ApiKey header Auth

    Posted Mon March 29, 2021 08:52 AM


  • 4.  RE: HTTP client using ApiKey header Auth

    Posted Thu April 01, 2021 01:37 PM

    How do you mean the right format?
    Your service has terminated and trapped the error which is represented by lastError.

    Do you want your service to propagate an error to an external caller of your service is that it?

    In which case you can simple call the following services in your catch block

    pub.flow:setResponse2 - Provide an error message formatted as you wish
    pub.flow:setResponseCode - Set the response code to any 4xx that you want.

    If you want to pass the existing error, you can simply remove the try/catch and the http exception will get propagated as is.

    regards
    John.


    #Service-Designer
    #webMethods
    #Integration-Server-and-ESB