PLEASE HELP

R

rkauzlick

I'm attempting to write a simple web service that uses InfoPath.

In Info Path, I created a very simple form with one field. I then
used "Extract Form Files" to get the myschema.xsd file, which in turn
I then run the xsd.exe..... command to generate the .cs file.

I have added the .cs file to my .NET project.

Here is the .cs file code:
public partial class myFields {

private string shipment_IDField;

private System.Xml.XmlAttribute[] anyAttrField;

/// <remarks/>
public string Shipment_ID {
get {
return this.shipment_IDField;
}
set {
this.shipment_IDField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlAnyAttributeAttribute()]
public System.Xml.XmlAttribute[] AnyAttr {
get {
return this.anyAttrField;
}
set {
this.anyAttrField = value;
}
}
}

Here is the .asmx code.
[WebMethod]
public void SubmitForm(myFields info)
{
//I need code here to extract the value that was submitted
from Info path
// Ultimately I want to write a SQL statement to Insert/
Update a database in the database
stSQL = "UPDATE TABLE SET VALUE = '" + info.ShipmentID


}

I have no clue how to extract the data that was submitted by InfoPath.
When I debug the data, it always comes back as null.
 
G

Gavin McKay

When you say "it always comes back as null" are you talking about the
SubmitForm(myFields info) is null? Is your InfoPath form submitting to the
web service OK or do you get errors on the submit?

Usually when I'm debugging these problems I try the following:
1. make sure your web service works by manually invoking it with data.
2. if your web service works, try changing your SubmitForm(myFields info) to
SubmitForm(string info) instead to make sure your method is getting the xml OK
3. if (2) works then try and Serialize your xml into your myFields class

Gavin.
 
R

rkauzlick

When you say "it always comes back as null" are you talking about the
SubmitForm(myFields info) is null?  Is your InfoPath form submitting to the
web service OK or do you get errors on the submit?

Usually when I'm debugging these problems I try the following:
1. make sure your web service works by manually invoking it with data.
2. if your web service works, try changing your SubmitForm(myFields info) to
SubmitForm(string info) instead to make sure your method is getting the xml OK
3. if (2) works then try and Serialize your xml into your myFields class

Gavin.
--
2B | !2B



I'm attempting to write a simple web service that uses InfoPath.
In Info Path, I created a very simple form with one field.  I then
used "Extract Form Files" to get the myschema.xsd file, which in turn
I then run the xsd.exe..... command to generate the .cs file.
I have added the .cs file to my .NET project.
Here is the .cs file code:
public partial class myFields {
    private string shipment_IDField;
    private System.Xml.XmlAttribute[] anyAttrField;
    /// <remarks/>
    public string Shipment_ID {
        get {
            return this.shipment_IDField;
        }
        set {
            this.shipment_IDField = value;
        }
    }
    /// <remarks/>
    [System.Xml.Serialization.XmlAnyAttributeAttribute()]
    public System.Xml.XmlAttribute[] AnyAttr {
        get {
            return this.anyAttrField;
        }
        set {
            this.anyAttrField = value;
        }
    }
}
Here is the .asmx code.
[WebMethod]
        public void SubmitForm(myFields info)
        {
            //I need code here to extract the value that wassubmitted
from Info path
           //  Ultimately I want to write a SQL statement to Insert/
Update a database in the database
           stSQL = "UPDATE TABLE SET VALUE = '" + info.ShipmentID
        }
I have no clue how to extract the data that was submitted by InfoPath.
When I debug the data, it always comes back as null.- Hide quoted text -

- Show quoted text -

Clay,

Any help on this matter would be great. I did figure out that if I
submit "myFields" and include "Text and Child Elements" only I can get
the values so I know that the submit from infopath is working.
However, now I'm running into an issue with the date field.

I have a query button that returns a value from the database into
infopath based on a parameter field. This works great. Now I want to
update one of the fields, when I hit submit, I get an error on my date
field.

"Server was unable to read request. ---> There is an error in XML
document (7, 133). ---> String was not recognized as a valid
DateTime."

If I have infopath submit the entire XML, that is where I'm getting
the null values being returned and I think this is where I need to do
something, but I'm not sure what in my C# code.

Thoughts or examples would be great.

Ryan
 

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