Hi all,
I am having a few problems with soap and classpaths.
This may sound simple on the face of it but it is confusing me!
First we have a soap client using the apache soap client code, talking to
weblogic 6.
I remember at the time having to put xerces in the start of the classpath for
weblogic and setting up and XML registry for weblogic to use.
SOAP required some classes from javax.mail etc, so i remember lazily at the
time getting this from the current version of weblogic.jar (6.1 I believe).
With some reordering of things in the class path this seemed to work fine.
However we have since upgraded to service pack 3 for weblogic 6. And with this
in the client side classpath I only get null responses from soap.
It is not an option to just stick with the old weblogic.jar as we will shortly
be making soap requests from within weblogic.
I have done a bit of digging and found this to be the problem. A file exists in
weblogic.jar called javax.xml.parsers.DocumentBuilderFactory. I assume this
points to
the factory used for generating specific parser XML documents. The class
contained in this file is different between the two weblogic versions. This
however is not a problem becuase on
a client I can create my own and have this in the classpath first, or within
weblogic I can use XML registry to set it.
However the question is what to set this two. When the client used to work (pre
service pack 3 weblogic.jar) soap used to get the response and create an
element of type org.apache.crimson.tree.ElementNode.
I am not sure why it chose this. The class used to exist in the old
weblogic.jar. This has since been removed from weblogic.jar post service pack
3. The class I am not getting returned on the soap client is either
weblogic.apache.xerces.dom.DeferredElementImpl or
org.apache.xerces.dom.DeferredElementNSImpl. I can quite easily make it create
the latter one, either on the client or within weblogic by changing the
classpath or XML registry respectively. However soap doesn't seem to like this
and gives me a null value in the ((Element)result1.getValue()).toString() call.
Soap seems to want a org.apache.crimson.tree.ElementNode to be created. Why
cant it handle the others? Can I make it do so?
In the case of xerces not working, I have tried to code at the bottom of this
message .
I get the following out output, can somebody explain why?
Doc class org.apache.xerces.dom.DeferredDocumentImpl
[#document: null]
Any help appreciated
Thanks
Norman
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.xml.sax.InputSource;
import java.io.StringReader;
public class Test
{
public static void main (String[] args)
{
String payload = "<?xml version='1.0' encoding='UTF-8'?> " +
"<SOAP-ENV:Envelope
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-
ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
"<SOAP-ENV:Body> " +
"<ns1:loginResponse xmlns:ns1=\"urn:login\" SOAP-
ENV:encodingStyle=\"http://xml.apache.org/xml-soap/literalxml\"> " +
"<return> " +
"<login><sessionId></sessionId><worktype_mode>1</
worktype_mode><login_response>6: This account is locked as more than 3
unsuccessful login attempts have been
made</login_response><last_successful_login>26/11/2002
16:06:56</last_successful_login><last_unsuccessful_login>27/11/2002
11:20:50</last_unsuccessful_login></login>" +
"</return>" +
"</ns1:loginResponse>" +
"</SOAP-ENV:Body> " +
"</SOAP-ENV:Envelope>";
try {
System.setProperty
("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBui
lderFactoryImpl");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(false);
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource input = new InputSource(new StringReader(payload));
org.w3c.dom.Document doc = db.parse(input);
System.out.println("Doc class " + doc.getClass().getName());
System.out.println(doc);
}
catch (Exception e)
{
e.printStackTrace();
} // end of try-catch
} // end of main ()
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]