views:

371

answers:

1

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?

+1  A: 

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.

Giorgi
Thanks, that will solve the 2nd part of my question. :D
jamone
Could you show me what your simple aspx page looks like to receive the initial form submission?
jamone
Yes, I can show it when I get home.
Giorgi
Thanks a bunch.
jamone
@jamone - I have updated the answer.
Giorgi
Worked like a charm. Thanks.
jamone