我正在尝试使用 HTTPCLOB 函数向 Web 服务发出 POST 请求,但是当我运行程序时,我得到了标题中的错误,无论我努力将我的 SQL 语句的字段类型与那些功能。这里的 D 规格:
D url s 1024a varying
D httpHeader s 1024a varying inz
D requestMsg s 32000a varying inz
D resHttpHeader s 32000a varying inz
D resMsg s 32000a varying inz
这是 SQL 语句:
url = 'https://labelservice.gls-italy.com/AddParcel';
requestMsg = 'XMLInfoParcel: ' + xmlData;
httpHeader = 'Content-Type: application/x-www-form-urlencoded;'
+ ' Content-Length: ' + %char(%len(requestMsg))
;
exec sql
select cast(responseMsg as clob(2G))
// , cast(responseHttpHeader as varchar(512))
into :resMsg
// , :resHttpHeader
from table(systoools.HTTPCLOB(
URL => cast(:url
as varchar(2048)),
HTTPMETHOD => 'POST',
HTTPHEADER => cast(:httpHeader
as clob(10K)),
REQUESTMSG => cast(:requestMsg
as clob(2G))
)
) as httpRequest
;
其中 xmlData 是一个 xml 变量,其中包含一些内容。我认为可能还有其他错误,因为这是我第一次尝试使用此功能。无论如何,至于这里的 IBM 文档 https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzajq/rzajqudfhttpclob.htm 变量的类型匹配。我究竟做错了什么?