Integrations and APIs for Service

Get Involved. Join the Conversation.

Topic

    Leonardo Barbosa
    How invoke Webservice with custom button workspaceAnswered
    Topic posted March 12, 2015 by Leonardo BarbosaBronze Medal: 1,250+ Points 
    692 Views, 17 Comments
    Title:
    How invoke Webservice with custom button workspace
    Content:

    Hello guys,

     

    I need invoke Webservice through custom button workspace, but I don't know how can I do. My webservice work with SoapUI but I need to automate this process.

    See the image to better understand

     

    How can I making it? Someone can help me?

     

    Best,

    Image:

    Best Comment

    Heena Karir

    Hi Leonardo,

    I have used a weather web service for example. find below the code snippet:

    public void RuleActionInvoked(string actionName)

    {

    if (actionName == "Button Rule Action Invoke")

    {EndpointAddress epa = new EndpointAddress("https://wsf.cdyne.com/WeatherWS/Weather.asmx");

    BasicHttpsBinding bpa = new BasicHttpsBinding();

    WeatherSoapClient wsc = new WeatherSoapClient(bpa, epa);

    ForecastReturn fr = wsc.GetCityForecastByZIP("xxxx");

    MessageBox.Show("City: " + fr.City);

    MessageBox.Show(fr.Success.ToString());

    }

    }

    Also, I have attched the screen shot of the workspace rule.

    ~Heena Karir

    Comment

    • Mark Ericson

      Hi Leonardo,

      Have you investigated the Desktop Add-In framework?   That is how integrations from the desktop (calling other services) usually are implemented,  see; the Add-In Framework documentation.

      http://documentation.custhelp.com/euf/assets/devdocs/february2015/Connect_AddIn_Framework/Default.htm

    • Leonardo Barbosa

      Hi Mark,

       

      I appreciate your response, but my button is not AddIn. It's a simple button workspace and I need invoke webservice through him. I know that is possible but I don't know how..

       

      Best,

    • Heena Karir

      Hi Leonardo,

      If the button you are using is the Work space button and not the Add-In button then you can follow below steps:

      1. Write work space rule "when button is clicked then Execute add-in command"

      2. In the C# code for work space Add-In we have method : "RuleActionInvoked" under this method write your code of web service call. You will have to pass "actionName" to method which you will specify while creating work space rule.

      Hope this works for you

      ~Heena Karir

    • Leonardo Barbosa

      Hi Heena,

      I think it's helpfull to me. I'll find more about "RuleActionInvoked" to write C# code.

      I really appreciate your response. Have a nice day.

       

      Best,

    • Heena Karir

      Hi,

      If the solution is helpful to you make sure to rate the answer as it might help others as well.

      ~Heena

    • Barrilito van Dijk

      Hi Leonardo,

      Heena points out something important, rating answers helps out others, but this forum also needs more good example coding. So, if you made something that works (epsecially with the help of others on the forum), post the code so that others can learn from it or get good ideas. Offcourse you can post a general piece of code without revealing urls and private information which is not relevant to others.

      Thanks!

    • Leonardo Barbosa

      Hello Barrilito,

      I agree your response and it make sense. It's very important to me and others. In fact this a purpose here.

      Heena if you can provide a simple code I'll really appreciate

       

      Kind regards guys

    • Barrilito van Dijk

      Thanks wink

    • Heena Karir

      Hi Leonardo,

      I have used a weather web service for example. find below the code snippet:

      public void RuleActionInvoked(string actionName)

      {

      if (actionName == "Button Rule Action Invoke")

      {EndpointAddress epa = new EndpointAddress("https://wsf.cdyne.com/WeatherWS/Weather.asmx");

      BasicHttpsBinding bpa = new BasicHttpsBinding();

      WeatherSoapClient wsc = new WeatherSoapClient(bpa, epa);

      ForecastReturn fr = wsc.GetCityForecastByZIP("xxxx");

      MessageBox.Show("City: " + fr.City);

      MessageBox.Show(fr.Success.ToString());

      }

      }

      Also, I have attched the screen shot of the workspace rule.

      ~Heena Karir

    • Leonardo Barbosa

      Hello Heena,

       

      I really appreciate your response.. I'll implement it

       

      Best,

    • Hector Moreno

      Hi, i want to know how to consume a external webservice? 

    • Leonardo Barbosa

      Hello Hector

      I hope you're doing great.

      You need specify your EndPoint in the code and get all fields that you need

       

      Let me know which your requirement

    • Hector Moreno

      Hi Leonardo, 
      Thanks for your help,

      We have to call an external wsdl from rightnow, but i don't know where i have to put the code or which code we need.

      THanks

       

    • Gabriel Suarez

      Hi Everyone, 

      Related with this post, I would like to know.

      How I get information from the de entity where all this behaviour is executed?

      I mean, I need to integrate a system through but I need to send some information about the entity that I am working on.

      Thanks in advance,

      Bye!

    • Danette Beal

      Hi Grabriel,

      If you don't receive any feedback on this thread, I would encourage you to create a new topic. Its been my experience that some members will see the time stamp and not even bother looking at the new comment. I'd love to hear more about your specific question.

      Thanks!

      Danette, Community Manager