pArrayData syntax for InfoPathService.asmx web service


Badge +2
What is the Syntax for pArrayData when calling the InfoPath Service InfoPathService.asmx?

thanks.

3 replies

Badge +2
Looks like i'll answer my own question:

To invoke SubmitInfoPathData in the InfoPathService, pass the InfoPath xml instance document as the 1st element in the pArrayData.


icon-quote.gifj.monty:
What is the Syntax for pArrayData when calling the InfoPath Service InfoPathService.asmx?

thanks.
Badge +1
I'm trying to accomplish the same. Could you post the code for this? Thanks.
Badge +2
Well, i determined that starting the InfoPathService.asmx was a bit more challenging then just using the K2ROM to acomplish this task. It's much easier and it's supported by K2. I'm not sure SourceCode intended some of the K2 Web Services to be used directly anyway where-as the K2ROM IS intended to be used and should be fully supported.

I've attached a method in C# that will use the K2ROM to submit an xml file generated from an InfoPath form. Basically all you do is set the XmlField called K2InfoPathSchema to the value of the XML from a filled out infopath form.

I don't recall, but I suspect if you want the folio to be set, it will probably need to be set programatically in the code below.

public void StartInfoPathProcess(
string k2Server,
string k2ConnectionString,
string processName,
string infoPathXmlFilePath
)
{
// Make sure XML file exists
if(File.Exists(infoPathXmlFilePath))
{
// Load the InfoPath xml Document
XmlDocument document = new XmlDocument();
document.Load(infoPathXmlFilePath);

// Store the XML document in a string
string infoPathXml = document.OuterXml;

Connection c = new Connection();

try
{
// Open the connection to K2 Server, and Create the process
c.Open(k2Server, k2ConnectionString);
ProcessInstance instance = c.CreateProcessInstance(processName);

// Find the K2InfoPathSchema in the Process XmlFields
// collection and set it's value
foreach(XmlField field in instance.XmlFields)
{
if(field.Name.Equals("K2InfoPathSchema"))
{
// Yes, set it's value
field.Value = infoPathXml;

// And start the process
c.StartProcessInstance(instance);
return;
}
}

// If we get down here, the K2InfoPathSchema wasn't found
// in the Process XmlFields
// This is an error condition
throw new ApplicationException("Unable to find the K2InfoPathSchema in the XmlFields.");
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
c.Close();
}
}
}

Reply