My SOAP failed to request from caa

Discuss Scalix Management Services ( formerly Scalix Admin Console )

Moderator: ScalixSupport

tancy

My SOAP failed to request from caa

Postby tancy » Thu Mar 06, 2008 9:18 am

Here is my code

import java.io.*;
import java.net.*;

public class Scalix
{
public static void main(String[] args)
{
String sAXLSOAPRequest = null;
String sAXLRequest = null;
Socket socket = null;
OutputStream out = null;
InputStream in = null;
byte[] bArray = null;

sAXLSOAPRequest = "POST /caa HTTP/1.1\r\n";
sAXLSOAPRequest += "Host: mail.test.com:80\r\n";
sAXLSOAPRequest += "Accept: */*\r\n";
sAXLSOAPRequest += "User-Agent: Scalix CAA/Ubermanager 1.0\r\n";
sAXLSOAPRequest += "Connection: Keep-Alive\r\n";
sAXLSOAPRequest += "Pragma: no-cache\r\n";
sAXLSOAPRequest += "SOAPAction: \"\"\r\n";
sAXLSOAPRequest += "Host: mail.unosvoice.com\r\n";
sAXLSOAPRequest += "Content-type: text/xml; charset=\"utf-8\"\r\n";
sAXLSOAPRequest += "Content-length: ";

sAXLRequest = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
" <SOAP-ENV:Body>" +
" <scalix-caa:CAARequestMessage xmlns:scalix-caa=\"http://www.scalix.com/caa\">" +
" <ServiceType>scalix.res</ServiceType>" +
" <FunctionName>GetMailNodeList</FunctionName>" +
" <Credentials id=\"12345\">" +
" <Identity name=\"sxadmin\" passwd=\"123456\"/>" +
" </Credentials>" +
" <ScalixServers>" +
" <Host>mail.test.com</Host>" +
" </ScalixServers>" +
" <GetMailNodeListParameters/>" +
" </scalix-caa:CAARequestMessage>" +
" </SOAP-ENV:Body>" +
"</SOAP-ENV:Envelope>";

sAXLSOAPRequest += sAXLRequest.length();
sAXLSOAPRequest += "\r\n";
sAXLSOAPRequest += sAXLRequest;

try
{
socket = new Socket("mail.test.com", 80);
out = socket.getOutputStream();
in = socket.getInputStream();
out.write(sAXLSOAPRequest.getBytes());

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();
System.out.println(sb.toString());
}
catch (Exception ex)
{
System.out.println(ex);

try
{
if (socket != null)
{
socket.close();
}
}
catch (Exception exc)
{
}
}
}
}

After I ran the code, it halted for quite sometime, and gave me below response:

HTTP/1.1 400 Bad Request
Date: Thu, 06 Mar 2008 12:43:55 GMT
Server: Apache/2.0.52 (CentOS)
Content-Length: 310
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.0.52 (CentOS) Server at mail.test.com Port 80</address>
</body></html>


What's wrong ? If there any example code I can take a look ???

Valerion
Scalix Star
Scalix Star
Posts: 2730
Joined: Thu Feb 26, 2004 7:40 am
Location: Johannesburg, South Africa
Contact:

Postby Valerion » Fri Mar 07, 2008 3:41 am

I suggest you print the generated XML to a file/screen and compare it to the API guide for 11.3 on the Scalix website.


Return to “Scalix Management Services”



Who is online

Users browsing this forum: No registered users and 1 guest