When I view the soap message in tcpmon, it works great, but I keep getting
errors trying to test the client code. Here is the code:
package client;
import stubs.*;
import org.apache.axis.utils.XMLUtils;
/**
* Client.java
*
*/
public class Client {
/**
* main method is what is called first.
*/
public static void main(String[] args) {
try {
MessageWSServiceLocator serviceLocator = new
MessageWSServiceLocator();
MessageWSSoapBindingStub stub =
(MessageWSSoapBindingStub)serviceLocator.getMessageWS(new java.net.URL
("http://localhost:7001/axis/services/MessageWS"));
/* Build the Request */
String sXML = "<Query>select * from sample</Query>";
java.io.StringReader stringIn = new
java.io.StringReader(sXML);
org.w3c.dom.Document doc = XMLUtils.newDocument(new
org.xml.sax.InputSource(stringIn));
/* Send the Request and get the results */
// error on next line with a conversion error.
org.w3c.dom.Document docReturnValue =
(org.w3c.dom.Document)stub.getDOM(doc);
/* View the results */
System.out.println("select * from sample returns: \n" +
XMLUtils.DocumentToString(docReturnValue));
} catch (Exception e) {
System.out.println("EXCEPTION in Client.main(): " +
e.getMessage());
e.printStackTrace(System.out);
}
}
}
I just want to see the resulting Document as a string. How do I do this?
Thanks,
Ken Lee