LiveCycle PDF 以 XML 形式提交到 .NET Web 服务

发布于 2024-08-30 19:05:48 字数 397 浏览 4 评论 0原文

我有一个 LiveCycle 设计的 PDF,我想让它的提交按钮将表单中的 XML 数据发送到 .NET Web 服务。我知道如何做到这一点,但我不太清楚网络服务方面。我的 Web 服务的方法签名应该是什么来接受 XML 数据?

[WebMethod]
public bool RecieveXML(XmlDocument input)

或者

[WebMethod]
    public bool RecieveXML(string input)

收到 XML 后,我只想将 XML 作为附件通过电子邮件发送(我可以自己管理),但是有没有办法让我的 web 服务的 bool 返回类型使 PDF 向用户显示成功/失败消息?

I have a LiveCycle designed PDF that I want to make its submit button send the XML data in the form to a .NET webservice. I see how to do that, but I'm not really clear on the webservice side. What should my webservice's method signature be to accept the XML data?

[WebMethod]
public bool RecieveXML(XmlDocument input)

or

[WebMethod]
    public bool RecieveXML(string input)

?

After I receive the XML I just want to email the XML as an attachment (which I can manage on my own), but is there any way for my webservice's bool return type to cause the PDF to show a success/fail message to the user?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

妞丶爷亲个 2024-09-06 19:05:48

您需要返回 fdf 数据(具有适当的 mime 类型集),其中嵌入了 javascript 指令。我还没有尝试过使用Webservice,我只使用了一个简单的aspx页面并使用Response.Write返回数据。

以下是应返回的数据格式: 将表单提交给 asp .net 服务器。

至于接收数据,我是这样做的(代码位于页面加载事件中):

            if (Request.RequestType.ToUpper() == "POST")
            {
                using (StreamReader rd = new StreamReader(Request.InputStream))
                {
                   string response = string.Empty;
                   try
                   {
                      Process(rd.ReadToEnd());

                      response = GetFDF(true);
                   }
                   catch (Exception)
                   {
                      response = GetFDF(false);
                   }

                   Response.ContentType = "application/vnd.fdf";
                   Response.Output.Write(response);
                   Response.End();
                }
            }

由于输入是 xml 字符串,因此您可以使用 XmlSerializer 反序列化输入在一个类的实例中。

You need to return fdf data (with appropriate mime type set) which has javascript instructions embedded in it. I have not tried it with webservice, I used just a simple aspx page and used Response.Write to return the data.

Here is format of the data should be returned: Submitting form to asp.net server.

As for receiving the data here is how I did it (the code is in page load event):

            if (Request.RequestType.ToUpper() == "POST")
            {
                using (StreamReader rd = new StreamReader(Request.InputStream))
                {
                   string response = string.Empty;
                   try
                   {
                      Process(rd.ReadToEnd());

                      response = GetFDF(true);
                   }
                   catch (Exception)
                   {
                      response = GetFDF(false);
                   }

                   Response.ContentType = "application/vnd.fdf";
                   Response.Output.Write(response);
                   Response.End();
                }
            }

As the input is xml string you can use XmlSerializer to deserialize the input in an instance of a class.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文