Passing and retrieving values via web services

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:persistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
&lt;?xml version="1.0"?&gt;&lt;?mso-infoPathSolution
name="urn:schemas-microsoft-com:eek:ffice:infopath:TestTemplate:-myXSD-2007-11-29T16-25-09"
solutionVersion="1.0.0.102" productVersion="12.0.0" PIVersion="1.0.0.0"
?&gt;&lt;?mso-application progid="InfoPath.Document"
versionProgid="InfoPath.Document.2"?&gt;&lt;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"&gt;
&lt;my:applicationId&gt;&lt;/my:applicationId&gt;
&lt;my:Applicant&gt;
&lt;my:fullName&gt;test guy&lt;/my:fullName&gt;
&lt;my:municipality&gt;sanfran&lt;/my:municipality&gt;
&lt;/my:Applicant&gt;
&lt;/my:myFields&gt;
</tns:formXml>
</tns:persistApplication>
</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:persistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
 
B

BobCh

Any reason you are doing this in code? I submit my form via a
standard web service submit call and it works fine, though I havn't
tried to get a return value. Perhaps you can split the process up to
first get a pkey for the db table and a second call to submit the
form.

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:persistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
&lt;?xml version="1.0"?&gt;&lt;?mso-infoPathSolution
name="urn:schemas-microsoft-com:eek:ffice:infopath:TestTemplate:-myXSD-2007-11-29T16-25-09"
solutionVersion="1.0.0.102" productVersion="12.0.0" PIVersion="1.0.0.0"
?&gt;&lt;?mso-application progid="InfoPath.Document"
versionProgid="InfoPath.Document.2"?&gt;&lt;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..."
xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"
xml:lang="en-us"&gt;
&lt;my:applicationId&gt;&lt;/my:applicationId&gt;
&lt;my:Applicant&gt;
&lt;my:fullName&gt;test guy&lt;/my:fullName&gt;
&lt;my:municipality&gt;sanfran&lt;/my:municipality&gt;
&lt;/my:Applicant&gt;
&lt;/my:myFields&gt;
</tns:formXml>
</tns:persistApplication>
</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..."
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:persistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
 
C

Clayton

I need to do this via code because this is the only way that I see to get a
value back from the server. I want to submit my form to the server and
return the primary key in the IP form as well.




BobCh said:
Any reason you are doing this in code? I submit my form via a
standard web service submit call and it works fine, though I havn't
tried to get a return value. Perhaps you can split the process up to
first get a pkey for the db table and a second call to submit the
form.

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:persistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
&lt;?xml version="1.0"?&gt;&lt;?mso-infoPathSolution
name="urn:schemas-microsoft-com:eek:ffice:infopath:TestTemplate:-myXSD-2007-11-29T16-25-09"
solutionVersion="1.0.0.102" productVersion="12.0.0" PIVersion="1.0.0.0"
?&gt;&lt;?mso-application progid="InfoPath.Document"
versionProgid="InfoPath.Document.2"?&gt;&lt;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..."
xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"
xml:lang="en-us"&gt;
&lt;my:applicationId&gt;&lt;/my:applicationId&gt;
&lt;my:Applicant&gt;
&lt;my:fullName&gt;test guy&lt;/my:fullName&gt;
&lt;my:municipality&gt;sanfran&lt;/my:municipality&gt;
&lt;/my:Applicant&gt;
&lt;/my:myFields&gt;
</tns:formXml>
</tns:persistApplication>
</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..."
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:persistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
 
B

BobCh

If you are stuck, perhaps a call to MSoft? $250 to get past the issue
may be the price you have to pay.

Or, Issue one ws request to get the next available pkey, and a second
ws request to perform the submit.

/bac


I need to do this via code because this is the only way that I see to get a
value back from the server. I want to submit my form to the server and
return the primary key in the IP form as well.


Any reason you are doing this in code? I submit my form via a
standard web service submit call and it works fine, though I havn't
tried to get a return value. Perhaps you can split the process up to
first get a pkey for the db table and a second call to submit the
form.
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:persistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
&lt;?xml version="1.0"?&gt;&lt;?mso-infoPathSolution
name="urn:schemas-microsoft-com:eek:ffice:infopath:TestTemplate:-myXSD-2007-11-29T16-25-09"
solutionVersion="1.0.0.102" productVersion="12.0.0" PIVersion="1.0.0.0"
?&gt;&lt;?mso-application progid="InfoPath.Document"
versionProgid="InfoPath.Document.2"?&gt;&lt;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..."
xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"
xml:lang="en-us"&gt;
&lt;my:applicationId&gt;&lt;/my:applicationId&gt;
&lt;my:Applicant&gt;
&lt;my:fullName&gt;test guy&lt;/my:fullName&gt;
&lt;my:municipality&gt;sanfran&lt;/my:municipality&gt;
&lt;/my:Applicant&gt;
&lt;/my:myFields&gt;
</tns:formXml>
</tns:persistApplication>
</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..."
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:persistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
 
