API > API > Connecting to the APIs

Connecting to the APIs

Necessary steps for configuring Visual Studio 2010
  1. Open Visual Studio and click in the Menu on File >New >Project... (Ctrl + Shift + N).

  2. Select ConsoleApplication from the various templates and click OK.

  3. Go to the Solution Explorer panel and right-click on the project folder. At this point left-click with the mouse on Add Service Reference.

  4. In the window that opens enter the URL to access the APIs in the Address field https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl and click Go. Select the service which appears under the item Services, you can edit the Namespace, and click OK.

  5. Repeat steps 3, 4 and 5 two more times to add the other required services by changing the Address field with the following URLs:
    https://api.dc1.computing.cloud.it/WsCommon/v2.9/WsCommon.svc?wsdl
    https://api.dc1.computing.cloud.it/WsLicense/v2.9/WsLicense.svc?wsdl
  6. In the file app.config edit the parameter maxReceivedMessageSize as shown below:
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <system.serviceModel>
     <bindings>
      <basicHttpBinding>
       <binding name="BasicHttpsEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00"
        receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
        bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
         maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        <security mode="TransportWithMessageCredential">
         <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
         <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
       </binding>
      </basicHttpBinding>
      <wsHttpBinding>
       <binding name="HttpsEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00"
        receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
        transactionFlow="false" hostNameComparisonMode="StrongWildcard"
        maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
        allowCookies="false">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
         maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        <reliableSession ordered="true" inactivityTimeout="00:10:00"
         enabled="false" />
         <security mode="TransportWithMessageCredential">
          <transport clientCredentialType="None" proxyCredentialType="None"
           realm="" />
          <message clientCredentialType="UserName" negotiateServiceCredential="true"
           algorithmSuite="Default" establishSecurityContext="false" />
          </security>
         </binding>
        </wsHttpBinding>
       </bindings>
      <client>
       <endpoint address="https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc"
        binding="wsHttpBinding" bindingConfiguration="HttpsEndpoint"
        contract="ArubaWS.IWsEndUser" name="HttpsEndpoint" />
       <endpoint address="https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc/soap11"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpsEndpoint"
        contract="ArubaWS.IWsEndUser" name="BasicHttpsEndpoint" />
      </client>
     </system.serviceModel>
      
    At this point you just need to connect to the APIs by editing the Main method of the Program.cs file.
    using ConsoleApplication1.ServiceReference1;
     
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
     
                //creates a new WsEndUserClient type object
                var client = new WsEndUserClient("HttpsEndpoint");
    
                // ...
    
                try
                {
                   client.Close();
                }
                catch (Exception)
                {
                   client.Abort();
                }
    
     
            }
        }
    }
     
Necessary steps for configuring NetBeans 7
  1. Open NetBeans and click in the Menu on File > New > New Project... (Ctrl + Maiusc + N).

  2. Select Java > Java Application from the various templates and click on Next.

  3. Change the Project Name in ArubaCloud and click Finish.

  4. Go to the Projects panel and right-click on the project folder. At this point left-click with the mouse on New > Web Service Client....

  5. In the window that opens in the field WSDL URL enter: the url to login to the APIs https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl leave the Package field blank, select the item Generate Dispatch code and click Finish. Then confirm by accepting the certificates that will be downloaded.

  6. Go to the Projects panel open the Web Service References folder and right-click on the object WsEndUser. At this point left-click with the mouse on Edit Web Service Attributes ....

  7. In the window that opens in the section HttpsEndPoint Binding > Security select the item Use development defaults, at this point NetBeans will ask you to replace the axis libraries with those of a meter, confirm by clicking OK.

  8. Then uncheck the item Use developement defaults and delete Use developement defaults and Use developement defaults.

  9. Click on the Tab > Wsimport Options and add an Tab > Wsimport Options with these values Option=binding Value=simple-binding.xjb, confirm by clicking OK.

  10. Go to the netbeans installation folder to create a file with the name simple-binding.xjb. Copy the following inside it:
    <jxb:bindings version="1.0" 
        xmlns:jxb="http://java.sun.com/xml/ns/jaxb" 
        xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
        <jxb:globalBindings generateElementProperty="false" /> 
        </jxb:bindings>
  11. Repeat steps 4, 5, 6 and 9 two more times to add the other required services by changing the WSDL URL field with the following URLs:
    https://api.dc1.computing.cloud.it/WsCommon/v2.9/WsCommon.svc?wsdl
    https://api.dc1.computing.cloud.it/WsLicense/v2.9/WsLicense.svc?wsdl.
  12. Recompile the entire project and at this point you just need to test the link to the APIs by changing the Main method of the ArubaCloud.java file.
     
            package arubacloud;
    
            import https.api_computing_cloud_it.wscommon.v2.IWsCommon;
            import https.api_computing_cloud_it.wscommon.v2.WsCommon;
            import https.api_computing_cloud_it.wsenduser.v2.IWsEndUser;
            import https.api_computing_cloud_it.wsenduser.v2.WsEndUser;
            import https.api_computing_cloud_it.wslicense.v2.IWsLicense;
            import https.api_computing_cloud_it.wslicense.v2.WsLicense;
    
            public class ArubaCloud {
    
                public static void main(String[] args) {
     
                    try
                    {	
                        IWsEndUser iWsEndUser = new WsEndUser().getHttpsEndpoint();
    			        IWsCommon iWsCommon = new WsCommon().getHttpsEndpoint();
    			        IWsLicense iWsLicense = new WsLicense().getHttpsEndpoint();
    
                    } catch (Exception e) 
                    { 
                        System.out.println(e); 
                    } 
                } 
            }
            

Versione
API v2.9 URL: https://api.dc1.computing.cloud.it/WsEndUser/v2.9/WsEndUser.svc?wsdl
API v2.9 URL: https://api.dc1.computing.cloud.it/WsCommon/v2.9/WsCommon.svc?wsdl
API v2.9 URL: https://api.dc1.computing.cloud.it/WsLicense/v2.9/WsLicense.svc?wsdl