Highlighted
Frequent Visitor.
537 views

Add Hosts REST API to PC returns 500 Internal Server Error (error code: 2502)

Hi,

I'm able to add PC Host directly via the http://XXXX:8080/qcbin/start_a.jsp?projectType=LabManagement

However, when I tried to invoke via REST API as describred in https://admhelp.microfocus.com/pc/en/12.55/api_refs/Performance_Center_REST_API/Performance_Center_REST_API.htm#hosts.htm%3FTocPath%3DResources%7CManaging%2520Hosts%7C_____1

I get the following error

<Exception xmlns="http://www.hp.com/PC/REST/API">
    <ExceptionMessage>Failed to add host XX.XX.XX.XX</ExceptionMessage>
    <ErrorCode>2502</ErrorCode>
</Exception>

 

I tried to invoke the same URL with GET to retrieve hosts and it's working. Any idea what's is wrong with the add hosts and ErrorCode 2502 to be specific?

Cheers

 

0 Likes
3 Replies
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: Add Hosts REST API to PC returns 500 Internal Server Error (error code: 2502)

Hi,

2502 error code means General error during add host operation.

Most likely there is a problem with host xml.

IN order to understand the problem we need to see the full command you're sending
and/or log from <PC Server>\orchidtmp\LTLogger\w3wp\.

Please find below a sample for host data xml.

 

POST http://<PCServer>/LoadTest/rest/domains/DEFAULT/projects/Omer/hosts

 

Header: Content-Type: application/xml

 

Body:

    <Host xmlns="http://www.hp.com/PC/REST/API">

                <Name>myHost </Name>

        <Installation>WindowsHost</Installation>

        <HostPurposes>

            <HostPurpose>LoadGenerator</HostPurpose>

        </HostPurposes>

        <Status>Operational</Status>

        <Location>Default</Location>

        <MIListener>None</MIListener>

        <Attributes></Attributes>

        <Priority>5</Priority>

        <SslEnabled>false</SslEnabled>

    </Host>

 

Regards,

Irena

Highlighted
Frequent Visitor.

Re: Add Hosts REST API to PC returns 500 Internal Server Error (error code: 2502)

Log is not meaningful

2018-07-02 06:49:24,895 [1328] [8] ERROR HP.PC.API.Impl.LabManager - Failed to add host XX.XX.XX.XX [Context: 045c0a56-2e61-4a1e-a862-68a7844c03af] [FullContext: QCServer:http://XX.XX.XX.XX:8080/qcbin UserName:xxx Domain:DEFAULT Project:LAB_PROJECT]
2018-07-02 06:49:24,911 [1328] [8] ERROR HP.PC.API.Common.Web.Behaviors.PcApiActionInvoker - Exception occur in action AddHost on controller Hosts [Context: 045c0a56-2e61-4a1e-a862-68a7844c03af] [FullContext: QCServer:http://XX.XX.XX.XX:8080/qcbin UserName:xxx Domain:DEFAULT Project:LAB_PROJECT]
HP.PC.API.Common.Exceptions.FailedToAddHostException: Failed to add host XX.XX.XX.XX
at HP.PC.API.Impl.LabManager.AddHost(HostRequest hostInfo)
at HP.PC.API.PcApiEngine.AddHost(HostRequest hostRequest)
at HP.PC.Web.API.Api_Controllers.HostsController.AddHost(String domain, String project, HostRequest hostInfo)
at lambda_method(Closure , Object , Object[] )
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.<ExecuteAsync>b__4()
at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)

0 Likes
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: Add Hosts REST API to PC returns 500 Internal Server Error (error code: 2502)

I’d suggest opening a support ticket.

Anyway I think we’ll have to review host xml you’re trying to send.

Regards,

Irena

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.