Question
Pavithra Rajamohan · Jun 29, 2020

Advice about API Call

Hello,

I would like some advice please. I am trying to send a Httpnetrequest in the form of a JSON message. To request for the web token I have created a method which has the relevant message body and its corresponding values and sent this to the Process. The Process has a method called Transform Message which takes the message and changes it to JSON format and passes it through to the Operation. The Operation currently has the basic HTTPNetrequest listing the relevant information for the website that we are trying to reach. The task has been created to try and invoke the service into action.

So far I have been able to get the service to create the message by running the task, however an error appears when it reaches the Process. The error is “ERROR #5003: Not implemented” – full details below:

ID:

2035088507

Type:

Error

Text:

ERROR #5003: Not implemented

Logged:

2020-06-29 15:20:00.555

Source:

Process.From.SIPtoPBT.REST

Session:

186237

Job:

5265

Class:

UCLH.SIP.Process.PBT.PBTtoPortal

Method:

OnRequest

Trace:

(none)

Stack:

  • $$^zOnRequest+2^Ens.BusinessProcess.1 +1
  • $$^zMessageHeaderHandler+19^UCLH.SIP.Process.PBT.PBTtoPortal.1 +1
  • $$^zMessageHeaderHandler+93^Ens.Actor.1 +1
  • $$^zOnTask+42^Ens.Host.1 +1
  • DO^zStart+62^Ens.Job.1 +2

Can anyone please advise why this error may appear?

The service:

Class UCLH.SIP.Service.Internal.PBT.PBT Extends Ens.BusinessService
{
Method OnProcessInput(pInput As UCLH.SIP.Message.PBT.Request.TokenRequest, Output pOutput As %RegisteredObject) As %Status
{
                #Dim JSONPayload As UCLH.SIP.Message.PBT.Request.TokenRequest
                set JSONPayload=##class(UCLH.SIP.Message.PBT.Request.TokenRequest).%New()
                set JSONPayload.User = "User"
                set JSONPayload.ClientID = "ClientID"
                set JSONPayload.State = "State"
                set JSONPayload.Password = "Password"
                Quit ..SendRequestAsync("Process.From.SIPtoPBT.REST",JSONPayload)
}
}

The Task:

Class UCLH.SIP.Task.Test Extends %SYS.Task.Definition
{
/// Overridden
Parameter TaskName As %String = "Test";
// Property pOutput As %RegisteredObject;
/// Overridden
Method OnTask() As %Status
{
                #Dim tStatus As %Status = ##class(%SYSTEM.Status).OK()
               
                Do {
                                Set tStatus = ##class(Ens.Director).CreateBusinessService("Service.From.Internal.To.PBT.REST",.tService)
                                If ($IsObject(tService)) {
                                                set pInput = ##class(UCLH.SIP.Message.PBT.Request.TokenRequest).%New()
                                Set tStatus = tService.ProcessInput(pInput,.pOutput)
}
                While (0)
               
                Quit tStatus
}
}

The Process:

Class UCLH.SIP.Process.PBT.PBTtoPortal Extends Ens.BusinessProcess
{
Property PBTAuthUser As %String(MAXLEN = 150);
Property PBTAuthPassword As %String(MAXLEN = "");
Property TargetConfigPBT As %String(MAXLEN = 250) [ InitialExpression = "Operation.To.TestPortal.From.SIP.REST" ];
Property ProcessTimeOut As %Integer [ InitialExpression = 10 ];
Parameter SETTINGS = "TargetConfigPBT:Target Operation, ProcessTimeOut: Timeout";
Method TransformMessage(pInput As UCLH.SIP.Message.PBT.Request.TokenRequest, Output pOutput As Ens.Response) As %Status
{
               
                #Dim tStatus As %Status = ##class(%SYSTEM.Status).OK()
               
                Do {
                                set tSC = $$$OK
                                $$$TRACE("I'm in the method")
                                set JSONPayloadTransform = pInput.JSONPayload
                                do JSONPayloadTransform.%toJSON(JSONPayloadTransform)
                                Set tStatus=..SendRequestAsync("Operation.To.TestPortal.From.SIP.REST",JSONPayloadTransform)
                While (0)
               
                Quit tStatus
                Quit tSC
}

Thank you!

 

00
0 1 80 1

Replies

You can send the request directly from a service to operation.

Your BP must implement the following methods to work:

  • OnRequest
  • OnResponse

As both methods are missing from your BP it does not work.