InfoPath 2010 Connection to Custom WCF Service Issues - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

InfoPath 2010 Connection to Custom WCF Service Issues

Last post 08-05-2010 08:47 AM by jloyd. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-17-2010 06:08 AM

    InfoPath 2010 Connection to Custom WCF Service Issues

    Hopefully someone has seen this before.  Here is the situation:

    • I have a Forms Services InfoPath 2010 form
    • I want to connect it to a simple WCF service that has one method that accepts one parameter (string) and returns an XMLElement
    • I want to have the user enter some information in a field on the form, and then click a button to pass that entry as the parameter to the WCF service, get back an XMLElement that I can use as a datasource to populate other controls on the form
    • I don't mind coding, but I would love to be able to accomplish this through the Form Designer UI, if possible

    The main issue I am having right now is that it appears as though I am configuring the connection fine (no errors), but when I look at the fields for the Data Source, the lowest level of granularity is the "Result" group.

    I have 2 questions at this point:

    1. How can I get InfoPath to show me the "subelements" of my XMLElement as fields?

    2. Is this possible to accomplish without custom code? We need to do this on several forms and would like to eventually turn them over to business users, and with custom code that might be impossible.

    Thanks in advance...

     

  • 05-19-2010 11:16 PM In reply to

    Re: InfoPath 2010 Connection to Custom WCF Service Issues

    Hi Mack247,

    I'm guessing that the service isn't returning the subelements with the sample values you gave it when you configured the data connection wizard. Without a full result set, InfoPath can't infer a proper schema and that may be why you aren't seeing the subelements. Just a guess though, but try modifying the data connection and specifying sample values that you know will return a rich result set.

    Good luck!

    Patrick Halstead
    Project Manager at Qdabra
  • 06-02-2010 11:16 PM In reply to

    Re: InfoPath 2010 Connection to Custom WCF Service Issues

    (from email)
    Patrick:Thank you for replying to my InfoPathDev.com forum question (http://www.infopathdev.com/forums/t/15495.aspx). I followed your advice, took a closer look at my DataContract, and was able to get InfoPath to recognize the data structure coming from the WCF service. I actually changed the WCF service to return a custom object, instead of an XMLElement object.I have a quick follow-up. I would like to have InfoPath provide the WCF input parameter dynamically, based on the value in a form field. For example, user clicks on "Fetch Data" button, the button's rules query the data, dynamically using the value in a field as the WCF's input parameter, get the data back and automatically populate some other form fields. Basically, this is designed to validate that the user typed in a valid employee id. I tried entering the XPath from the field (/my:myFields/my:empID) for the parameter value using the InfoPath Data Connection Wizard, but had no luck.Is there a way to do this without using a codebehind? I am comfortable coding if I have to, but I would like to be able to minimize custom coding for this project.Thanks,Mack

    ======================

    Hey Mack247,

    Assuming your data connection is a Web Service type, you should be able to bind the input parameter to a field in your main data source. In the rule that you are using to "Fetch" set the field with the value from the xpath before calling the WCF service query. That should do it.

     

    Patrick Halstead
    Project Manager at Qdabra
  • 08-05-2010 08:47 AM In reply to

    • jloyd
    • Not Ranked
    • Joined on 08-05-2010
    • Posts 1

    Re: InfoPath 2010 Connection to Custom WCF Service Issues

    Patrick/Mack247, I have a similar situation where I need InfoPath to return the XML structure. Wrapping the XmlElement inside a custom type didn't seem to have any effect (still no child elements). Mack247, I assume that when you said you replaced your XmlElement with a custom type that you mean you replaced with another type of primitive entirely? I don't have that luxury for my WCF as it can return an infinite number of schema types depending upon the input parameters. However, the returned schema for each InfoPath form instance would remain static so I just need to it set it initially when the data connection is configured. Is this possible in InfoPath?....  Joe

     

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