C

Clayton

Thanks Bob - that was actually my next course of action. Frist get it
working with 2 calls, and then call MS.

I appreciate your help and interest in my problem!

Clayton


BobCh said:
If you are stuck, perhaps a call to MSoft? $250 to get past the issue
may be the price you have to pay.

Or, Issue one ws request to get the next available pkey, and a second
ws request to perform the submit.

/bac


I need to do this via code because this is the only way that I see to get
a
value back from the server. I want to submit my form to the server and
return the primary key in the IP form as well.


Any reason you are doing this in code? I submit my form via a
standard web service submit call and it works fine, though I havn't
tried to get a return value. Perhaps you can split the process up to
first get a pkey for the db table and a second call to submit the
form.
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:persistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
&lt;?xml version="1.0"?&gt;&lt;?mso-infoPathSolution
name="urn:schemas-microsoft-com:eek:ffice:infopath:TestTemplate:-myXSD-2007-11-29T16-25-09"
solutionVersion="1.0.0.102" productVersion="12.0.0"
PIVersion="1.0.0.0"
?&gt;&lt;?mso-application progid="InfoPath.Document"
versionProgid="InfoPath.Document.2"?&gt;&lt;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..."
xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"
xml:lang="en-us"&gt;
&lt;my:applicationId&gt;&lt;/my:applicationId&gt;
&lt;my:Applicant&gt;
&lt;my:fullName&gt;test guy&lt;/my:fullName&gt;
&lt;my:municipality&gt;sanfran&lt;/my:municipality&gt;
&lt;/my:Applicant&gt;
&lt;/my:myFields&gt;
</tns:formXml>
</tns:persistApplication>
</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..."
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:persistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
 
J

JimJ

With 2 WS calls there is a small chance that 2 users could retrieve the same
pkey value, right? I am facing a similar situation, but I am not using asmx,
but just an infopath form that I want to assign a unique number to (that has
multiple users) for reference purposes. I was trying to figure out how to
insert a new row in a identity/autonumber table and then bring that value
back to the form as it is being saved/submitted.


Clayton said:
Thanks Bob - that was actually my next course of action. Frist get it
working with 2 calls, and then call MS.

I appreciate your help and interest in my problem!

Clayton


BobCh said:
If you are stuck, perhaps a call to MSoft? $250 to get past the issue
may be the price you have to pay.

Or, Issue one ws request to get the next available pkey, and a second
ws request to perform the submit.

/bac


I need to do this via code because this is the only way that I see to get
a
value back from the server. I want to submit my form to the server and
return the primary key in the IP form as well.



Any reason you are doing this in code? I submit my form via a
standard web service submit call and it works fine, though I havn't
tried to get a return value. Perhaps you can split the process up to
first get a pkey for the db table and a second call to submit the
form.

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:persistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
<?xml version="1.0"?><?mso-infoPathSolution
name="urn:schemas-microsoft-com:eek: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..."
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:persistApplication>
</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..."
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:persistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
 
C

Clayton

The way I am thinking, there is no chance that 2 users will have the same
primary key. I plan on building a stored procedure that will return the
next key and take it out of the pool. So, my first WS call will hit the WS
and get the ID. Then I will put that ID into a field on my form, and then
submit the entire form to the WS, and save it. If you do a select from your
table and return the last primary key +1 then yes, you're right.


JimJ said:
With 2 WS calls there is a small chance that 2 users could retrieve the
same
pkey value, right? I am facing a similar situation, but I am not using
asmx,
but just an infopath form that I want to assign a unique number to (that
has
multiple users) for reference purposes. I was trying to figure out how to
insert a new row in a identity/autonumber table and then bring that value
back to the form as it is being saved/submitted.


Clayton said:
Thanks Bob - that was actually my next course of action. Frist get it
working with 2 calls, and then call MS.

I appreciate your help and interest in my problem!

Clayton


BobCh said:
If you are stuck, perhaps a call to MSoft? $250 to get past the issue
may be the price you have to pay.

Or, Issue one ws request to get the next available pkey, and a second
ws request to perform the submit.

/bac


I need to do this via code because this is the only way that I see to
get
a
value back from the server. I want to submit my form to the server and
return the primary key in the IP form as well.



Any reason you are doing this in code? I submit my form via a
standard web service submit call and it works fine, though I havn't
tried to get a return value. Perhaps you can split the process up
to
first get a pkey for the db table and a second call to submit the
form.

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:persistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
<?xml version="1.0"?><?mso-infoPathSolution
name="urn:schemas-microsoft-com:eek: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..."
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:persistApplication>
</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..."
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:persistApplication xmlns:tns="http://tempuri.org/">
<tns:formXml>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top