The documentation includes a lot of info about INSERT OR UPDATE Sql command, including:

"An existing row is one in which the value being inserted already exists in a column that contains a unique constraint. For more details, see Uniqueness Checks."

"When using INSERT OR UPDATE, you can only insert IDKEY column values, not update them. If the table has an IDKEY index and another UNIQUE constraint, INSERT OR UPDATE matches these columns to determine whether to perform an insert or an update. If the other key constraint fails, this forces INSERT OR UPDATE to perform an update rather than an insert. However, if the specified IDKEY column values do not match the existing IDKEY column values, this update fails and generates an SQLCODE -107 error, because the update is attempting to modify the IDKEY columns."

I suggest to read carefully the relevant documentation page.

Enrico

It seems that character 8211 (en dash) is not utf-8 but utf-16, google is your best friend and I'm not an expert in unicode, utf-8, utf-16 etc.! 😊

Set xml="<?xml version=""1.0"" encoding=""UTF-8""?>"
Set xml=xml_"<Text>This is n-dash "_$wc(8211)_" in xml</Text>"
Set xml=$ZCONVERT(xml,"O","UTF8")
Set sc=##class(%XML.XPATH.Document).CreateFromString(xml, .xmlDoc)
Write sc
Set sc=xmlDoc.EvaluateExpression("/Text","text()",.result)
Write result.GetAt(1).Value,!

Result:

This is n-dash – in xml

Enrico

I was surprised that overriding the OnFailureTimeout() in the custom BO class did not work! According to the description that was definitely the way to go. But it indeed does not work(ed).

I opened a WRC and it turned out that there is a bug "around" the OnFailureTimeout() implementation in Ens.BusinessOperation.

So, if anyone need to implement OnFailureTimeout()  with Set ..Retry=1, first it requires to contact WRC, explain the problem and reference DP-426250 to get the fix.

Enrico

Sorry, forgot the namespace, try this:

do ##class(%XML.XPATH.Document).CreateFromStream(pResponse.ContentStream, .tPnRXML)
Set tPnRXML.PrefixMappings="ns urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
Set sc=tPnRXML.EvaluateExpression("/XMLMessage/ContentStream/ns:RegistryResponse/ns:RegistryErrorList/ns:RegistryError","@errorCode",.tPnRResult)
Set tPnRResult.GetAt(1).Value ; Value=XDSRegistryDeprecatedDocumentError

Ciao Pietro,

I'm afraid you cannot change FailureTimeout "at the first iteration", however, for the specific case you describe, in the Business Operation you can override the method OnFailureTimeout() and there programmatically change the default behavior when the FailureTimeout has been reached. Something like:

/// Override this method to provide custom handling of retry / failure timeout.<p/>
/// Set ..Retry=1 to override normal error return and re-evaluate flag properties.<p/>
/// Return 0 to skip further (default) FailureTimeout processing, 1 to perform default processing.
Method OnFailureTimeout(pRequest As %Library.Persistent, Output pResponse As %Library.Persistent, ByRef pSC As %Status) As %Boolean
{
	If pRequest.severity = "high" {
		Set ..Retry=1
		Quit 0
	} Else {
		Quit 1
	}
}

This is just a simple example, you may want to test/check pSC....

Give it a try and let us know.

Ciao,

Enrico

It's an issue of the jTDS, using the connection the second time and IRIS try to reuse the connection there is an error:

ERROR #5023: Remote Gateway Error: java.lang.AbstractMethodError
        at net.sourceforge.jtds.jdbc.JtdsConnection.isValid(JtdsConnection.java:2833)
        at com.intersystems.jdbcgateway.JDBCGateway.isValid(JDBCGateway.java:1982)
        at com.intersystems.jdbcgateway.JDBCGatewayHelper.processMessage(JDBCGatewayHelper.java:642)
        at com.intersystems.gateway.JavaGateway.getJDBCGatewayMessage(JavaGateway.java:2015)
        at com.intersystems.gateway.JavaGateway.processMessage(JavaGateway.java:519)
        at com.intersystems.gateway.JavaGateway.run(JavaGateway.java:458)
        at com.intersystems.gateway.JavaGateway.run(JavaGateway.java:421)

My guess is that for IRIS the connection "is not valid" therefore open a new connection.

It's a known issue already reported.

If you search for "jTDS AbstractMethodError isValid()" you will find many entries..

Enrico

I know this is old, but recently I found a new way to export/import a package to a global, this may simplify the solution.

1) create a studio project with all the classes that need to me exported. This can be done programmatically, create an instance of %Studio.Project, use AddItem()...etc.

2) Export the project to a global like ^IRIS.Temp("myProjExport"). Open %Studio.Project, export ot global using DeployToGbl() method

3) in target namespace import calling ##class(%Studio.Project).InstallFromGbl()

Using ^IRIS.Temp has the advantage of easy/shared access from all namespaces.

Enrico

Personally I'd rather use a default numeric ID and if needed an additional UUID/GUID unique property.

To implement what you asked you can use something like:

Class My.TestClass Extends %Persistent
{
Property PrimaryUUID As %String [ InitialExpression = {$system.Util.CreateGUID()} ];
Property MyOtherData As %String;

Index PrimaryUUIDIndex On PrimaryUUID [ IdKey, Unique ];
}

In this way the primary key (PrimaryUUID) is automatically assigned, no need to set it manually, in SQL is mapped as ID (as well as PrimaryUUID).

Enrico

I would  send the message to a Business Operation and set state as deferred, then "later" (when? what trigger? from where?) using some logic, choose the message(es) and send response to that BO from somewhere (Business Service? Any other Business Host? ...to little info to know) to continue the process.

Not enough info to elaborate it further.

Enrico

You can change the port from 57772 to 80 in System Managment Portal: System Administrtion -> Configuration -> Additional Settings -> Startup -> WebServerPort

Or cache.cpf configurtion file:

WebServerPort=57772  to WebServerPort=80

Better, proper and suggested solution: install a properly configured web server using port 80, don't use the little web server installed by Ensemble.

Enrico