Method Community

 

Need an Example

Last post 03-17-2014 3:50 PM by Anonymous. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-13-2014 1:30 PM

    Need an Example

    I am trying to use the Web Service Action and am hoping someone can point me to a place in the system where it is used so I can look at it.   The documentation is limited in understanding the formating and use of parameters and how they are ultimately sent to the URL provided.  A couple of samples will go a long way to understanding it better.

    stuart

    Stuart Katz
    Noggin Builders
    Let your children come explore the wonders!
  • 03-17-2014 12:22 PM In reply to

    Re: Need an Example

    Hi Stuart,

    I created an example of using the "Call WebService" action in my own account. Hopefully you will find this helpful, I actually used a public web service offered by w3schools for this example, so technically you could recreate this yourself in your own account.

    For more information on the specific w3Schools web service I am using in this example, check out this URL.

    If you go to the link provided above, you should see two functions we can use for this TempConvert WebService:

    CelsiusToFahrenheit
    - FahrenheitToCelsius

    Because I am doing my example using Temperature Conversions, I first created a table labelled "Temperature", then added two int fields, "Celsius" and "Fahrenheit". I then added two buttons, one to convert from C to F, the other to convert from F to C.

    Screenshot of my Temperature Conversion Screen in Method:

    The idea is, you enter a value in one of the two degree fields, then when you submit the corresponding button, you are calling the TempConvert WebService from w3Schools. The screenshot below is an example of how I setup the Temperature WebService to convert from Fahrenheit to Celsius:

    Pay close attention to the URL field and Function Name fields from the screenshot above, these must be exact or your WebService call won't work.  The URL I entered is the same as the URL I gave a link in the first paragraph of this post.  The "Function Name" I used in this screenshot was also taken from the link provided above, for my screenshot I used "FahrenheitToCelsius", which again was provided by the TemperatureConvert WebService.  For my other button, "Convert C to F", I am using the other Function Name offered for this WebService, labelled "CelsiusToFahrenheit".  

    For the "Insert Parameters" option, I am using one parameter for each of my two WebService calls.  For both, I chose my Parameter name as the name of the temperature I am giving, and the value, I am using the "Value From Screen" option and selecting the appropriate Temperature text field value.

    Take notice of the checkbox option from the above screenshot for "WebService Returns a Response", if you are returning a value from your WebService (as I am in this example), you need to make sure this value is checked, and make sure that you are storing this in an "Action Result Name".  For my example this Returned Response is going to be my converted value, which I am storing in a pop-up message on my screen, and into the opposing temperature textbox.

    The Screenshot below shows my example with the pop-up message of my Converted Result:

     

    I hope this example helps explain using the Call WebService action a little better for you.  You could also find an example on one of the Method screens where this is being used, but you would have to have the "Field Services" 3rd party app installed in your Method Account to view this.  If you do have it, or are going to download it, make a copy of the FieldServiceMOB_WorkOrders screen to see this other example.  We are using this for the timers on this screen, so if you click "edit" for either the Start Timer or Stop Timer, you will see the "Call WebService" action used here, and you can view the details.

    Please let me know if you have any questions regarding the example I provided here.

    -Ben

  • 03-17-2014 12:46 PM In reply to

    Re: Need an Example

    Ben,

    Thanks for the great example.  It will help as I work with it further.  Understand about making sure the names and parameters are exact.

    Stuart

    Stuart Katz
    Noggin Builders
    Let your children come explore the wonders!
  • 03-17-2014 3:50 PM In reply to

    Re: Need an Example

    Stuart,

    It's no problem, just let me know if you have any issues.

    -Ben

Page 1 of 1 (4 items)