开发者

LiveCycle PDF submit to .NET webservice as XML

开发者 https://www.devze.com 2022-12-28 16:59 出处:网络
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 s

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 manag开发者_StackOverflow社区e 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号