最近帖子:
最近的答复:

请您提供CDS 文件示例,我实在不知道CDS文件是什么。

不知你用的什么版本的产品,如果是2019.3.0之前的版本,需要手动在HTTP header中设定content-length

可以参考下面代码

ClassMethod GetGenericMessage(request As %String) As %Status
{
               set status = $$$OK, kb = "ENSEMBLE"
                set url = "rdr/interpreter/query?kbcode="_kb
                /// Get the message from Antrim
                set stream = request.StreamGet()
                set xStream = stream.Read(3500000)
                $$$TRACE("*****Stream String: "_xStream)
                set contentLength = $length(xStream)
                $$$TRACE("*****Length "_contentLength)
                /// Set the headers for posting orders/results to CDS.
                set tRequest=##class(EnsLib.HTTP.GenericMessage).%New()
                set headerA=##class(%ArrayOfDataTypes).%New()
                do headerA.SetAt("POST","httprequest")
                do headerA.SetAt(url,"url")
                do headerA.SetAt("gzip","accept-encoding")
                do headerA.SetAt("Mozilla/4.0 (compatible; Cache;)","user-agent")
                do headerA.SetAt(contentLength,"content-length")
                do headerA.SetAt("application/json","content-type")
                set tRequest.HTTPHeaders = headerA
                $$$TRACE("*****tRequest: "_tRequest)
                set tRequest.Stream = stream
               quit tRequest
}

如果是2019.3或者之后的版本,HTTP header会自动设定content-length的值。

关注者:
正在关注:
Louis 尚未关注任何人。
Global Masters 徽章: