IASO2011 SOAP communication protocol

From IASO Wiki
Jump to: navigation, search

Contents


General

You may found WSDL for provisioning at https://Your provisioning service server/?wsdl. You may found sample WSDL here.

PHP 5.x SOAP client

Get groups

PHP request sample:

<?php
    $client = new SoapClient("https://Your provisioning service server/?wsdl");
    $result = $client->GetGroups(array(
        "request" => array(
            "credentials" => array(
                "server" => "Your management engine server",
                "user" => "admin",
                "password" => "password"
            )
        )
    ));
    if ($result->GetGroupsResult->result->errorCode == 0)
    {
        print "<h1>Succeeded.</h1>";
        print "<ul>";
        $arr = $result->GetGroupsResult->items->string;
        if (is_array($arr))
        {
            foreach ($result->GetGroupsResult->items->string as &$item)
            {
                print "<li>".$item."</li>";
            }
            print "</ul>";
        }
        else
        {
            print $arr;
        }
    }
    else
    {
        print "<h1>Failed.</h1>";
    }
?>

where:

  • "server" — IP address of Management Engine server;
  • "user" — user name to connect to Management engine server;
  • "password" — password to connect to Management Engine server.

Create user

PHP request sample:

<?php
    $client = new SoapClient("https://Your provisioning service server/?wsdl");
    $result = $client->CreateUser(array(
        "request" => array(
            "username" => "ws200@com",									
            "product" => "Full",											
            "credentials" => array(
                "server" => "Your management engine server",
                "user" => "admin",
                "password" => "password"
            )
        )
    ));
    if ($result->result->errorCode == 0)
    {
        print "<h1>Succeeded.</h1>";
        print "Username: ".$result->username."</br>";
        print "Password: ".$result->password."</br>";
    }
    else
    {
        print "<h1>Failed.</h1>";
    }
?>

where:

  • "username" — username which will be used during installation of IASO Backup 2010 application;
  • "product" — product name. The name should be similar to product name created on server side using Management Console;
  • "password" — password for particular user will be generated automatically;
  • "credentials" — see above.

Create group

PHP request sample:

<?php
    $client = new SoapClient("https://Your provisioning service server/?wsdl");
    $result = $client->CreateGroup(array(
        "request" => array(
            "name" => "ws200",
            "password" => "ws200",										
            "credentials" => array(
                "server" => "Your management engine server",
                "user" => "admin",
                "password" => "password"
            )
        )
    ));
    if ($result->CreateGroupResult->result->errorCode == 0)
    {
        print "<h1>Succeeded.</h1>";
    }
    else
    {
        print "<h1>Failed.</h1>";
    }
?>

where:

  • "name" — group name;
  • "password" — group password;
  • "credentials" — see above.

Delete group

PHP request sample:

<?php
    $client = new SoapClient("https://Your provisioning service server/?wsdl");
    $result = $client->DeleteGroup(array(
        "request" => array(
            "groupName" => "ws200",									
            "credentials" => array(
                "server" => "Your management engine server",
                "user" => "admin",
                "password" => "password"
            )
        )
    ));
    if ($result->DeleteGroupResult->result->errorCode == 0)
    {
        print "<h1>Succeeded.</h1>";
    }
    else
    {
        print "<h1>Failed.</h1>";
    }
?>

Delete user

PHP request sample:

<?php
    $client = new SoapClient("https://Your provisioning service server/?wsdl");
    $result = $client->DeleteUser(array(
        "request" => array(
            "userName" => "ws200",									
            "credentials" => array(
                "server" => "Your management engine server",
                "user" => "admin",
                "password" => "password"
            )
        )
    ));
    if ($result->DeleteUserResult->result->errorCode == 0)
    {
        print "<h1>Succeeded.</h1>";
    }
    else
    {
        print "<h1>Failed.</h1>";
    }
?>

Modify user

PHP request sample:

