gpt4 book ai didi

javascript - 如何在 adobe acrobat reader 中获取 SOAP 网络服务的响应?

转载 作者:行者123 更新时间:2023-11-28 04:28:10 35 4
gpt4 key购买 nike

我创建了一个肥皂网络服务,并希望在 adobe acrobat reader 中显示该网络服务的响应。我在 adobe acrobat->reader->javascripts 文件夹中创建了一个名为 MenuConfig.js 的新文件,并在该文件中添加了代码。现在我尝试使用 ajax 调用来显示 SOAP Web 服务的响应。

这是我的代码:

app.addMenuItem({
cName: "-",
cParent: "File",
cExec: " "
});
app.addMenuItem({
cName: "Save to Sharepoint",
cParent: "File",
cExec: "ShowDialog()",
nPos: 0
});

// Dialog Definition
var oDlg = {
strName: "",
initialize: function(dialog) {
dialog.load({
"desc": this.strName
});
},
commit: function(dialog) {
var data = dialog.store();
this.strName = data["desc"];
},
description: {
name: "Sharepoint", // Dialog box title
align_children: "align_left",
width: 250,
height: 250,
elements: [{
type: "cluster",
name: "Save File",
align_children: "align_left",
elements: [{
type: "view",
align_children: "align_row",
elements: [{
type: "static_text",
name: "Description",
width: 70
},
{
item_id: "desc", //item_id needs 4 characters only
type: "edit_text",
alignment: "align_right",
width: 200,
height: 20
}
]
},
{
type: "view",
align_children: "align_row",
elements: [{
type: "static_text",
name: "1. Client",
width: 70
},
{
item_id: "Clnt",
type: "popup",
alignment: "align_right",
width: 165,
height: 20
}
]
},
{
type: "view",
align_children: "align_row",
elements: [{
type: "static_text",
name: "2. Matter",
width: 70
},
{
item_id: "Matr",
type: "popup",
alignment: "align_right",
width: 165,
height: 20
}
]
},
{
type: "view",
align_children: "align_row",
elements: [{
type: "static_text",
name: "3. Doc. Type",
width: 70
},
{
item_id: "DocT",
type: "popup",
alignment: "align_right",
width: 165,
height: 20
}
]
},
{
type: "view",
align_children: "align_row",
elements: [{
type: "static_text",
name: "4. User ID",
width: 70
},
{
item_id: "UsID",
type: "edit_text",
alignment: "align_right",
width: 200,
height: 20
}
]
},
{
//alignment: "align_right",
type: "ok_cancel",
align_children: "align_row",
ok_name: "Ok",
cancel_name: "Cancel"
}
]
}]
}
};

function ShowDialog() {
var listId = '{19736DC6-B732-4D25-8DAA-9E0FD808CA30}';
var siteUrl = "http://www.rajman.in/json/productlistclient.php?wsdl";
oDlg.strName = "Larry";
if ("ok" == app.execDialog(oDlg)) {
getDocTypeListItems(siteUrl, listId);
}
}

function getDocTypeListItems(siteUrl, listId) {
var cURL = "http://www.rajman.in/json/productlist.php?wsdl";
ajax = function(siteUrl) {
var params = {
cVerb: "GET",
cURL: siteUrl,
oHandler: {
response: function(msg, uri, e, h) {
var stream = msg;
var string = "";
string = SOAP.stringFromStream(stream);
app.alert(string);
}
}
};

Net.HTTP.request(params);
}
}

最佳答案

两个问题:

1) 您无法使用 Acrobat JavaScript 扩展来使用 ajax 进行连接; ajax 是 JavaScript 的浏览器扩展。 Reader/Acrobat 的 Javascript 看起来更像这样

   var oAuthenticator =
{
Username: "myUserName",
Password: "myPassword"
};
var response = SOAP.request(
{
cURL: cURL,
oRequest: {
"http://soapinterop.org/:echoString":
{
inputString: cTestString
}
},
cAction: "http://soapinterop.org/",
oAuthenticate: oAuthenticator
});

然后您将处理响应对象。请参阅此处有关如何使用 Acrobat 扩展连接到 SOAP 的文档... http://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/index.html#t=Acro12_MasterBook%2FJS_API_AcroJS%2FSOAP_methods.htm%23TOC_request1bc-4&rhtocid=_6_1_8_70_1_3

2) 除非文件启用了扩展使用权限,否则您根本无法在 Adob​​e Reader 中使用 SOAP...除非您使用 LiveCycle 或 Datalogics PDF JavaToolkit,否则您无法执行此操作。您无法使用 Acrobat 添加 SOAP 使用权限。使用权往往相当昂贵,因此您可能需要重新考虑您的解决方案。您可以通过添加一个步骤来完成同样的事情,其中​​ SOAP 响应在服务器上重新格式化为 FDF 或 XFDF,FDF 或 XFDF 可以由 Reader/Acrobat 自动导入,并且是免费的解决方案。

关于javascript - 如何在 adobe acrobat reader 中获取 SOAP 网络服务的响应?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44858114/

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