19
Views
5
Comments
How to generate a list of all input/output parameters for integrations in an eSpace?
Question
Service Studio Version
11.54.83 (Build 63759)

I’m looking for a way to generate a complete list of input and output parameters for all integrations (REST/SOAP or exposed actions) within an eSpace.


The goal is to:

  • List all methods/actions
  • Capture their input and output parameters (name + data type)
  • Use this data to generate a documentation/report (PDF) via an existing utility
2023-10-16 05-50-48
Shingo Lam

I believe you are trying to do the same things as this component

https://www.outsystems.com/forge/component-overview/159/outdoc-o11 

Please take a look if this help

2022-08-02 04-09-47
Paul Joshua Bassig

Hi, thanks for your input. 


I tried to explore outdoc already but I cannot find any resources about the web services parameters in the version we have (2.2...)I'll try to update and see if I can find something. 

2026-01-08 12-12-29
shreyans wadyalkar

expecting your e-space can do this with c# : 

run-doc-generator

    ↓

Service Center API

    ↓

Download eSpace (.oml)

    ↓

Unzip

    ↓

Parse Model.xml

    ↓

Extract integrations + I/O

    ↓

Generate JSON / PDF





Service Center SOAP API (official)

Endpoint : https:///ServiceCenter/ServiceCenter.asmx

Method used : GetModuleBinary

This returns the exact .oml binary.



Create Console App and keep program cs like 



using System;

using System.IO;

using System.IO.Compression;

using System.Net;

using System.Text;

using System.Xml.Linq;

using System.Collections.Generic;

using System.Linq;


class Program

{

    static void Main()

    {

        string envUrl = "https://your-env";

        string espaceName = "MyESpace";

        string user = "admin";

        string password = "password";


        Console.WriteLine("Downloading eSpace...");

        byte[] oml = DownloadModule(envUrl, espaceName, user, password);


        File.WriteAllBytes("module.oml", oml);


        Console.WriteLine("Extracting...");

        ZipFile.ExtractToDirectory("module.oml", "extracted", true);


        Console.WriteLine("Parsing model...");

        var doc = XDocument.Load("extracted/Model.xml");


        var structures = doc.Descendants("Structure")

            .ToDictionary(

                s => s.Element("Id")!.Value,

                s => s.Element("Name")!.Value

            );


        var output = new List();




        // REST

        foreach (var rest in doc.Descendants("RestService"))

        {

            var service = rest.Element("Name")!.Value;


            foreach (var action in rest.Descendants("RestAction"))

            {

                output.Add(BuildAction(

                    service,

                    "REST",

                    action,

                    structures

                ));

            }

        }


        // SOAP

        foreach (var soap in doc.Descendants("WebService"))

        {

            var service = soap.Element("Name")!.Value;


            foreach (var method in soap.Descendants("WebServiceMethod"))

            {

                output.Add(BuildAction(

                    service,

                    "SOAP",

                    method,

                    structures

                ));

            }

        }


        // Server Actions

        foreach (var action in doc.Descendants("ServerAction"))

        {

            output.Add(BuildAction(

                "Internal",

                "ExposedAction",

                action,

                structures

            ));

        }


        File.WriteAllText(

            "integration-doc.json",

            System.Text.Json.JsonSerializer.Serialize(

                output,

                new System.Text.Json.JsonSerializerOptions { WriteIndented = true }

            )

        );


        Console.WriteLine("DONE – zero manual steps.");

    }


    static object BuildAction(

        string integration,

        string type,

        XElement node,

        Dictionary structures)

    {

        return new

        {

            Integration = integration,

            Type = type,

            Method = node.Element("Name")!.Value,

            Inputs = ExtractParams(node, "InputParameter", structures),

            Outputs = ExtractParams(node, "OutputParameter", structures)

        };

    }


    static List ExtractParams(



        XElement node,

        string tag,

        Dictionary structures)

    {

        var list = new List();




        foreach (var p in node.Descendants(tag))

        {

            string resolvedType =

                p.Descendants("PrimitiveType").FirstOrDefault()?.Value ??

                structures.GetValueOrDefault(

                    p.Descendants("StructureId").FirstOrDefault()?.Value ?? "",

                    "Complex"

                );


            list.Add(new

            {

                Name = p.Element("Name")!.Value,

                Type = resolvedType

            });

        }

        return list;

    }


    static byte[] DownloadModule(

        string envUrl,

        string moduleName,

        string user,

        string password)

    {

        var request = (HttpWebRequest)WebRequest.Create(

            $"{envUrl}/ServiceCenter/ServiceCenter.asmx"

        );


        request.Method = "POST";

        request.ContentType = "text/xml; charset=utf-8";

        request.Headers.Add(

            "SOAPAction",

            "\"http://www.outsystems.com/GetModuleBinary\""

        );


        string auth = Convert.ToBase64String(

            Encoding.ASCII.GetBytes($"{user}:{password}")

        );

        request.Headers["Authorization"] = $"Basic {auth}";


        string soap = $@"


  

    

      {moduleName}

    

  

";


        using var stream = request.GetRequestStream();

        stream.Write(Encoding.UTF8.GetBytes(soap));


        using var response = request.GetResponse().GetResponseStream();

        using var reader = new StreamReader(response);

        var xml = XDocument.Parse(reader.ReadToEnd());


        return Convert.FromBase64String(

            xml.Descendants("Binary").First().Value

        );

    }

}


2022-08-02 04-09-47
Paul Joshua Bassig

Thank you 🙏

2023-10-16 05-50-48
Shingo Lam

if this approach solve your issue, please mark it as solution

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.