Return xml document with processFormSubmission when content type is CONTENT_TYPE=application/x-www-form- urlencoded

excepti0nal

06-03-2015

I am building a C# .net web application POC. Im using the version 11 livecycle api. The flow is:

  • Call renderHTMLForm and send a data xml and xdp to the service to return an html form
  • The form is displayed to the user to make changes and submit
  • I am then calling processFormSubmission to submit the data with the content type set to CONTENT_TYPE=application/x-www-form- urlencoded

I am then returned data in a url encoded format. In the RenderOptionsSpec, i am specifying XMLData = true because I would like to work with an xml document, rather than urlencoded data. In the response, the xml object comes back but the byte count is always zero. Does anyone know if I am missing something? Or does adobe not support the xml data return on a url encoded content request?

Thank you in advance for any help

Here is the code to create the html form:

FormsServiceClient.Open();

                //View model xml

                BLOB inDataDoc = new BLOB { MTOM = request.FormContent };

                //Specifications for html rendering

                HTMLRenderSpec htmlRenderSpec = new HTMLRenderSpec

                {

                    locale = GetLocale(request.LanguagePreference),

                    outputType = OutputType.BodyTags,

                    styleGenerationLevel = StyleGenerationLevel.InlineAndInternalStyles,

                    XMLData = true,

                };

                //Out variables

                BLOB outDataDoc = new BLOB();

                long numberOfPages;

                string locale;

                string actualRender;

                FormsResult formResult;

                //URL Specs for target action and templates

                URLSpec uriValues = new URLSpec

                {

                    applicationWebRoot = ConfigurationManager.AppSettings["formServiceWebRoot"],

                    contentRootURI = Path.Combine(TemplateDirectory, request.TemplateJurisdiction),

                    targetURL = request.ActionUrl,

                };

                //Call Adobe

                FormsServiceClient.renderHTMLForm(

                     request.TemplateName + "_Button.xdp",

                     TransformTo.XHTML,

                     inDataDoc,

                     htmlRenderSpec,

                     request.UserAgent,

                     uriValues,

                     null,

                     out outDataDoc,

                     out numberOfPages,

                     out locale,

                     out actualRender,

                     out formResult);

                FormResponseContract response = TranslateAdobeResponse(formResult);

                FormsServiceClient.Close();

_______________________________________________________________________________________________________________________________________________________

Code to post the form back and get response data:

using (request.RequestStream)

               {

                   FormsServiceClient.Open();

                   if (request.RequestStream == null) throw new Exception("requestStream cannot be null");

                   byte[] buffer = ReadFully(request.RequestStream);

                   FileTools.WriteToDisk(buffer, @"C:\temp\tempFile.txt");

                   BLOB formData = new BLOB { binaryData = buffer };

                   RenderOptionsSpec renderOptionsSpec = new RenderOptionsSpec

                   {

                       locale = GetLocale(request.LanguagePreference),

                       XMLData = true,

                       cacheEnabled = false,

                       exportDataFormat = "XMLData"

                   };

                   string clickedButton;

                   BLOB output = new BLOB();

                   BLOB validationErrorList = new BLOB();

                   short action;

                   MyArrayOf_xsd_anyType arrayOfXsd = new MyArrayOf_xsd_anyType();

                   FormsResult formsResult = new FormsResult();       <--------------------------------------------XMLData property has value but binaryData byte count is 0 after the service call below

                   FormsServiceClient.processFormSubmission(formData,

                       "CONTENT_TYPE=application/pdf&CONTENT_TYPE=application/vnd.adobe.xdp+xml&CONTENT_TYPE=text/xml&CONTENT_TYPE=application/x-www-form- urlencoded",

                        request.UserAgent, renderOptionsSpec,

                       out clickedButton, out output, out validationErrorList, out action, out arrayOfXsd, out formsResult);

                   if (formsResult.XMLData != null && formsResult.XMLData.binaryData.Length > 0)

                       FileTools.WriteToDisk(formsResult.XMLData.binaryData, @"C:\Temp\returnedXml");

                   //FormResponseContract response = TranslateAdobeResponse(formsResult);

                   //TODO: Add another translate method for the posted response

                   FormResponseContract response = new FormResponseContract();

                   response.FormContent = formsResult.outputContent.binaryData;

                   FormsServiceClient.Close();

                   return response;

Accepted Solutions (0)

Answers (0)