Re: CISCO getting user information, like login / name

Ana Soares <[email protected]> Wed, 22 Mar 2006 09:52:43 +0000
Newsgroups gmane.comp.java.sun.jtapi
Message-ID <[email protected]>
Hello,

Here I'll show you an example to get information from one user - lock.

String sAXLSOAPRequest = null;        // will hold the complete request,
                                              // HTTP header and SOAP
payload
        String sAXLRequest = null;            // will hold only the SOAP
payload
        Socket socket = null;                 // socket to AXL server
        OutputStream out = null;              // output stream to server
        InputStream in = null;                // input stream from server
        byte[] bArray = null;                 // buffer for reading response
from server
    ArrayList listaDevices = new ArrayList();


        // Build the HTTP Header
        sAXLSOAPRequest = "POST /CCMApi/AXL/V1/soapisapi.dll \r\n";

      sAXLSOAPRequest += "Host: " + server + ":" + port + "\r\n";
    sAXLSOAPRequest += "Authorization: Basic "+ pass + "\r\n";

        sAXLSOAPRequest += "Content-type: text/xml\r\n";
        sAXLSOAPRequest += "Content-length: ";
        sAXLRequest =  "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"
http://schemas.xmlsoap.org/soap/envelope/\" " ;
        sAXLRequest += "xmlns:xsi=\"
http://www.w3.org/2001/XMLSchema-instance\" ";
        sAXLRequest += "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">";
        sAXLRequest += "<SOAP-ENV:Body>";
        sAXLRequest += "<axl:getUser xmlns:axl=\"
http://www.cisco.com/AXL/1.0\" xsi:schemaLocation=\"
http://www.cisco.com/AXL/1.0 http://gkar.cisco.com/schema/axlsoap.xsd\"
sequence=\"1234\">";
        sAXLRequest += "<userid>lock</userid>";
        sAXLRequest += "</axl:getUser>";
        sAXLRequest += "</SOAP-ENV:Body>";
        sAXLRequest += "</SOAP-ENV:Envelope>";

        // finish the HTTP Header
        sAXLSOAPRequest += sAXLRequest.length();
        sAXLSOAPRequest += "\r\n\r\n";

        // now add the SOAP payload to the HTTP header, which completes the
AXL SOAP
    sAXLSOAPRequest += sAXLRequest;

        // now that the message has been built, we can connect to server and
send it

        try{
      Socket = new Socket(server, 80);

            out = socket.getOutputStream();
            in = socket.getInputStream();

            // send the request to the host
            out.write(sAXLSOAPRequest.getBytes());
            // read the response from the host
            StringBuffer sb = new StringBuffer(2048);
            bArray = new byte[2048];
            int ch = 0;
            int sum = 0;
            while ( (ch = in.read(bArray)) != -1 ){
                sum += ch;
                sb.append(new String(bArray, 0, ch));
            }
            socket.close();

Then you can look for the information you want in the response from de
server.

Ana


On 3/21/06, Jörg Wiesmann <[email protected]> wrote:
>
> Hello Ana,
>
> "I hope it help's", sorrily not :-)
> You may have any example for me? I do not really understand what you mean.
> Regards Jörg
>
> Ana Soares wrote:
> > Hi,
> >
> > Normaly to get information from the user, or from the phone I will
> > make a soap request to the server.
> > This request has in the body an AXL method.
> >
> > I hope it help's
> >
> > Ana
> >
> > On 3/21/06, *Jörg Wiesmann* <[email protected]
> > <mailto:[email protected]>> wrote:
> >
> >     Hello,
> >
> >     i wrote a quite fine working application with the usabillity of
> >     CTI with the
> >     CISCO implementation.
> >     But now i got to add more phones to the application, which got the
> >     same
> >     number, but different terminals.
> >     In fact that any user is able to connect to any phone, doesn´t
> >     care of the
> >     MAC-Address, it is hard to find out which terminal i shall connect
> >     to the
> >     server.
> >
> >     My question is:
> >     Is there any possibility to get the userinformation from phone?
> >     Like the login or the name assigned in the callmanager?
> >     Any help would be great!
> >
> >     Thanks Jörg!
> >
> >
> ===========================================================================
> >     To unsubscribe, send email to [email protected]
> >     <mailto:[email protected]> and include in the body
> >     of the message "signoff JTAPI-INTEREST".  For general help, send
> >     email to
> >     [email protected] <mailto:[email protected]> and include
> >     in the body of the message "help".
> >
> >
> >
> ===========================================================================
> > To unsubscribe, send email to [email protected] and include in the
> > body of the message "signoff JTAPI-INTEREST". For general help, send
> > email to [email protected] and include in the body of the message
> > "help".
>
>
> ===========================================================================
> To unsubscribe, send email to [email protected] and include in the
> body
> of the message "signoff JTAPI-INTEREST".  For general help, send email to
> [email protected] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JTAPI-INTEREST".  For general help, send email to
[email protected] and include in the body of the message "help".