09-23-2010 06:10 PM - edited 03-16-2019 12:59 AM
Hello All
I have a problem with Cisco call manager version 4.3 while I am trying to connect via AXL
it reply with with
"<h1>Bad Request (Invalid Verb)</h1>"
Really Don't know why als I don't find the document for taht regarding to version 4.3 that talk about AXL Programming Guide
And I will attach the code that I ue if any one had a commect on that:
import java.io.*;
import java.net.*;
public class main
{
public static void main(String[] args)
{
//Declare references
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
String uidpwd="ccmadministrator:Stell@";
// Build the HTTP Header
sAXLSOAPRequest = "POST /CCMApi/AXL/V1/soapisapi.dll\r\n";
sAXLSOAPRequest += "Host: 10.110.200.254:80\r\n";
sAXLSOAPRequest += "Authorization: Basic "+ new sun.misc.BASE64Encoder().encode(uidpwd.getBytes()) + "\n";
sAXLSOAPRequest += "Accept: text/*\r\n";
sAXLSOAPRequest += "Content-type: text/xml\r\n";
sAXLSOAPRequest += "Content-length: ";
// Build the SOAP payload
sAXLRequest = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" ";
sAXLRequest += "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"> ";
sAXLRequest += "<SOAP-ENV:Body> <axl:getPhone xmlns:axl=\"http://www.cisco.com/AXL/1.0\" ";
sAXLRequest += " xsi:schemaLocation=\"http://www.cisco.com/AXL/1.0 http://gkar.cisco.com/schema/axlsoap.xsd\" ";
sAXLRequest += "sequence=\"1234\"> <phoneName>SEP222222222245</phoneName> ";
sAXLRequest += "</axl:getPhone> </SOAP-ENV:Body> </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 request
sAXLSOAPRequest += sAXLRequest;
// now that the message has been built, we can connect to server and send it
try
{
socket = new Socket("10.110.200.254", 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();
// output the response to the standard out
System.out.println(sb.toString());
} catch (UnknownHostException e)
{
System.err.println("Error connecting to host: " + e.getMessage());
return;
} catch (IOException ioe)
{
System.err.println("Error sending/receiving from server: " + ioe.getMessage());
// close the socket
try
{
if (socket != null) socket.close();
} catch (Exception exc)
{
System.err.println("Error closing connection to server: " + exc.getMessage());
}
return;
}
}
}
So Please I need your help urgent thanks
Solved! Go to Solution.
09-24-2010 02:23 AM
Dear Mr Ahmed,
try the following and it will work with call manager 4.3
your code needs the HTTP version to be specified in the request. Therefore, the following line of code in the sample code should be changed as shown below to include the HTTP version:
sAXLSOAPRequest = "POST /CCMApi/AXL/V1/soapisapi.dll\r\n";
to
sAXLSOAPRequest = "POST /CCMApi/AXL/V1/soapisapi.dll HTTP/1.1\r\n";
09-24-2010 02:23 AM
Dear Mr Ahmed,
try the following and it will work with call manager 4.3
your code needs the HTTP version to be specified in the request. Therefore, the following line of code in the sample code should be changed as shown below to include the HTTP version:
sAXLSOAPRequest = "POST /CCMApi/AXL/V1/soapisapi.dll\r\n";
to
sAXLSOAPRequest = "POST /CCMApi/AXL/V1/soapisapi.dll HTTP/1.1\r\n";
09-24-2010 02:31 AM
Thanks Ms. Sara
It is worked fine.
Really thank you alot
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: