Infopath and web sevices

P

Papanii

Hi guys,
I have created a web service using sqlxml 3.0 and i am trying to
design a InfoPath form with it. But whenever i click next on the select an
operation page i get an error stating..."InfoPath was unable to create a
schema from the results of the web service call." Under the details button
... "The SOAP message cannot be parsed.". Does anyone know why?
Thanx
 
R

Raghu Prakash

Hi Papanii,

SYMPTOMS
When you submit information from an InfoPath form to a Web service by using
the built-in InfoPath submit functionality, you may experience one of the
following symptoms:
You may receive an error message. The error message that you receive varies
according to the information that is being submitted and to the coding of
the method that is being invoked on the Web service.
You may notice that unexpected data is submitted to the Web service.
This article also discusses the following:
How InfoPath submits data to a Web service.
Two methods for submitting the contents of an InfoPath form to a Web
service.
CAUSE
When InfoPath submits data to a Web service, it submits the contents of the
XML node that was selected as a parameter, but it does not submit the XML
node itself. This generally works well. For example, you have a Web service
method like the following:[WebMethod]
public void SendSampleString( string sampleString )
{
//Do something interesting with the sample string.
}
If you submit the following XML element to this Web service method, the
sampleString parameter is filled with "Hello, World!" (as you expect).
<sampleElement>"Hello, World!"</sampleElement>
Unfortunately, this behavior can make it difficult to submit XML nodes or
the whole InfoPath form to a Web service. For example, you have a Web
service method like the following: [WebMethod]
public string SendXMLElement( System.Xml.XmlElement theElement )
{
//Report how many children the submitted node had.
return "Node with " + theElement.ChildNodes.Count + " children
submitted.";
}
If you submit the example XML element to this method by using the built-in
InfoPath submit functionality, the contents of the theElement parameter
generate an error. This error occurs because only the contents of the XML
element ("Hello, World!"), are sent to the Web service method. Because the
string is not a valid XML element, the .NET Framework generates an error;
the error message appears in InfoPath.

A similar problem occurs if you try to submit the whole InfoPath form to
the example Web service method. In this case, InfoPath submits all the
child nodes of the InfoPath form, but does not submit the root node. This
results in multiple top-level XML nodes being submitted. Because this is
also not valid XML, the .NET Framework selects the first top-level XML node
and uses it as the theElement parameter. All the other nodes are ignored,
and this gives the appearance that they were not submitted.
RESOLUTION
To work around this problem, write a custom submit action in script. You
can use either of the following methods:
Use a secondary data source to perform the submit operation.
Write code that creates a custom SOAP message and that sends it to the Web
service.
Use a Secondary Data source
On the Tools menu, click Secondary Data Sources.
In the Secondary Data Sources dialog box, click Add.
On the first page of the Data Source Setup Wizard, click Web Service, and
then click Next.
Enter the location of the Web service that you want to submit, and then
click Next.
Select the Web service method that you want to use, and then click Next.
When InfoPath prompts you to select the field or group from the form that
will be used to fill the parameters of the Web service method, leave the
parameters blank, and then click Next.
Click to clear the "Connect to this secondary data source when the form is
opened" check box, click Finish, and then click OK to close the Secondary
Data Sources dialog box.
On the Tools menu, click Submitting Forms.
In the Submitting Forms dialog box, click Enable Submit.
In the Submit list, click Submit using Custom Script, and then click OK to
open Microsoft Script Editor.
In the XDocument::OnSubmitRequest method, use script like the following
script to submit the whole form.

Note You can also submit individual elements in the form.try{
//Get a reference to the SendXMLElement secondary data source.
var objSendXMLElement = XDocument.GetDOM("SendXMLElement");
objSendXMLElement.setProperty( "SelectionNamespaces",
'xmlns:s1="http://joelallxp.microsoft.com/schema" ' +
'xmlns:s0="http://tempuri.org/" ' +

'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSoluti
on"' );

//Remove any data from the SendXMLElement secondary data source.
var objData = objSendXMLElement.selectSingleNode(
"/dfs:myFields/dfs:queryFields/s0:SendXMLElement/s0:theElement");
var objCurrentData = objData.selectNodes("@* | node()");
objCurrentData.removeAll();

//Clone the XDocument.
var objClonedDocument = XDocument.DOM.documentElement.cloneNode(true
);
objData.appendChild( objClonedDocument );

//Call the "Query" method of the secondary data source to send the
data.
XDocument.DataObjects("SendXMLElement").Query();

//Report the results of the submit.
XDocument.UI.Alert(
objSendXMLElement.selectSingleNode(

"/dfs:myFields/dfs:dataFields/s0:SendXMLElementResponse/s0:SendXMLElementRes
ult").text );
eventObj.ReturnStatus = true;
}
catch(ex)
{
eventObj.ReturnStatus = false;
}
Write Code
On the Tools menu, click Submitting Forms.
In the Submitting Forms dialog box, click Enable Submit.
In the Submit list, click Submit using Custom Script, and then click OK to
open Microsoft Script Editor.
In the XDocument::OnSubmitRequest method, use script like the following
script to submit the whole form.

Note You can also submit individual elements in the form.try
{
//Create a SOAP object.
var objSOAPConnector = new ActiveXObject("MSOSOAP.HttpConnector30");

//Set the EndPointURL property to point to the Web service.
objSOAPConnector.Property("EndPointURL") =
"http://server/WebService1/Submit.asmx";

//Set the SoapAction property to point to the Web service method. You
can find this URI
//in the WSDL file of the Web service.
objSOAPConnector.Property("SoapAction") =
"http://tempuri.org/SendXMLElement";
objSOAPConnector.Connect();

//Begin construction of a SOAP message to send to the Web service.
objSOAPConnector.BeginMessage();

var objSOAPSerializer = new ActiveXObject("MSOSoap.SoapSerializer30");
objSOAPSerializer.Init( objSOAPConnector.InputStream );
objSOAPSerializer.startEnvelope();
objSOAPSerializer.startBody();

//Construct the structure that marks the method name and the
parameter name
//that you are sending.
objSOAPSerializer.StartElement( "SendXMLElement",
"http://tempuri.org/" );
objSOAPSerializer.StartElement( "theNode", "http://tempuri.org/" );

//Write out the XML of the document.
objSOAPSerializer.WriteXml( XDocument.DOM.documentElement.xml );

//Finish each element.
objSOAPSerializer.EndElement();
objSOAPSerializer.EndElement();

//Call EndMessage to complete the SOAP message and send it to the Web
service method.
//This results in the Web service method being called.
objSOAPSerializer.endBody();
objSOAPSerializer.endEnvelope();
objSOAPConnector.EndMessage();

//Use a SoapReader to read the response from the Web service method .
var ResponseReader = new ActiveXObject("MSOSOAP.SoapReader30");
ResponseReader.Load( objSOAPConnector.OutputStream );

//If there was no error, return true.
if (ResponseReader.Fault != null)
{
eventObj.ReturnStatus = false;
throw "Error submitting data: " + ResponseReader.Fault.xml;
}
eventObj.ReturnStatus = true;
}
catch (ex)
{
XDocument.UI.Alert("Failed to submit document: " + ex.description);
}
This behavior is by design.
MORE INFORMATION
Steps to Reproduce the Behavior
Create a Web service that contains the following two methods:
Method 1[WebMethod]
public void SendSampleString( string sampleString )
{
//Do something interesting with the sample string.
}
Method 2[WebMethod]
public string SendXMLElement( System.Xml.XmlElement theElement )
{
//Report how many children the submitted node had.
return "Node with " + theElement.ChildNodes.Count + " children
submitted.";
}
Design a new InfoPath form by selecting New from Data Source.
In the Data Source Setup Wizard, select Web Service, and then click Next.
Click Receive and Submit Data, and then click Next.
For the receive data Web service method, follow these steps:
Enter the URL to the Web service that you created earlier, and then click
Next.
In the Select an operation list, click SendXMLElement, and then click Next.
For the submit data Web service method, follow these steps:
Enter the URL to the Web service that you created earlier, and then click
Next.
In the Select an operation list, click SendXMLElement, and then click Next.
Click the Modify button to choose a parameter for the submit operation.
In the dataFields list, click SendXMLElementResult, click OK, and then
click Next.
Select Design data view first, and then click Finish to close the Data
Source Setup Wizard dialog box.
Add the SendXMLElementResult field to the form.
Preview the form.
In the Send XML Node Result control, type Hello, World!
On the File menu, click Submit.

You receive the following error message:



InfoPath cannot submit the form.
An error occurred while the form was being submitted.

Show Details:
The SOAP response indicates that an error occurred:
Server was unable to read request. --> There is an error in XML document
(1,409). -->Specified cast is not valid.

Close the Preview window, and then return the form to Design mode.
To resolve this problem, use either of the methods that are mentioned in
the "Resolution" section of this article.

For Further Information: Microsoft Knowledge Base Article - 826989

Please let me know has this helped You...
Thank you...
Raghu...
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Patrick Halstead

Isn't this pretty much irrelevant with SP1?

Raghu Prakash said:
Hi Papanii,

SYMPTOMS
When you submit information from an InfoPath form to a Web service by using
the built-in InfoPath submit functionality, you may experience one of the
following symptoms:
You may receive an error message. The error message that you receive varies
according to the information that is being submitted and to the coding of
the method that is being invoked on the Web service.
You may notice that unexpected data is submitted to the Web service.
This article also discusses the following:
How InfoPath submits data to a Web service.
Two methods for submitting the contents of an InfoPath form to a Web
service.
CAUSE
When InfoPath submits data to a Web service, it submits the contents of the
XML node that was selected as a parameter, but it does not submit the XML
node itself. This generally works well. For example, you have a Web service
method like the following:[WebMethod]
public void SendSampleString( string sampleString )
{
//Do something interesting with the sample string.
}
If you submit the following XML element to this Web service method, the
sampleString parameter is filled with "Hello, World!" (as you expect).
<sampleElement>"Hello, World!"</sampleElement>
Unfortunately, this behavior can make it difficult to submit XML nodes or
the whole InfoPath form to a Web service. For example, you have a Web
service method like the following: [WebMethod]
public string SendXMLElement( System.Xml.XmlElement theElement )
{
//Report how many children the submitted node had.
return "Node with " + theElement.ChildNodes.Count + " children
submitted.";
}
If you submit the example XML element to this method by using the built-in
InfoPath submit functionality, the contents of the theElement parameter
generate an error. This error occurs because only the contents of the XML
element ("Hello, World!"), are sent to the Web service method. Because the
string is not a valid XML element, the .NET Framework generates an error;
the error message appears in InfoPath.

A similar problem occurs if you try to submit the whole InfoPath form to
the example Web service method. In this case, InfoPath submits all the
child nodes of the InfoPath form, but does not submit the root node. This
results in multiple top-level XML nodes being submitted. Because this is
also not valid XML, the .NET Framework selects the first top-level XML node
and uses it as the theElement parameter. All the other nodes are ignored,
and this gives the appearance that they were not submitted.
RESOLUTION
To work around this problem, write a custom submit action in script. You
can use either of the following methods:
Use a secondary data source to perform the submit operation.
Write code that creates a custom SOAP message and that sends it to the Web
service.
Use a Secondary Data source
On the Tools menu, click Secondary Data Sources.
In the Secondary Data Sources dialog box, click Add.
On the first page of the Data Source Setup Wizard, click Web Service, and
then click Next.
Enter the location of the Web service that you want to submit, and then
click Next.
Select the Web service method that you want to use, and then click Next.
When InfoPath prompts you to select the field or group from the form that
will be used to fill the parameters of the Web service method, leave the
parameters blank, and then click Next.
Click to clear the "Connect to this secondary data source when the form is
opened" check box, click Finish, and then click OK to close the Secondary
Data Sources dialog box.
On the Tools menu, click Submitting Forms.
In the Submitting Forms dialog box, click Enable Submit.
In the Submit list, click Submit using Custom Script, and then click OK to
open Microsoft Script Editor.
In the XDocument::OnSubmitRequest method, use script like the following
script to submit the whole form.

Note You can also submit individual elements in the form.try{
//Get a reference to the SendXMLElement secondary data source.
var objSendXMLElement = XDocument.GetDOM("SendXMLElement");
objSendXMLElement.setProperty( "SelectionNamespaces",
'xmlns:s1="http://joelallxp.microsoft.com/schema" ' +
'xmlns:s0="http://tempuri.org/" ' +

'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSoluti
on"' );

//Remove any data from the SendXMLElement secondary data source.
var objData = objSendXMLElement.selectSingleNode(
"/dfs:myFields/dfs:queryFields/s0:SendXMLElement/s0:theElement");
var objCurrentData = objData.selectNodes("@* | node()");
objCurrentData.removeAll();

//Clone the XDocument.
var objClonedDocument = XDocument.DOM.documentElement.cloneNode(true
);
objData.appendChild( objClonedDocument );

//Call the "Query" method of the secondary data source to send the
data.
XDocument.DataObjects("SendXMLElement").Query();

//Report the results of the submit.
XDocument.UI.Alert(
objSendXMLElement.selectSingleNode(

"/dfs:myFields/dfs:dataFields/s0:SendXMLElementResponse/s0:SendXMLElementRes
ult").text );
eventObj.ReturnStatus = true;
}
catch(ex)
{
eventObj.ReturnStatus = false;
}
Write Code
On the Tools menu, click Submitting Forms.
In the Submitting Forms dialog box, click Enable Submit.
In the Submit list, click Submit using Custom Script, and then click OK to
open Microsoft Script Editor.
In the XDocument::OnSubmitRequest method, use script like the following
script to submit the whole form.

Note You can also submit individual elements in the form.try
{
//Create a SOAP object.
var objSOAPConnector = new ActiveXObject("MSOSOAP.HttpConnector30");

//Set the EndPointURL property to point to the Web service.
objSOAPConnector.Property("EndPointURL") =
"http://server/WebService1/Submit.asmx";

//Set the SoapAction property to point to the Web service method. You
can find this URI
//in the WSDL file of the Web service.
objSOAPConnector.Property("SoapAction") =
"http://tempuri.org/SendXMLElement";
objSOAPConnector.Connect();

//Begin construction of a SOAP message to send to the Web service.
objSOAPConnector.BeginMessage();

var objSOAPSerializer = new ActiveXObject("MSOSoap.SoapSerializer30");
objSOAPSerializer.Init( objSOAPConnector.InputStream );
objSOAPSerializer.startEnvelope();
objSOAPSerializer.startBody();

//Construct the structure that marks the method name and the
parameter name
//that you are sending.
objSOAPSerializer.StartElement( "SendXMLElement",
"http://tempuri.org/" );
objSOAPSerializer.StartElement( "theNode", "http://tempuri.org/" );

//Write out the XML of the document.
objSOAPSerializer.WriteXml( XDocument.DOM.documentElement.xml );

//Finish each element.
objSOAPSerializer.EndElement();
objSOAPSerializer.EndElement();

//Call EndMessage to complete the SOAP message and send it to the Web
service method.
//This results in the Web service method being called.
objSOAPSerializer.endBody();
objSOAPSerializer.endEnvelope();
objSOAPConnector.EndMessage();

//Use a SoapReader to read the response from the Web service method ..
var ResponseReader = new ActiveXObject("MSOSOAP.SoapReader30");
ResponseReader.Load( objSOAPConnector.OutputStream );

//If there was no error, return true.
if (ResponseReader.Fault != null)
{
eventObj.ReturnStatus = false;
throw "Error submitting data: " + ResponseReader.Fault.xml;
}
eventObj.ReturnStatus = true;
}
catch (ex)
{
XDocument.UI.Alert("Failed to submit document: " + ex.description);
}
This behavior is by design.
MORE INFORMATION
Steps to Reproduce the Behavior
Create a Web service that contains the following two methods:
Method 1[WebMethod]
public void SendSampleString( string sampleString )
{
//Do something interesting with the sample string.
}
Method 2[WebMethod]
public string SendXMLElement( System.Xml.XmlElement theElement )
{
//Report how many children the submitted node had.
return "Node with " + theElement.ChildNodes.Count + " children
submitted.";
}
Design a new InfoPath form by selecting New from Data Source.
In the Data Source Setup Wizard, select Web Service, and then click Next.
Click Receive and Submit Data, and then click Next.
For the receive data Web service method, follow these steps:
Enter the URL to the Web service that you created earlier, and then click
Next.
In the Select an operation list, click SendXMLElement, and then click Next.
For the submit data Web service method, follow these steps:
Enter the URL to the Web service that you created earlier, and then click
Next.
In the Select an operation list, click SendXMLElement, and then click Next.
Click the Modify button to choose a parameter for the submit operation.
In the dataFields list, click SendXMLElementResult, click OK, and then
click Next.
Select Design data view first, and then click Finish to close the Data
Source Setup Wizard dialog box.
Add the SendXMLElementResult field to the form.
Preview the form.
In the Send XML Node Result control, type Hello, World!
On the File menu, click Submit.

You receive the following error message:



InfoPath cannot submit the form.
An error occurred while the form was being submitted.

Show Details:
The SOAP response indicates that an error occurred:
Server was unable to read request. --> There is an error in XML document
(1,409). -->Specified cast is not valid.

Close the Preview window, and then return the form to Design mode.
To resolve this problem, use either of the methods that are mentioned in
the "Resolution" section of this article.

For Further Information: Microsoft Knowledge Base Article - 826989

Please let me know has this helped You...
Thank you...
Raghu...
This posting is provided "AS IS" with no warranties, and confers no
rights.
 
D

Dde

You are completely right. We finally have in SP1 the oportunity to choose
options for the submit method , which allow to submit any kind of data to
web services without scripting.

Patrick Halstead said:
Isn't this pretty much irrelevant with SP1?

Raghu Prakash said:
Hi Papanii,

SYMPTOMS
When you submit information from an InfoPath form to a Web service by using
the built-in InfoPath submit functionality, you may experience one of the
following symptoms:
You may receive an error message. The error message that you receive varies
according to the information that is being submitted and to the coding of
the method that is being invoked on the Web service.
You may notice that unexpected data is submitted to the Web service.
This article also discusses the following:
How InfoPath submits data to a Web service.
Two methods for submitting the contents of an InfoPath form to a Web
service.
CAUSE
When InfoPath submits data to a Web service, it submits the contents of the
XML node that was selected as a parameter, but it does not submit the XML
node itself. This generally works well. For example, you have a Web service
method like the following:[WebMethod]
public void SendSampleString( string sampleString )
{
//Do something interesting with the sample string.
}
If you submit the following XML element to this Web service method, the
sampleString parameter is filled with "Hello, World!" (as you expect).
<sampleElement>"Hello, World!"</sampleElement>
Unfortunately, this behavior can make it difficult to submit XML nodes or
the whole InfoPath form to a Web service. For example, you have a Web
service method like the following: [WebMethod]
public string SendXMLElement( System.Xml.XmlElement theElement )
{
//Report how many children the submitted node had.
return "Node with " + theElement.ChildNodes.Count + " children
submitted.";
}
If you submit the example XML element to this method by using the built-in
InfoPath submit functionality, the contents of the theElement parameter
generate an error. This error occurs because only the contents of the XML
element ("Hello, World!"), are sent to the Web service method. Because the
string is not a valid XML element, the .NET Framework generates an error;
the error message appears in InfoPath.

A similar problem occurs if you try to submit the whole InfoPath form to
the example Web service method. In this case, InfoPath submits all the
child nodes of the InfoPath form, but does not submit the root node. This
results in multiple top-level XML nodes being submitted. Because this is
also not valid XML, the .NET Framework selects the first top-level XML node
and uses it as the theElement parameter. All the other nodes are ignored,
and this gives the appearance that they were not submitted.
RESOLUTION
To work around this problem, write a custom submit action in script. You
can use either of the following methods:
Use a secondary data source to perform the submit operation.
Write code that creates a custom SOAP message and that sends it to the Web
service.
Use a Secondary Data source
On the Tools menu, click Secondary Data Sources.
In the Secondary Data Sources dialog box, click Add.
On the first page of the Data Source Setup Wizard, click Web Service, and
then click Next.
Enter the location of the Web service that you want to submit, and then
click Next.
Select the Web service method that you want to use, and then click Next.
When InfoPath prompts you to select the field or group from the form that
will be used to fill the parameters of the Web service method, leave the
parameters blank, and then click Next.
Click to clear the "Connect to this secondary data source when the form is
opened" check box, click Finish, and then click OK to close the Secondary
Data Sources dialog box.
On the Tools menu, click Submitting Forms.
In the Submitting Forms dialog box, click Enable Submit.
In the Submit list, click Submit using Custom Script, and then click OK to
open Microsoft Script Editor.
In the XDocument::OnSubmitRequest method, use script like the following
script to submit the whole form.

Note You can also submit individual elements in the form.try{
//Get a reference to the SendXMLElement secondary data source.
var objSendXMLElement = XDocument.GetDOM("SendXMLElement");
objSendXMLElement.setProperty( "SelectionNamespaces",
'xmlns:s1="http://joelallxp.microsoft.com/schema" ' +
'xmlns:s0="http://tempuri.org/" ' +
'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSoluti
on"' );

//Remove any data from the SendXMLElement secondary data source.
var objData = objSendXMLElement.selectSingleNode(
"/dfs:myFields/dfs:queryFields/s0:SendXMLElement/s0:theElement");
var objCurrentData = objData.selectNodes("@* | node()");
objCurrentData.removeAll();

//Clone the XDocument.
var objClonedDocument = XDocument.DOM.documentElement.cloneNode(true
);
objData.appendChild( objClonedDocument );

//Call the "Query" method of the secondary data source to send the
data.
XDocument.DataObjects("SendXMLElement").Query();

//Report the results of the submit.
XDocument.UI.Alert(
objSendXMLElement.selectSingleNode(
"/dfs:myFields/dfs:dataFields/s0:SendXMLElementResponse/s0:SendXMLElementRes
ult").text );
eventObj.ReturnStatus = true;
}
catch(ex)
{
eventObj.ReturnStatus = false;
}
Write Code
On the Tools menu, click Submitting Forms.
In the Submitting Forms dialog box, click Enable Submit.
In the Submit list, click Submit using Custom Script, and then click OK to
open Microsoft Script Editor.
In the XDocument::OnSubmitRequest method, use script like the following
script to submit the whole form.

Note You can also submit individual elements in the form.try
{
//Create a SOAP object.
var objSOAPConnector = new ActiveXObject("MSOSOAP.HttpConnector30");

//Set the EndPointURL property to point to the Web service.
objSOAPConnector.Property("EndPointURL") =
"http://server/WebService1/Submit.asmx";

//Set the SoapAction property to point to the Web service method. You
can find this URI
//in the WSDL file of the Web service.
objSOAPConnector.Property("SoapAction") =
"http://tempuri.org/SendXMLElement";
objSOAPConnector.Connect();

//Begin construction of a SOAP message to send to the Web service.
objSOAPConnector.BeginMessage();

var objSOAPSerializer = new ActiveXObject("MSOSoap.SoapSerializer30");
objSOAPSerializer.Init( objSOAPConnector.InputStream );
objSOAPSerializer.startEnvelope();
objSOAPSerializer.startBody();

//Construct the structure that marks the method name and the
parameter name
//that you are sending.
objSOAPSerializer.StartElement( "SendXMLElement",
"http://tempuri.org/" );
objSOAPSerializer.StartElement( "theNode", "http://tempuri.org/" );

//Write out the XML of the document.
objSOAPSerializer.WriteXml( XDocument.DOM.documentElement.xml );

//Finish each element.
objSOAPSerializer.EndElement();
objSOAPSerializer.EndElement();

//Call EndMessage to complete the SOAP message and send it to the Web
service method.
//This results in the Web service method being called.
objSOAPSerializer.endBody();
objSOAPSerializer.endEnvelope();
objSOAPConnector.EndMessage();

//Use a SoapReader to read the response from the Web service
method
.
var ResponseReader = new ActiveXObject("MSOSOAP.SoapReader30");
ResponseReader.Load( objSOAPConnector.OutputStream );

//If there was no error, return true.
if (ResponseReader.Fault != null)
{
eventObj.ReturnStatus = false;
throw "Error submitting data: " + ResponseReader.Fault.xml;
}
eventObj.ReturnStatus = true;
}
catch (ex)
{
XDocument.UI.Alert("Failed to submit document: " + ex.description);
}
This behavior is by design.
MORE INFORMATION
Steps to Reproduce the Behavior
Create a Web service that contains the following two methods:
Method 1[WebMethod]
public void SendSampleString( string sampleString )
{
//Do something interesting with the sample string.
}
Method 2[WebMethod]
public string SendXMLElement( System.Xml.XmlElement theElement )
{
//Report how many children the submitted node had.
return "Node with " + theElement.ChildNodes.Count + " children
submitted.";
}
Design a new InfoPath form by selecting New from Data Source.
In the Data Source Setup Wizard, select Web Service, and then click Next.
Click Receive and Submit Data, and then click Next.
For the receive data Web service method, follow these steps:
Enter the URL to the Web service that you created earlier, and then click
Next.
In the Select an operation list, click SendXMLElement, and then click Next.
For the submit data Web service method, follow these steps:
Enter the URL to the Web service that you created earlier, and then click
Next.
In the Select an operation list, click SendXMLElement, and then click Next.
Click the Modify button to choose a parameter for the submit operation.
In the dataFields list, click SendXMLElementResult, click OK, and then
click Next.
Select Design data view first, and then click Finish to close the Data
Source Setup Wizard dialog box.
Add the SendXMLElementResult field to the form.
Preview the form.
In the Send XML Node Result control, type Hello, World!
On the File menu, click Submit.

You receive the following error message:



InfoPath cannot submit the form.
An error occurred while the form was being submitted.

Show Details:
The SOAP response indicates that an error occurred:
Server was unable to read request. --> There is an error in XML document
(1,409). -->Specified cast is not valid.

Close the Preview window, and then return the form to Design mode.
To resolve this problem, use either of the methods that are mentioned in
the "Resolution" section of this article.

For Further Information: Microsoft Knowledge Base Article - 826989

Please let me know has this helped You...
Thank you...
Raghu...
This posting is provided "AS IS" with no warranties, and confers no
rights.
 

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