C
Clayton
I am submitting my InfoPath 2007 form to a traditional asmx web service that
accepts one argument - the form contents. The webservice takes this, adds it
to my database and returns the primary key that I will store in the infoPath
document. My problem is I cannot get this to work. Has anybody had success
in getting the overloaded webServiceConnection.Execute(XPathNav inputNav,
XPathNav outputNav, XPathNav errorsNav) to work? How did you do it and what
am I missing?
Below is my code from my infopath FormEvents_Submit method - it is
relatively straightforward.
I have a web service connection, and when I submit it using the traditional:
WebServiceConnection submitConnection =
(WebServiceConnection)this.DataConnections["PersistApplication"];
submitConnection.Execute();
....the value of my form makes it through but obviously I have no way to
capture the returned primary key.
So I tried using the overloaded Execute method:
XPathNavigator inputNav =
this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields",
this.NamespaceManager);
XPathNavigator outputNav = outputDocument.CreateNavigator();
XPathNavigator errorsNav = errorsDocument.CreateNavigator();
submitConnection.Execute(inputNav, outputNav, errorsNav);
This allowed me to retrieve my primary key but for some reason my form
contents were not being passed through to the web service...debugging the
web method told me it was receiving null.
So then I used a packet sniffer to determine the difference between the 2.
It was apparent that the overloaded Execute that accepted (inputNav,
outputNav, errorsNav) was not wrapping up my soap request properly to point
my webservice.
The request when Using submitConnection.Execute();
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<tns
ersistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
<?xml version="1.0"?><?mso-infoPathSolution
name="urn:schemas-microsoft-com
ffice:infopath:TestTemplate:-myXSD-2007-11-29T16-25-09"
solutionVersion="1.0.0.102" productVersion="12.0.0" PIVersion="1.0.0.0"
?><?mso-application progid="InfoPath.Document"
versionProgid="InfoPath.Document.2"?><my:myFields
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"
xmlns:tns="http://tempuri.org/"
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-11-29T16:25:09"
xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"
xml:lang="en-us">
<my:applicationId></my:applicationId>
<my:Applicant>
<my:fullName>test guy</my:fullName>
<my:municipality>sanfran</my:municipality>
</my:Applicant>
</my:myFields>
</tns:formXml>
</tns
ersistApplication>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The request when using the OVERLOADED submitConnection.Execute(inputNav,
outputNav, errorsNav);
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"
xmlns:tns="http://tempuri.org/"
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-11-29T16:25:09"
xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"
xml:lang="en-us">
<my:applicationId></my:applicationId>
<my:Applicant>
<my:fullName>test guy</my:fullName>
<my:municipality>sanfran</my:municipality>
</my:Applicant>
</my:myFields>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
My webservice signature:
[WebMethod]
public string PersistApplication(string formXml)
Ignoring the URLEncoding on the first request (I told infopath to pass it as
a string) - why isnt my overloaded webservice connection working...It is not
wrapping the soap body in the proper elements for the web method
<tns
ersistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
accepts one argument - the form contents. The webservice takes this, adds it
to my database and returns the primary key that I will store in the infoPath
document. My problem is I cannot get this to work. Has anybody had success
in getting the overloaded webServiceConnection.Execute(XPathNav inputNav,
XPathNav outputNav, XPathNav errorsNav) to work? How did you do it and what
am I missing?
Below is my code from my infopath FormEvents_Submit method - it is
relatively straightforward.
I have a web service connection, and when I submit it using the traditional:
WebServiceConnection submitConnection =
(WebServiceConnection)this.DataConnections["PersistApplication"];
submitConnection.Execute();
....the value of my form makes it through but obviously I have no way to
capture the returned primary key.
So I tried using the overloaded Execute method:
XPathNavigator inputNav =
this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields",
this.NamespaceManager);
XPathNavigator outputNav = outputDocument.CreateNavigator();
XPathNavigator errorsNav = errorsDocument.CreateNavigator();
submitConnection.Execute(inputNav, outputNav, errorsNav);
This allowed me to retrieve my primary key but for some reason my form
contents were not being passed through to the web service...debugging the
web method told me it was receiving null.
So then I used a packet sniffer to determine the difference between the 2.
It was apparent that the overloaded Execute that accepted (inputNav,
outputNav, errorsNav) was not wrapping up my soap request properly to point
my webservice.
The request when Using submitConnection.Execute();
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<tns
<tns:formXml>
<?xml version="1.0"?><?mso-infoPathSolution
name="urn:schemas-microsoft-com
solutionVersion="1.0.0.102" productVersion="12.0.0" PIVersion="1.0.0.0"
?><?mso-application progid="InfoPath.Document"
versionProgid="InfoPath.Document.2"?><my:myFields
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"
xmlns:tns="http://tempuri.org/"
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-11-29T16:25:09"
xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"
xml:lang="en-us">
<my:applicationId></my:applicationId>
<my:Applicant>
<my:fullName>test guy</my:fullName>
<my:municipality>sanfran</my:municipality>
</my:Applicant>
</my:myFields>
</tns:formXml>
</tns
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The request when using the OVERLOADED submitConnection.Execute(inputNav,
outputNav, errorsNav);
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"
xmlns:tns="http://tempuri.org/"
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-11-29T16:25:09"
xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"
xml:lang="en-us">
<my:applicationId></my:applicationId>
<my:Applicant>
<my:fullName>test guy</my:fullName>
<my:municipality>sanfran</my:municipality>
</my:Applicant>
</my:myFields>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
My webservice signature:
[WebMethod]
public string PersistApplication(string formXml)
Ignoring the URLEncoding on the first request (I told infopath to pass it as
a string) - why isnt my overloaded webservice connection working...It is not
wrapping the soap body in the proper elements for the web method
<tns
<tns:formXml>