C
Clayton
Is it possible to have a Secondary Data Source accept a complex data type as
an arguement?
Basically, in the form_submit, I would like to send my form as an arguement
and have the webservice return the database primary key back.
Currently it is sending my complex type as a literal string (encoded) and
not as a complex type.
My code:
public void FormEvents_Submit(object sender, SubmitEventArgs e)
{
try
{
XPathNavigator inputNav =
this.MainDataSource.CreateNavigator().SelectSingleNode("/my:MyTestInfoPathForm",
this.NamespaceManager);
WebServiceConnection receiveConnection =
(WebServiceConnection)this.DataConnections["WebServiceDS"];
XPathNavigator webServiceNavigator =
this.DataSources["PersistApplication2"].CreateNavigator();
// Set the arguements
webServiceNavigator.SelectSingleNode("/dfs:myFields/dfs:queryFields/ns1:WebServiceTest/ns1:formXml",
this.NamespaceManager).SetValue(inputNav.OuterXml); // Argument 1 of WS
webServiceNavigator.SelectSingleNode("/dfs:myFields/dfs:queryFields/ns1:WebServiceTest/my:dpaProxy",
this.NamespaceManager).SetValue(inputNav.InnerXml); // Arguement 2 of WS
receiveConnection.Execute();
// Get the returned value
XPathNavigator outputNav =
webServiceNavigator.SelectSingleNode("/dfs:myFields/dfs:dataFields/ns1:WebServiceTestResponse/ns1ersistApplicationResult",
this.NamespaceManager);
string uniqueKey = Convert.ToString(outputNav);
e.CancelableArgs.Cancel = false;
}
catch (Exception ex)
{
e.CancelableArgs.Cancel = true;
}
}
an arguement?
Basically, in the form_submit, I would like to send my form as an arguement
and have the webservice return the database primary key back.
Currently it is sending my complex type as a literal string (encoded) and
not as a complex type.
My code:
public void FormEvents_Submit(object sender, SubmitEventArgs e)
{
try
{
XPathNavigator inputNav =
this.MainDataSource.CreateNavigator().SelectSingleNode("/my:MyTestInfoPathForm",
this.NamespaceManager);
WebServiceConnection receiveConnection =
(WebServiceConnection)this.DataConnections["WebServiceDS"];
XPathNavigator webServiceNavigator =
this.DataSources["PersistApplication2"].CreateNavigator();
// Set the arguements
webServiceNavigator.SelectSingleNode("/dfs:myFields/dfs:queryFields/ns1:WebServiceTest/ns1:formXml",
this.NamespaceManager).SetValue(inputNav.OuterXml); // Argument 1 of WS
webServiceNavigator.SelectSingleNode("/dfs:myFields/dfs:queryFields/ns1:WebServiceTest/my:dpaProxy",
this.NamespaceManager).SetValue(inputNav.InnerXml); // Arguement 2 of WS
receiveConnection.Execute();
// Get the returned value
XPathNavigator outputNav =
webServiceNavigator.SelectSingleNode("/dfs:myFields/dfs:dataFields/ns1:WebServiceTestResponse/ns1ersistApplicationResult",
this.NamespaceManager);
string uniqueKey = Convert.ToString(outputNav);
e.CancelableArgs.Cancel = false;
}
catch (Exception ex)
{
e.CancelableArgs.Cancel = true;
}
}