Cisco Cisco Configuration Engine 3.5 Entwickleranleitung

Seite von 344
5-16
Cisco Configuration Engine Software Development Kit API Reference and Programmer Guide 3.5
OL-17661-02
Chapter 5      Web Services: Admin, Config, Image, Exec, NSM
Web Services Model
        CNSAttributeMsg _attr1 = new CNSAttributeMsg();
        _attr1.setName("IOShostname");
        String[] _values = new String[1];
        _values[0] = "ios_slinky";
        _attr1.setValues(_values);
        // Attribute 1
        //CNSAttribute _attr2 = new CNSAttribute();
        CNSAttributeMsg _attr2 = new CNSAttributeMsg();
        _attr2.setName("IOSdomain");
        _values = new String[1];
        _values[0] = "cisco.com";
        _attr2.setValues(_values);
        // Attribute 1
        //CNSAttribute _attr3 = new CNSAttribute();
        CNSAttributeMsg _attr3 = new CNSAttributeMsg();
        _attr2.setName("IOSpassword");
        _values = new String[1];
        _values[0] = "blender";
        _attr3.setValues(_values);
        CNSAttributeMsg[] _attrs = new CNSAttributeMsg[3];
        _attrs[0] = _attr1;
        _attrs[1] = _attr2;
        _attrs[2] = _attr2;
        try
        {
            m_svc.createDeviceWithAttr(_cnsDev, _attrs, null);
        }
        catch (Exception ex)
        {
            ex.printStackTrace();
        }
    }
}
Notes
Setting Credentials into an org.apache.axis.client.Stub
This document provides information for clients using the Apache Axis 1.1 or later as a client on how to 
set credentials (username & password) into a class extending org.apache.axis.client.Stub. The 
credentials are set using the HTTP Basic Authentication scheme. An example header: Authorization: 
Basic YWRtaW46Y2lzY28=
This document assumes a working knowledge of the Apache Axis SOAP Toolkit for Java, and that you 
have already generated your Java web service client stubs using WSDL2Java. 
 
See http://ws.apache.org/axis/java/user-guide.html#WSDL2Java.