import java.io.*;
import java.net.*;
public class ClientUniVerwaltung {
private static final int BUFF_SIZE = 100;
public static void main(String[] argv) throws Exception {
String request =
"<?xml version='1.0' encoding='UTF-8'?>"+
"<soapenv:Envelope " +
"xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' " +
"xmlns:xsd='http://www.w3.org/2001/XMLSchema' " +
"xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> " +
"<soapenv:Body> "+
"<ns1:getLehrUmfangVonProfessor " +
"soapenv:encodingStyle= " +
"'http://schemas.xmlsoap.org/soap/encoding/' " +
"xmlns:ns1='UniVerwaltung'> " +
"<ProfName xsi:type='xsd:string'>Sokrates</ProfName>" +
"</ns1:getLehrUmfangVonProfessor>" +
"</soapenv:Body>"+
"</soapenv:Envelope>";
URL url = new URL(
"http://terra.inf.uos.de/axis/services/UniVerwaltung");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true); conn.setUseCaches(false);
conn.setRequestProperty("Accept", "text/xml");
conn.setRequestProperty("Connection", "keep-alive");
conn.setRequestProperty("Content-Type", "text/xml");
conn.setRequestProperty("Content-length",Integer.toString(request.length()));
conn.setRequestProperty("SOAPAction", "\" \"");
OutputStream out = conn.getOutputStream();
out.write(request.getBytes()); out.flush();
StringBuffer response = new StringBuffer(BUFF_SIZE);
InputStreamReader in =
new InputStreamReader(conn.getInputStream(), "UTF-8");
char buff[] = new char[BUFF_SIZE]; int n;
while ((n = in.read(buff, 0, BUFF_SIZE - 1)) > 0) {
response.append(buff, 0, n);
}
out.close(); in.close();
System.out.println( response.toString() );
}
}