Calling Web Service from InfoPath 2010 with Parameters


In this post I will explain how to call a web service from InfoPath 2010 and how to pass a parameters to this web services and get the result.

I support that we have an existing web services which accept two parameters (int x,int y) and return integer as Sum of x and y.

Below is a screen shot after executing the web service

Now, In InfoPath, let’s start it.

Design your form as below:

Click on Manage Data Connection…

Click Add

Now set a sample values for both X and Y

Here is after I set a test values for X=1 and Y=4

Click Next

Now we define our web service in the form, after that we need to set the parameters and call it.

Click on the button and show its rules as below screen.

Add an Action

Set the values from your fields

Go to your web service connection and select X to set its value from textbox

Do same steps again for Y

Now, add a new action “Query for data

Select your connection and click OK

Now, drag and drop the SumResult field on your form

We finished now, just click F5 to run the form and call the web service.

After your fill the form (x and y) and click the button, you will receive the below warning where you can ignore it

Thanks for reading and sorry for long post 😉

Advertisements

9 thoughts on “Calling Web Service from InfoPath 2010 with Parameters

  1. Pingback: Save InfoPath Attachment to SharePoint 2010 Document Library | Mostafa Absy

  2. Hi Mostafa,

    Need your assistance, facing problem while calling a web service in InfoPath2010. This is the WS URL=http://xxxxxxx/hrws/Hrws?WSDL getting error “Infopath cannot connect to this web service because the format of the web service is not supported.”

  3. Pingback: Hate Code » Save InfoPath Attachment to SharePoint 2010 Document Library

  4. I am getting error when i follow same steps building InfoPath 2013 and publish it in SharePoint 2013.

    Does it work for only SharePoint 2010 ???

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s