Question on returning a table from a web service to InfoPath - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Question on returning a table from a web service to InfoPath

Last post 02-18-2010 12:18 PM by Hilary Stoupa. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 02-04-2010 09:30 AM

    Question on returning a table from a web service to InfoPath

    Hello,

    I was hoping I could get some help on web service.  I have a web service which returns a table to Infopath. The C# source is below. The table comes back to InfoPath as shown in the picture below.  How would I modify my web service so that the table is returned as repeating row, rather than via the repeating (Choice) indicator?

    Thanks,

    Dave

        [WebMethod]
        public DataSet GetAllLU_EducationLevelRecords()
        {
            DataSet DS = new DataSet();
            SqlDataAdapter posAdapter = new SqlDataAdapter();
            System.Data.SqlClient.SqlConnection cxn = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["HumanResourcesConnectionString"].ConnectionString);
            cxn.Open();

            posAdapter.SelectCommand = new SqlCommand("select * from LU_EducationLevel", cxn);
            posAdapter.Fill(DS);

            cxn.Close();

            return DS;
        }

     


  • 02-05-2010 04:37 PM In reply to

    Re: Question on returning a table from a web service to InfoPath

    Are you using SQL 2005? Have you thought about using stored procedures and endpoints for this? Here is a blog post on that approach. Otherwise, I'd suggest you write your dataset into an XML node -- I'm not sure what causes that Choice section, but I'd expect InfoPath to understand XML better than a dataset. Here is an article, with some code samples, on that. It starts with XML --> DataSet, but about half way down the page, talks about DataSet --> XML.

    Hilary Stoupa

  • 02-06-2010 06:51 PM In reply to

    Re: Question on returning a table from a web service to InfoPath

    Hi Hilary,

    Thanks for the information and links. I'm using SQL 2008, and I thought that the direct endpoints should not be used and will be deprecated in a future version.  At least that's what I read wherever it talks about doing it this way.

    I will look into your second recommendation.

    Thanks,

    Dave

     

     

     

  • 02-08-2010 09:34 AM In reply to

    Re: Question on returning a table from a web service to InfoPath

    Do you know, I vaguely recall reading about that deprecation -- thank you for bringing it up and posting it!

    Hilary Stoupa

  • 02-17-2010 11:55 AM In reply to

    Re: Question on returning a table from a web service to InfoPath

    (hopefully this text doesn't lose formatting as my previous one did.  Can someone delete my previous reply?)

     

     

    Hi Hilary, Thanks for asking about my progress with the web service.    I tried modifying my web service (which currently returns a dataset) to return xml instead.  I added a few lines,strXdoc = DS.GetXml()xDoc.LoadXml(strXdoc);return Xdoc; to my web service.  It does return xml, but of course, it only returns the xml for the fields which are non-null, and the way InfoPath interacts with my webservice, the webservice has to be called as part of setting up the data connection, to learn the schema of what’s going to be returned.  Therefore, it has to return all fields. I believe this is where I’m missing something.  I’m trying to understand more about WSDL.  My guess is that the Infopath data connection wizard is not finding a WSDL file to learn the format of what gets returned from the web service.  For each of my web services, when you set them up, you have to give Sample Values and it does a call to the web service.  Is this what should always happen, or does this just happen because I’m missing something??  It’s always seemed strange to me, that InfoPath has to do this.   So, in short, yes, the lines of code above work, but I need to figure out how the web service/infopath interaction works with regards to what schema is going to be returned.  I know I’m doing something wrong and I think it has something to do with the WSDL.   

    Dave

     

     

  • 02-18-2010 12:18 PM In reply to

    Re: Question on returning a table from a web service to InfoPath

    We've had an email thread going on this, but wanted to respond in the forum to your bold question above. InfoPath web service data connections always have you enter sample values and make a call to the web service -- this is the point when IP creates the schema files for your web service connection.

    Hilary Stoupa

Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.