Hello,
We have an XML Document coming into Ensemble and then writing out to a flat file. If we receive a document that is very large, the XML is being truncated. The Business Service is setup to a %GlobalStream and we do receive smaller XML documents.
Any help is appreciated.
Class SoarianFinancialGL.SFGLXMLBS Extends Ens.BusinessService [ ProcedureBlock ]
{
Property SendAcknowledgement As %Boolean [ InitialExpression = 1 ];
Parameter ADAPTER = "SoarianFinancialGL.SFGLCountedAdapter";
Method OnProcessInput(pInput As %RegisteredObject, Output pOutput As %IO.StringStream) As %Status
{
d pInput.Rewind()
set request = ##class(SoarianFinancialGL.SFGLXMLRequest).%New()
d request.data.CopyFrom(pInput)
d request.data.Rewind()
//set tSC = ..SendRequestAsync("SoarianFinancialGL.SFGLBP",request)
set tsc = ..SendRequestAsync("SaveXMLtoFileBO",request)
w:..SendAcknowledgement "L"_$C(6)_"000008",*-3
quit tSC
}
}

Mark Nunziato
Albany Medical Center
Integration Services
--
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare Community" group.
To post to this group, send email to Ensemble-in...@googlegroups.com
To unsubscribe from this group, send email to Ensemble-in-Healt...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Ensemble-in-Healthcare?hl=en
Hi Dale,
Below is the CountedAdapter Code we are using:
Class SoarianFinancialGL.SFGLCountedAdapter Extends EnsLib.TCP.CountedInboundAdapter [ ProcedureBlock ]
{
Method ReadCountedStream(ByRef pStream As %CharacterStream, pCharset As %String = "", pStartTimeout As %Numeric = -1, pChunkTimeout As %Numeric = 60, pInbound As %Boolean = 0) As %Status
{
Set tSC=$$$OK, $ZT="TrapRS"
Do {
If 'pInbound {
$$$sysTRACE("Waiting to read counted data block from "_..IOAddr_" into Stream using charset '"_pCharset_"' with timeout="_pStartTimeout)
}
Do SetIO^%NLS("RAW") ; Switch to RAW input mode
//start altered code (adjusted for 9 byte header)
If -1=pStartTimeout { Read tLenStr#9 Set tTimedOut = 0 }
Else { Read tLenStr#9:pStartTimeout Set tTimedOut = '$Test }
Set $ZT="Trap"
If tTimedOut { Set tSC = $$$ERROR($$$EnsErrTCPReadBlockSizeTimeoutExpired,pStartTimeout,4) Quit }
#; Convert to integer
Set tLen=+$E(tLenStr,3,9)-9 //since length includes the header need to minus that for actual data length
set header = tLenStr
Quit:0=tLen
//end altered code
Set tTable = ##class(%IO.I.TranslationDevice).GetCharEncodingTable(pCharset)
If "RAW"=tTable {
$$$sysTRACE("Got block count="_tLen_", waiting to read (raw) with timeout="_pChunkTimeout)
Set tSC = pStream.InputFromDevice(.tLen,pChunkTimeout) Quit:$$$ISERR(tSC)
} Else {
$$$sysTRACE("Got block count="_tLen_", waiting to read in 8k chunks using charset '"_pCharset_"' with chunk timeout="_pChunkTimeout)
Set tStream = ##Class(%Library.FileCharacterStream).%New() $$$ASSERT($IsObject(tStream))
Set tLeft = tLen, tMaxChunk=$$$GetClassParameter("%Library.FileCharacterStream","MAXLOCALSIZE")
set ^mas(2) = "in here"
While tLeft>0 {
Set tChunkSize = $select(tLeft>tMaxChunk:tMaxChunk,1:tLeft)
Set tStartTime=$zh
Read data#tChunkSize:pChunkTimeout If '$Test {
If $zh-tStartTime < pChunkTimeout { Set tSC = $$$EnsError($$$EnsErrTCPReadBlockSize,pChunkTimeout,tChunkSize,"("_$L(data)_"):"_data) Quit }
Else { Set tSC = $$$EnsError($$$EnsErrTCPReadTimeoutExpired,pChunkTimeout,tChunkSize,pCharset) Quit }
}
$$$sysTRACE("Got data chunk, size="_$length(data)_"/"_tChunkSize)
Set tLeft = tLeft-$length(data)
Do tStream.Write(data) ; Save out to the stream from the data we read in from the socket
}
Set tStream.TranslateTable = tTable, tSC = pStream.CopyFrom(tStream) Quit:$$$ISERR(tSC)
$$$sysTRACE("Converted("_tLen_") input bytes to ("_pStream.Size_") characters using charset '"_pCharset_"', table '"_tTable_"'")
}
$$$sysTRACE("TCP Read block("_pStream.Size_")")
} While (0)
Exit
Quit tSC
TrapRS
Set $ZT="", tSC=$$$SystemErrorType("Block Count")
Goto Exit
Trap
Set $ZT="", tSC=$$$SystemError
Goto Exit
}
Hi James,
We entered Globals to capture the length and it looks like it caps at 49991. Please see below:
^IS=49991
^IS(1472)=49991
^IS(3976)=49991
^IS(4420)=49991
^IS(4592)=49991
Having the Counted Adapter set to %CharacterStream, I would think it wouldn’t care of the length?
Thanks
Mark