Hello @water huang 

As You can create a class method with name of your property " OPDTLogicalToXSD" and add the code conversion for the datetime as mentioned by @Enrico Parisi at XML export time.

It's suitable for both XML and JSON adaptor.

Sample code.

Class Samples.NewClass2 Extends (%Persistent, %Populate, %JSON.Adaptor, %XML.Adaptor)
{
Property OPDT As %Library.DateTime;

ClassMethod OPDTLogicalToXSD(%val As %TimeStamp) As %String [ ServerOnly = 1 ]
{
	Set %val=##class(%Library.TimeStamp).LogicalToXSD(%val)
	Quit $translate(%val,"TZ"," ")
}
}

output

 <NewClass2><OPDT>2023-11-30 11:07:02</OPDT></NewClass2>

Hello @Colin Brough 

Can you try is this approach is suitable. Create a Business Service with Ens.InboundAdapter or without adapter. Call your BPL process as usual interoperability production flow.  Eventually Create your custom Task and invoke your Business service from the OnTask Inherited Method

Class HL7Task.Test Extends %SYS.Task.Definition
{
Method OnTask() As %Status
{
    Set status =  $$$OK
    Try {
        #dim service As Ens.BusinessService 
        Set status = ##class(Ens.Director).CreateBusinessService("HL7.Feed.TriggerService",.service)
        if $isobject(service) {
            do service.OnProcessInput(pInput,.pOutpt)
        }
    }
    Catch(ex) {
        Set status = ex.AsStatus()
    }
    return status
}
}

Business service

Class HL7.Feed.TriggerService Extends Ens.BusinessService
{

Parameter ADAPTER = "Ens.InboundAdapter";
Property TargetConfigName As Ens.DataType.ConfigName;
Parameter SETTINGS = "TargetConfigName:Basic";
Method OnProcessInput(pInput As %RegisteredObject, Output pOutput As %RegisteredObject) As %Status
{
	Do ..SendRequestSync(..TargetConfigName,pInput,.pOutput)
	Quit $$$OK
}

}

Hello @Luis Angel Pérez Ramos 

as of my understanding, We can send the it's as a query parameter or http request body if the design supports. Incase the external system protocol was designed to handled the authorization and some additional custom headers are must be a request header Then it should be part of the headers section otherwise I believe it may creates some issue with the request/response.

  1. Basically you should keepIntegrity enabled. Otherwise it will delete all the messages regardless of whether processed or not processed.
  2. Select "All types" in Type to purge.
  3. You can enable the " Open output file when task is running? " and provide the file location.
  4. Once the process is completed or Errored you can check the Ens_Util.Log to get some additional information.

Can you try the above steps.

Hello

You can send you're POST/GET URL's as part of the method itself. Refer the below sample codes

  Set httprequest=##class(%Net.HttpRequest).%New()
  Set httpRequest.ContentType = "application/json"
  Set httpRequest.Server = "renderProjectName.onrender.com"
  set httprequest.https=1 ;add this additional set if you're going to make it as a HTTPS call
  set httprequest.SSLConfiguration = "your ssl certificate" ; include the certificate as well for HTTPS call's
  Do httprequest.Post("/")

Generally we can't execute the macros directly in terminal, studio output. The Macro preprocessor aka MPP do converts the marcos into the expression or function at the time of compilation. So, You can open and use the .int file for the specific code. 

Test.mac
macromac
 write $$$EnsMajorVersion ; 
Test.int
macromac
 write $system.Version.GetMajor() ; 

Get the relevant value of macros and execute it in terminal or output window.

Hello @Muhammad Waseem 

Maybe you can try extract the patient resource from bundle or use if it's already resource. Load into FHIR model patient class  HS.FHIR.DTL.vR4.Model.Resource.Patient with the extracted resource. Then you can convert the Birthdate and validate the Age. You can use the same logic in your code DTL in your FHIR process in between FHIR service (HS.FHIRServer.Interop.Service) to FHIR operation (HS.FHIRServer.Interop.Operation)

ClassMethod VaidatePatientResource(patientResourceStreram As %Stream.Object)
{
	#dim patient As HS.FHIR.DTL.vR4.Model.Resource.Patient
	try {
		set patient = ##class(HS.FHIR.DTL.vR4.Model.Resource.Patient).FromJSON(patientResourceStreram)
		Set age = $horolog - $ZdateH(patient.birthDate,3)\360
		if age<18 $$$ThrowStatus($$$ERROR($$$GeneralError, "Age is less than 18"))
	}
	catch ex {
		w ex.DisplayString()
	}
}

Hello @Padmaja Konduru 

The certificate and private key is configured for the your SSL/TLS connection.  You can try  executing the below code to get some certificates of the certificate

I have attached my sample "test" SSL/TLS which is included the sample certificate and private key (x509)

Call the SSLDetails method with your SSL name. This method will return an local array with some basic details like expire date , subject and so on.  SSL configuration name was taken from the   System > Security Management > SSL/TLS Configurations 

