Tailored Forms for Generic Webservice - InfoPath Dev
in

InfoPath Dev

Tailored Forms for Generic Webservice

Last post 01-22-2007 11:58 AM by Shiraz Cupala. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 01-18-2007 01:27 PM

    Tailored Forms for Generic Webservice

    I'm trying to implement an Infopath solution that posts an xml document (as string) to a webservice. When I created the first version of my form, it permitted me to drag two fields corresponding to the properties of the envelope being passed to the web service onto the design surface. The are XmlText and ItemType (a string). The form submits fine.

    What I need to do is instead of having a large xml text field on the form, I want to have form(s) that are modeled after the schemas of the xml that is acceptable. For instance, one schema could be a dog:

    <dog>
    <size/>
    <color/>
    </dog>

    and another could be cat:

    <cat>
    <hasClaws>true</hasClaws>
    <tailLength/>
    </cat>

    On the original version of the form, the xml (cat or dog) is pasted into the XmlText field, and "cat" is entered into the ItemType field. What I would prefer is to be able to let the user select an ItemType and be presented with either a cat or a dog form that would then capture the XmlText and ItemType before calling the generic webservice.

    And of course, I want to be able to point to an xsd to generate the cat or dog form. Any suggestions?
  • 01-20-2007 04:13 AM In reply to

    Re: Tailored Forms for Generic Webservice

    I noticed that nobody has responded in the last few days. If anyone knows whether or not this ie even possible, please respond. Thanks.
  • 01-22-2007 09:19 AM In reply to

    Re: Tailored Forms for Generic Webservice

    Hello, sorry for the delay and welcome to our forums. To do what you want will require some fancy rules or custom code.

    With custom code of course you can set the submit parameter to whatever you like.

    What we've done in a number of solutions is to create a large concat() expression using the rule Set a Field's Value. Then you can concat your exact XML on the fly and submit that.

    To actually generate the forms, since your Web Service is generic, you will likely need to create the form from scratch and build your schema manually in InfoPath (or create the XSD outside IP). Then build the view from that. Then you'll create a separate submit data connection to your generic web service.
    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-22-2007 10:16 AM In reply to

    Re: Tailored Forms for Generic Webservice

    Thanks for the advice Shiraz. With what I'm seeing so far, it looks like the best solution for me may be to create a custom object that takes a blob of XML and calls a web service. Then add a submit button to each specific InfoPath form and in the submit method, use CreateObject to instantiate it and pass in the XML and examine the return value. Do you know how to (easily?) pull the form's whole XML string from inside the submit method?
  • 01-22-2007 11:58 AM In reply to

    Re: Tailored Forms for Generic Webservice

    You're welcome. In the standard secondary submit method you should be able to specify the starting node for the data you want to submit. This is in the middle of the data connection wizard.
    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.