我试图弄清楚如何使用此节点模块实际发布数据: https://github.com/SamDecrock/node-http-ntlm
看起来帖子应该类似于: https://github.com/SamDecrock/node-httpreq#post
但是httpreq的文档实际上并没有显示POSTing值,我只看到参数或如何POST整个文件。我正在使用节点,并在这些方面有一些东西:
NodeClient.prototype.create = function (xml) {
var options = {
url: this.url,
username: this.user,
password: this.pw,
domain: this.domain,
headers: {
'Content-type': 'text/plain'
}
};
return new Promise(function (resolve, reject) {
httpntlm.post(options,
function (err, resp) {
if(err) {
reject(err);
}
resolve(resp.body);
});
});
};
显然我从不发送我的xml对象,所以我需要弄清楚如何包含它。阅读文档并没有把我引向任何地方。
答案 0 :(得分:1)
要向帖子添加内容,您可以添加以下选项:
答案 1 :(得分:0)
您可以像这样发布xml:
DECLARE @Handle AS INT; -- The handle of the XML data, passed to sp_xml_preparedocument
DECLARE @Xml AS NVARCHAR(1000); -- The XML document for this example
SET @Xml = N'
<SiBikNet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.ws.bik.pl/ws/ki/2v2/types">
<BIK_REQUEST xmlns="">
<consentDate>2018-08-04</consentDate>
<citizenshipStatus>citizen</citizenshipStatus>
<nationality>PL</nationality>
<pesel>123</pesel>
<documentType>idCard</documentType>
<documentId>CCH12</documentId>
<surname>xxx</surname>
<forename>yyy</forename>
<country>PL</country>
<postcode>11111</postcode>
<city>wqreewqw</city>
<street>wetww</street>
<houseNumber>23</houseNumber>
<localNumber>32</localNumber>
<numberOfParticipants>1</numberOfParticipants>
<applicationCurrency>PLN</applicationCurrency>
<creditAmount>2000</creditAmount>
<clientRelationToApplication>mainBorrower</clientRelationToApplication>
</BIK_REQUEST>
<siBikNetQuery xmlns="">
<creditInquiry>
<inquiryHeader>
</inquiryHeader>
</creditInquiry>
</siBikNetQuery>
</SiBikNet>';
EXEC sys.sp_xml_preparedocument @Handle OUTPUT , @Xml, N'<SiBikNet xmlns:t="https://www.ws.bik.pl/ws/ki/2v2/types"/>'; --Prepare a parsed document
SELECT *
FROM
OPENXML(@Handle,'/*[local-name()="SiBikNet"]', 2)
WITH ( consentDate NVARCHAR(10) '/*[local-name()="BIK_REQUEST"]',
citizenshipStatus NVARCHAR(10) '/*[local-name()="BIK_REQUEST"]',
nationality NVARCHAR(10) '/*[local-name()="BIK_REQUEST"]' ,
subscriberId NVARCHAR(10) '/*[local-name()="siBikNetQuery"]',
subscriberUnitId NVARCHAR(10) '/*[local-name()="siBikNetQuery"]',
testDataMarker NVARCHAR(10) '/*[local-name()="siBikNetQuery"]'
);
EXEC sys.sp_xml_removedocument @Handle;