Return value from Web Service submit - InfoPath Dev
in

InfoPath Dev

Return value from Web Service submit

Last post 03-04-2014 09:59 AM by craig.j.comeau. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 01-15-2007 06:59 AM

    • jdogan
    • Not Ranked
    • Joined on 01-15-2007
    • USA
    • Posts 9

    Return value from Web Service submit

    Hello,

    I am wondering if it is possible to handle a web method return value after submitting a form? Basically, I have a web method

    Guid Submit(){...}

    When submitting a new form, the Guid returned is the new Id in the database, which I would like to capture and store in a form dataField so that if the user clicks the Submit again, it will update the existing database record instead of creating a new record.

    I am assuming this requires custom submit code, if its even possible. If anyone has advice, it would be much appreciated!

    Jason
  • 01-16-2007 03:40 PM In reply to

    Re: Return value from Web Service submit

    You can probably do what you want by using a Receive Data connection rather than a Submit Data connection. Both allow submit, the difference is that the Receive one lets you get data back as a result.
  • 01-17-2007 06:38 AM In reply to

    • jdogan
    • Not Ranked
    • Joined on 01-15-2007
    • USA
    • Posts 9

    Re: Return value from Web Service submit

    Thanks Greg,

    Before I saw your reply, I ended up adding a web reference to my web service, and then adding custom submit code that invokes the method on the web service directly instead of utilizing a data connection at all.

    <Code Snippet>
    public void FormEvents_Submit(object sender, SubmitEventArgs e)
    {
    XPathNavigator nav = MainDataSource.CreateNavigator();
    XPathNavigator idNode = nav.SelectSingleNode("/XPath/Node/That/Stores/The/FormId", this.NamespaceManager);
    // We need to capture the return value of the submit, so that we can update the FormId.
    InfoPathService.IInfoPathForm IPService = new InfoPathService.IInfoPathForm();
    XPathNavigator responseNode = nav.SelectSingleNode("/XPath/Node/That/Contains/The/Response", this.NamespaceManager);
    Guid FormId = IPService.SubmitInfoPathForm(responseNode.InnerXml);
    idNode.SetValue(FormId.ToString());
    e.CancelableArgs.Cancel = false;
    }
    </Code Snippet>

    This looks like it does what I need, so I'll run with that for now.
    Thanks again!

    Jason
  • 01-17-2007 09:22 AM In reply to

    Re: Return value from Web Service submit

    Great! Glad to hear you got it working!
  • 01-31-2007 12:35 PM In reply to

    Re: Return value from Web Service submit

    Greg,

    Can you elaborate on using the Receive Data Connection? I've created a Receive DC, but don't know how to assign value to the input parameter for the web service (it doesn't let you select the receive service when specifying submit options).
  • 02-06-2007 04:26 PM In reply to

    Re: Return value from Web Service submit

    The receive DC should provide query parameters as well. Are you seeing a difference in the query parameters between a receive DC and a submit DC to the same data source?
  • 02-16-2009 02:06 PM In reply to

    Re: Return value from Web Service submit

    I am running into the same issue. The query params are locked for the receive DC and you have to use a rule action to assign the values (one by one) *and* it doesn't seem to accept repeating values. Is there any way to do both without resorting to code? I need to submit a repeating table (lineitems) and get back a record ID to put back into the form.
  • 06-02-2011 05:17 AM In reply to

    Re: Return value from Web Service submit

    Hi,

    Any possibility of getting this scenario working in InfoPath 2010 ?

    Thanks

    Ajay Sawant

  • 06-02-2011 09:59 AM In reply to

    Re: Return value from Web Service submit

    I'm confused what "this scenario" refers to. If you just need to get back a return value from a Web Service, you can create a Retrieve data connection that submits and that will return results. You can use code or qRules to access those results.

    The original poster seemed more interested in submitting repeating data to a Web service. We have a generic Web service (DBXL) that supports this and we pass the XML as a string when we call it. The Web service is smart and parses out the repeating data and maps to SQL based on a user-defined XML-to-SQL mapping (it's data driven). Seems like the original poster needs a similar approach.

    Patrick Halstead
    Project Manager at Qdabra
  • 03-04-2014 09:59 AM In reply to

    Re: Return value from Web Service submit

    Hi Patrick How would one go about creating a receive data connection that submits through qrules? Which i have.
Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.