/// Call this method with your ssl name
ClassMethod SSLDetails(SSLName As %String = "") As %Status
{
	new $namespace
	set $namespace="%SYS"
	set ssl=##class(Security.SSLConfigs).%OpenId("test")
	set privateKeyFile = ssl.CertificateFile
	set file = ##class(%FileCharacterStream).%New()
	do file.LinkToFile(privateKeyFile)
	set str=file.Read($$$MaxLocalLength)
	do ..certificateDetails(str,.fields)
	zw fields
	return $$$OK
}

ClassMethod certificateDetails(str As %String, ByRef fields)
{
	#;getting some basic  details
	for field="SerialNumber","Issuer","ValidityNotAfter","ValidityNotBefore","Subject","SubjectKeyIdentifier" {
		set fields(field) = $SYSTEM.Encryption.X509GetField(str,field)
	}
}

output

verify the local array fields("ValidityNotAfter") value for the expired date

IRISMYDEV>do ##class(Sample.NewClass1).SSLDetails("test")
fields("Issuer")="L=test,CN=test,O=test,ST=test,C=us"
fields("SerialNumber")=0
fields("Subject")="L=test,CN=test,O=test,ST=test,C=us"
fields("SubjectKeyIdentifier")=$c(144)_"¾&p"_$c(28)_"áÁZÀ"_$c(140)_"Ô4OÜ"_$c(24)_"º""=B"_$c(137)
fields("ValidityNotAfter")="2023-09-21 06:13:50"
fields("ValidityNotBefore")="2023-09-20 06:13:50"
 

Hello @Michael Wood,

The line property is actually a list of string in address object property. So You should use direct Insert action instead of Set for that property when doing mapping in DTL for single values. If it's list/collection the you should foreach the list property and insert the values to the line() property. Refer the screenshots below for both scenarios.

Direct single Insert

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='CSVtoHL7.Inputfile.Record' targetClass='HS.FHIR.DTL.vR4.Model.Resource.Location' create='new' language='objectscript' >
<assign value='source.FirstName' property='target.address.line' action='insert' key='1' />
</transform>
}

List 

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='CSVtoHL7.Inputfile.Record' targetClass='HS.FHIR.DTL.vR4.Model.Resource.Location' create='new' language='objectscript' >
<foreach property='source.AddressLine()' key='k1' >
<assign value='source.AddressLine.(k1)' property='target.address.line' action='insert' key='k1' />
</foreach>
</transform>
}

result

No. GetColumnType() method returns an integer of the datatype.You can manually get the datatype from the integer.

Class Sample.Person Extends %Persistent
{

Property FirstName As %String;

Property LastName As %String;

Property StartDate As %Library.TimeStamp ;

Property Age As %Integer;

Property TestCurrency As %Currency;

Property TestBoolean As %Boolean;

Property TestCharStream As %Stream.GlobalCharacter;

Query TestQuery() As %SQLQuery [ SqlProc ]
{
    
    select firstname,LastName,Age,TestCurrency,TestBoolean,TestCharStream from Sample.Person
}

ClassMethod GetDataTypeOfField() As %String
{
    set result = ##class(%ResultSet).%New("Sample.Person:TestQuery")
    ;	
    for I=1:1:result.GetColumnCount() {
        write "Column Name: ",result.GetColumnName(I),"  "
        write "Datatype number: ",result.GetColumnType(I),"  "
        write "DataType: ",..GetDataType(result.GetColumnType(I)),!!
    }
}
///Get datatype from the integer
ClassMethod GetDataType(type As %Integer=0) [ CodeMode = expression ]
{
$Case(type,
        1:"BINARY", 2:"DATE", 3:"DOUBLE", 4:"HANDLE",
        5:"INTEGER", 6:"LIST", 	7:"LONGVARCHAR",
        8:"TIME", 9:"TIMESTAMP", 10:"VARCHAR", 11:"STATUS",
        12:"BINARYSTREAM", 13:"CHARACTERSTREAM", 14:"NUMERIC",
        15:"CURRENCY", 16:"BOOLEAN", 17:"OID",
        18:"BIGINT", 19:"FDATE", 20:"FTIMESTAMP",
        :"")
}
}

The output when execute the method GetDataTypeOfField()

IRISMYDEV>d ##class(Sample.Person).GetDataTypeOfField()
Column Name: FirstName  Datatype number: 10  DataType: VARCHAR
 
Column Name: LastName  Datatype number: 10  DataType: VARCHAR
 
Column Name: Age  Datatype number: 5  DataType: INTEGER
 
Column Name: TestCurrency  Datatype number: 15  DataType: CURRENCY
 
Column Name: TestBoolean  Datatype number: 16  DataType: BOOLEAN
 
Column Name: TestCharStream  Datatype number: 13  DataType: CHARACTERSTREAM

refer the documentation here