Skip to main content

 

 

 

Template:OutSystems/Documentation_KB/Breadcrumb_New_Layout

 

 

Template:OutSystems/OSLanguageSwitcher

 

 

 

OutSystems

How to consume a Web Service in Integration Studio

Template:OutSystems/Documentation_KB/ContentCollaboration
  • Edit
    Collaborate with us
    Edit this page on GitHub
  • OutSystems includes a feature to import Web Services and automatically create the code and data structures to be able to call Web Service methods, just like you were using actions built with Service Studio.

    However, there are some patterns of Web Services which can't be natively consumed with this feature. For these cases, the alternative is to consume the Web Service in Integration Studio.

    This article explains step by step how to create an Extension to consume a Web Service using Integration Studio. The basic layout of what you need to do is the following:

    1. Create an Extension with one Action for every Web Service method you need to use.

    2. Create a data model (structures) to represent the data types in your Web Service.

    3. Import the Web Service in the Extension's code using Visual Studio.

    4. In the Action implementation, call the Web Service method by mapping the inputs and outputs from the Web Service data types to your Extension data model.

    This article cheats through steps 2 and 4 by having a very simple data model, but that's usually where you spend most development time.

    Consume a Web Service in Integration Studio

    The example below shows a simple Web Service named HelloWorld that contains only one method, named Ping. This method returns the input Text with "pong: " prepended to it.

    To consume this Webs Service, do the following:

    1. Create an Action for the Ping method, and set up its inputs and outputs according to the data types defined in the Web Service. In this case, the types are simple Texts. Usually, this might get a bit more complex with structures to hold more complex data types.

      Create action in Integration Studio

    2. Now you need to implement the Action. For that, open the extension's source code by clicking the "Edit Source Code .NET" button on the toolbar.

      Integration Studio toolbar

      This opens Visual Studio. Now you need to import the Web Reference in .Net.

    3. Right Click on "Service References" and click "Add Service Reference..."

      Add service reference

    4. Click "Advanced..."

      Add service reference advanced settings

    5. Click "Add Web Reference..."

      Add web reference

    6. Fill the URL Field with the path to your WSDL and click the little green arrow.

      Add web reference URL

    7. After the WSDL loads and all the information seems correct, click "Add Reference" to add it to your project.

      Add reference to project

      Now you only have to implement the Ping Action so that it calls the Web Service.

    8. Edit the WebServiceConsume.cs file and add the following to the header:

      using  OutSystems.NssWebServiceConsume.vmos60netx64;
      
    9. Implement the MssPing method with:

      HelloWorld webservice = new  HelloWorld();
      ssOutput = webservice.Ping(ssInput);
      
    10. Close Visual Studio, Verify and Save the Extension, and publish it on the server.

    Now, your modules can reference this Extension's Ping Action and use the HelloWorld Web Service.

    With this you can import any Web Service supported by Visual Studio into OutSystems.

    To inspect the code yourself, check out this sample app published by the OutSystems community.