The Holy Java

Building the right thing, building it right, fast

Archive for May, 2006

Sending a SOAP request to a Web Service via URLConnection

Posted by Jakub Holý on May 25, 2006

You may want to test you web service by sending it a manually composed request and reading the XML returned. Here’s how to do it (e.g. using BeanShell in jEdit):

The SOAP request

<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd="">
    <getUserByEmail xmlns="">

The Java code

String soapXml =   // jEdit: = buffer.getText(0,buffer.getLength()) url = new"http://localhost:9081/myServiceWAR/services/MyService"); conn = url.openConnection();
// Set the necessary header fields
conn.setRequestProperty("SOAPAction", "http://localhost:9081/myServiceWAR/services/MyService");
// Send the request wr = new;
// Read the response rd = new;
String line;
while ((line = rd.readLine()) != null) { System.out.println(line); /*jEdit: print(line); */ }

Posted in j2ee, Languages | Tagged: , , , | 2 Comments »

RAD, WebSphere and changing the classloader mode

Posted by Jakub Holý on May 4, 2006

I’ve spent hours trying to change the classloader mode for a .war include in an .ear application and deployed to the WebSphere Portal v5.1 Test Environment by means of Rational Application Developer’s server configuration editor. I was able to change to for the EAR, but when I changed the mode for a WAR of the EAR from PARENT_FIRST to PARENT_LAST and saved the configuration, I was required to republish, after doing this RAD promted me to reload the configuration from the disk because it has changed. I did so – and my change to parent_last was gone.

Finally i discovered that if I stop the server, remove the application (EAR), republish (?), add the application, change the classloader mode of all WARs in question (and perhaps the EAR as well), save the config. and republish, the change will really apply.

I’m looking forward to have even more fun with WebSphere and RAD… 😉

RAD 6.0
WebSphere Portal v5.1 Test Environment

Posted in WebSphere | Comments Off on RAD, WebSphere and changing the classloader mode