<?php
    $client = new SoapClient("https://Your provisioning service server/?wsdl");
    $result = $client->ModifyUser(array(
        "request" => array(
            "username" => "ws200@com",
            "field" => array(
                array (
                    "shortName" => "PN", // Product name
                    "content" => "Full"
                ),
                array (
                    "shortName" => "GN", // Group name
                    "content" => "iaso"
                ),
                array (
                    "shortName" => "ED", // Expiration date
                    "content" => "1329784132890" // seconds from 1970 year (time_t)
                ),
            ),						
            "credentials" => array(
                "server" => "Your management engine server",
                "user" => "admin",
                "password" => "password"
            )
        )
    ));
    if ($result->result->errorCode == 0)
    {
        print "<h1>Succeeded.</h1>";
    }
    else
    {
        print "<h1>Failed.</h1>";
    }
?>

C# .NET SOAP client

Generate a Proxy class for the Web Service

The .NET SDK simplifies the process of creating Web Service clients by providing the Web Services Description Language (wsdl.exe) utility. This utility generates proxy source code for an existing Web Service, just as IDL compilers generate DCOM proxies for DCOM components. The only difference between IDL and WSDL is that, WSDL is a language that describes the interface of a software component that is XML-based.

Let us generate source code for the proxies to the actual web service as shown below:

C:\MyProjects\WebServiceClient> wsdl /l:CS /protocol:SOAP http://<your_server>/?WSDL Microsoft (R) Web Services Description Language Utility [Microsoft (R) .NET Framework, Version 1.0.2914.16] Copyright (C) Microsoft Corp. 1998-2001. All rights reserved. Writing file 'C:\MyProjects\WebServiceClient\webService.cs'.

The above command creates a proxy for the web service from the WSDL document obtained from the URL http://your_server/?WSDL. The proxy uses SOAP as its protocol to talk to the web service and is generated as a C# source file.

Compile the Proxy class as a DLL Library

We can compile the C# source file into a dynamic link library (DLL) and then add a reference to this DLL to any project you want to create. Compile the proxy class as a DLL as shown below:

C:\MyProjects\WebServiceClient> csc /t:library /r:System.Web.Services.dll /r:System.Xml.dll webService.cs Microsoft (R) Visual C# Compiler Version 7.00.9254 [CLR version v1.0.2914] Copyright (C) Microsoft Corp 2000-2001. All rights reserved.

Create a Visual C# .NET Console Application project

Create a new Visual C# .NET Console Application project. Create a Reference to the webService.dll library.

Develop the WebServiceClient.cs class file

C# get groups sample:

    namespace SoapDemo
    {
        class WebServiceClient
        {
            static void Main(string[] args)
            {
                WebReference.Credentials creds = new WebReference.Credentials();
                creds.server = "your_engine_server";
                creds.user = "your_engine_user";
                creds.password = "your_engine_password";
                WebReference.webService webService = new WebReference.webService();
                WebReference.GetGroupsRequest groupsRequest = new WebReference.GetGroupsRequest();
                groupsRequest.credentials = creds;
                WebReference.StringListResponse groupsResponse = webService.GetGroups(groupsRequest);
                if (!groupsResponse.result.succeeded)
                {
                    Console.WriteLine("Error: " + groupsResponse.result.errorText);
                    return;
                }
                foreach(string str in groupsResponse.items)
                {
                    Console.WriteLine(str);
                }
            }
        }
    }

C# add user sample:

    namespace SoapDemo
    {
        class WebServiceClient
        {
            static void Main(string[] args)
            {
                WebReference.Credentials creds = new WebReference.Credentials();
                creds.server = "your_engine_server";
                creds.user = "your_engine_user";
                creds.password = "your_engine_password";
                WebReference.webService webService = new WebReference.webService();
                WebReference.CreateUserRequest createUserRequest = new WebReference.CreateUserRequest();
                createUserRequest.credentials = creds;
                createUserRequest.username = "new_user_name";
                createUserRequest.product = "product_to_assign_to";
                WebReference.CreateUserResponse createUserResponse = webService.CreateUser(createUserRequest);
                if (!createUserResponse.result.succeeded)
                {
                    Console.WriteLine("Error: " + createUserResponse.result.errorText);
                    return;
                }
                String userPassword = createUserResponse.password;
            }
        }
    }
Personal tools
Namespaces
Variants
Actions
Navigation
Downloads
Knowledge Base
Support
Toolbox