Problems getting the values of form posted to webservice. - InfoPath Dev
in

InfoPath Dev

Problems getting the values of form posted to webservice.

Last post 08-18-2013 05:10 PM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-14-2013 06:32 AM

    Problems getting the values of form posted to webservice.

    Hi, I have recently migrated a working asmx webservice to a wcf webservice and the webservice method called when forms have been submitted have stopped working, I don't know if this is due to migrating but could do with some help please, the middle one that returns data from the database works just fine. The method does call the stored procedure but the values are just default so for instance the sql sent is 'insert into vendor (vendor_name, vendor_area) values(default, default)' and I can't work out where it is coming from, or why this has stopped working now it has been moved to a wcf webservice, before then the values from the form where in the query. For the dataconnection when you select the element to to submit it says Parameter 'tns:vendorsForm', Type myFields(Complex Type), Element /my:myField. Please can somebody put me on the right track with this, I am sure I am missing something basic like namespace but not sure what or where. Many thanks. Jacqui. The wcf webservice that has 3 Operation Contracts and a data contract defined in the interface as below. [OperationContract] bool UpdateVendor(XmlDocument doc); [OperationContract] myFields VendorDetails(int vendor_id); [OperationContract] void VendorTableInsert(myFields vendorsForm); MyFields and ContractFields are defined as DataContracts as below (not complete but enough to show you what I have done). [DataContract] public class myFields { private string vendorNameField; private string vendorAreaField; [DataMember] public string VendorName { get { return this.vendorNameField; } set { this.vendorNameField = value; } } [DataMember] public string VendorArea { get { return this.vendorAreaField; } set { this.vendorAreaField = value; } } } My webservice method is as below. public void VendorTableInsert(myFields vendorsForm) { string vendorName = vendorsForm.VendorName ; string vendorArea = vendorsForm.VendorArea ; using (SqlConnection newConn = new SqlConnection(_connString)) { using (SqlCommand uCmd = new SqlCommand(sproc_name, newConn)) { try { uCmd.CommandText = sproc_name; uCmd.CommandType = CommandType.StoredProcedure; uCmd.Connection.Open(); uCmd.Parameters.AddWithValue("@vendor_name", vendorName); uCmd.Parameters.AddWithValue("@vendor_area", vendorArea); int result = uCmd.ExecuteNonQuery(); if (result != 0) { } } catch (Exception ex) { Console.WriteLine(ex.Message.ToString()); Trace.WriteLine("Logging Error: " + ex.Message.ToString()); } finally { newConn.Close(); uCmd.Dispose(); TestTracer.Dispose(); } } } }
  • 08-18-2013 05:10 PM In reply to

    Re: Problems getting the values of form posted to webservice.

    Hey Jacqui,

    We can help out here but this is going to require more than the forum I recommend that you purchase a support pack and hire us for an hour.

    Please note: lots of people are out for summer vacation this week and next.

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.