gpt4 book ai didi

node.js - 如何理解node-soap "describe"函数?

转载 作者:搜寻专家 更新时间:2023-10-31 22:52:40 24 4
gpt4 key购买 nike

我正在尝试使用 Node SOAP npm 模块(https://github.com/vpulim/node-soap)服务。

var soap = require('soap');
var soapWSDL = "https://webservice.s7.exacttarget.com/etframework.wsdl";

soap.createClient(soapWSDL, function (err, client) {
if (err) {
return callback(err, null);
}

client.setSecurity(new soap.WSSecurity(self.username, self.password));

console.log("describe", client.describe());
console.log("retrieve", client.describe().PartnerAPI.Soap.Retrieve);
});

第一个日志显示了可用的方法...

但我试图从第二个 console.log 中了解参数所需的确切格式...

更具体地说,当我调用 client.Retrieve(options,function(e,r){}); options< 所需的格式是什么 应该是?

这是两个console.logs的输出

描述:

 { PartnerAPI: 
{ Soap:
{ Create: [Object],
Retrieve: [Object],
Update: [Object],
Delete: [Object],
Query: [Object],
Describe: [Object],
Execute: [Object],
Perform: [Object],
Configure: [Object],
Schedule: [Object],
VersionInfo: [Object],
Extract: [Object],
GetSystemStatus: [Object] } } }

检索:

 { input: 
{ RetrieveRequest:
{ 'ClientIDs[]': [Object],
ObjectType: 'xsd:string',
'Properties[]': 'xsd:string',
Filter: [Object],
'RespondTo[]': [Object],
'PartnerProperties[]': [Object],
ContinueRequest: 'xsd:string',
QueryAllAccounts: 'xsd:boolean',
RetrieveAllSinceLastBatch: 'xsd:boolean',
RepeatLastResult: 'xsd:boolean',
Retrieves: [Object],
Options: [Object],
targetNSAlias: 'tns',
targetNamespace: 'http://exacttarget.com/wsdl/partnerAPI' } },
output:
{ OverallStatus: 'xsd:string',
RequestID: 'xsd:string',
'Results[]':
{ Client: [Object],
PartnerKey: 'xsd:string',
'PartnerProperties[]': [Object],
CreatedDate: 'xsd:dateTime',
ModifiedDate: 'xsd:dateTime',
ID: 'xsd:int',
ObjectID: 'xsd:string',
CustomerKey: 'xsd:string',
Owner: [Object],
CorrelationID: 'xsd:string',
ObjectState: 'xsd:string',
targetNSAlias: 'tns',
targetNamespace: 'http://exacttarget.com/wsdl/partnerAPI' } } }

最佳答案

在此示例中,您应该查看键名和格式。例如,任何在末尾带有 [] 的键都意味着这应该是一个 SOAP 序列。在没有看到输入/输出的完整格式的情况下,我无法 100% 确定某些内容 - 您可以尝试使用 Node.js 的 util 函数来深入检查对象。例如:

var utils = require('utils');
/* later */
console.log( utils.inspect( testObject, {depth: null} ) );

尽我所能回答你的问题:

var args = {
ClientIDs: [{ /* Some object - not sure without inspect */ }],
ObjectType: 'someString',
Properties: ['someString', 'someString'],
Filter: { /* Some object - not sure without inspect */ },
RespondTo: [{ /* Some object - not sure without inspect */ }],
PartnerProperties: [{ /* Some object - not sure without inspect */ }],
ContinueRequest: 'someString',
QueryAllAccounts: true, /* or false */
RetrieveAllSinceLastBatch: true, /* or false */
RepeatLastResult: true, /* or false */
Retrieves: [{ /* Some object - not sure without inspect */ }],
Options: [{ /* Some object - not sure without inspect */ }]
}

client.RetrieveRequest(args, function(err, result, raw, soapHeader) {
/* do something with the result */
});

关于node.js - 如何理解node-soap "describe"函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25297930/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com