This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Web Inspect Enterprise REST API's 500 error

Hello everyone,

I had recently installed Web Inspect Enterprise version - 22.1, when i am trying to access the API calls it was showing 500 error. Do we need to follow any more steps to activate API's or we can use API's after the successful installation of Web Inspect Enterprise.

Thanks,

Nagesh

  • Suggested Answer

     We had another customer recently report this error. Please open a ticket with support and have them reference OCTIM11K755059 as development is still investigating. When you open the support ticket, please include a copy of the WIE.Rest.log from C:\ProgramData\HP\WIE\REST.

  • So mostly the new UIs are backed by an API. What I mean is - can you use the UI at all?

    If so, press the F12 on Chrome - capture the trace, do something on the UI that is useful - then save the trace and try some of these via API.

    If it worked on the UI, but not when you use SAME calls from the API - then something very screwy is going on.

    Now - in your example you are trying to get a token.

    You can generate tokens from the UI - so why not get a valid token then try an API call like "show me the projects". IE can you isolate the issue to "API doesnt return tokens" or is it all API is broken?

    This is how I used to get a token (this tool removed the 4 spaces for Python :-()

    def get_auth_token(session):
    url = system_url + '/WIE/REST/api/v1/auth'
    header = {
    'Content-Type': 'application/json',
    'Accept': 'application/json'
    }
    # print url
    paramsdata = {
    'username': args.user_name,
    'password': args.user_password
    }
    response = session.post(url, headers=header, data=json.dumps(paramsdata), verify=False)
    if not response.status_code == requests.codes.ok:
    print response
    sys.exit('Failed login with status {}'.format(response.status_code))
    return response.json()['data']

    and then I would get projects like:

    def get_projects(session, auth_token):
    url = system_url + '/WIE/REST/api/v1/projects?limit=10000'
    header = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'FortifyToken={}'.format(auth_token)
    }

    # print url
    # print header
    response = session.get(url, headers=header, verify=False)
    if not response.status_code == requests.codes.ok:
    # print response
    sys.exit('Failed login with status {}'.format(response.status_code))
    return response.json()['data']

    and get info like

    auth_token = get_auth_token(session=session)
    print auth_token
    theProjects = get_projects(session=session, auth_token=auth_token)
    myProjID = -1
    for pP in theProjects:
        print "{}\t\t{}".format(pP['name'], pP['id'])
        print pP
        myProjID = pP['id']

  • The issue seen by the other customer was related to a certificate issue. As mentioned, take a look at the WIE.Rest.log and you should see an error similar to this:

    2020-10-27 13:46:24,074 ERROR [49] ServiceClient.ExtendUnifyLoginToken - SSC Exception.
    System.ServiceModel.FaultException: The security token could not be authenticated or authorized; nested exception is org.apache.wss4j.common.ext.WSSecurityException: The security token could not be authenticated or authorized

    After further investigation, the SSL certificate had expired for their WIE instance. After resolving that the certificate needed to be imported to the JAVA keystore for the SSC instance. www.microfocus.com/.../index.htm