I got it working with Xerces V1.4.4. I'm still not quite sure how I broke it to begin with.
On the server I'm running Tomcat embedded in Jboss so the the system properties to load the parser factory are set on the java command line for JBoss. On the client I'm running my tests from within Forte so I was copying the jar file for the parser into the lib\ext dir for Forte, removing the old parser jar, and restarting Forte. I'm not sure how it's system property is set - I'll dump it via my test client to see. Maybe that's part of the problem too. It's somewhat strange that it works with Xerces 1.4.4 but not 2.0.1. Maybe I should retest to make sure. Rich -----Original Message----- From: Peter Tandara-Kuhns [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 22, 2002 15:25 To: '[EMAIL PROTECTED]' Subject: RE: SOAPException parsing Fault element? I have encountered this problem when making SOAP client calls from within Weblogic 6.1. Strictly speaking, it is a parser bug, but it is one that could be easily handled by a small change to the Apache code. The problem is that the getNamespaceURI method of the class that implements the org.w3c.dom.Element interface is erroneously returning "" instead of null. Because of this, Apache SOAP ignores the value faultcode element altogether, resulting in the error you see. Follow the code below and you can see how this happens: < from class org.apache.soap.Fault > if (Constants.Q_ELEM_FAULT.matches(root)) { Element faultCodeEl = null; Element faultStringEl = null; Element faultActorEl = null; Element detailEl = null; Vector faultEntries = new Vector(); Element tempEl = DOMUtils.getFirstChildElement(root); // Deserialize any fault attributes. fault.attrHandler = AttributeHandler.unmarshall(root, ctx); // Examine the subelements of the fault. while (tempEl != null) { String namespaceURI = tempEl.getNamespaceURI(); String localPart = tempEl.getLocalName(); if (localPart == null) { localPart = tempEl.getTagName(); } // SOAP-ENV namespace is ok, as is no namespace at all. if (namespaceURI == null || namespaceURI.equals(Constants.NS_URI_SOAP_ENV)) { if (localPart.equals(Constants.ELEM_FAULT_CODE)) { faultCodeEl = tempEl; } else if (localPart.equals(Constants.ELEM_FAULT_STRING)) { faultStringEl = tempEl; } else if (localPart.equals(Constants.ELEM_FAULT_ACTOR)) { faultActorEl = tempEl; } else if (localPart.equals(Constants.ELEM_DETAIL)) { detailEl = tempEl; } else { // This must be an additional fault entry. faultEntries.addElement(tempEl); } } else { // This must be an additional fault entry. faultEntries.addElement(tempEl); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } // Deserialize the required <faultcode> element. if (faultCodeEl != null) { String faultCode = DOMUtils.getChildCharacterData(faultCodeEl); fault.setFaultCode(faultCode); } else { throw new IllegalArgumentException("A '" + Constants.Q_ELEM_FAULT + "' element must contain a: '" + Constants.ELEM_FAULT_CODE + "' element."); } < end of sample > How are you swapping parsers? Since JAXP is used to instantiate the parser, just adjusting the classpath is insufficient to change parsers. You need to set the system property javax.xml.parsers.DocumentBuilderFactory. To see which parser you are actually using, do a System.out on the javax.xml.parsers.DocumentBuilderFactory object returned by the static newInstance() method. For us, weblogic.xml.jaxp.RegistryDocumentBuilderFactory is the problem. -----Original Message----- From: Richard Bolen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 22, 2002 11:41 AM To: [EMAIL PROTECTED] Subject: RE: SOAPException parsing Fault element? I've looked at the FAQ about this issue: http://xml.apache.org/soap/faq/faq_chawke.html#Q1_1 and I've tried many different versions of xml parsers including crimson that comes with jboss 2.4.4, xerces 1.4.3, and xerces 2.0.1. Tests using these all had the same faultcode problem. The FAQ calls this a bug in the parsers but I don't buy that. From a previous post by Jim Cross, this looks like a bug in SOAP. Is this fixed in RC 2.3? Does anyone know anything about this problem? It's strange because fault parsing was working on my system at one time. I didn't change the xml parser I was using so what could it be? Is there a workaround for this? i.e.: not setting a namespace in the call object? any help is greatly appreciated. Rich -----Original Message----- From: Richard Bolen Sent: Wednesday, May 22, 2002 10:21 To: SOAP Users Mailing List (E-mail) Subject: SOAPException parsing Fault element? I'm getting the following SOAPException from SOAP when it is parsing what appears to be a valid Fault element: SOAPException in soapMethodCall: A 'http://schemas.xmlsoap.org/soap/envelope/:Fault' element must contain a: 'faultcode' element. Here's the Fault response (captured from the TCPMonitor utility) which seems to contain a valid 'faultcode' element: HTTP/1.1 500 Internal Server Error Content-Type: text/xml; charset=utf-8 Content-Length: 4962 Date: Wed, 22 May 2002 14:01:46 GMT Server: Apache Tomcat/4.0.1 (HTTP/1.1 Connector) <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Server</faultcode> <faultstring>SE: SQLException executing SQL update "insert into users values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" in Utility.executeSqlQuery method: Invalid argument value: Duplicate entry 'newgapuser' for key 2</faultstring> <faultactor>/soap/servlet/rpcrouter</faultactor> <detail> <stackTrace>com.gmatc.netpalette.common.exceptions.ServerException: SE: SQLException executing SQL update "insert into users values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" in Utility.executeSqlQuery method: Invalid argument value: Duplicate entry 'newgapuser' for key 2 at com.gmatc.netpalette.server.utilities.Utility.executeSqlInsert(Utility.java: 287) at com.gmatc.netpalette.server.data.DataFactory.insert(DataFactory.java:46) at com.gmatc.netpalette.server.ejb.SpecifierSession.insert(SpecifierSession.jav a:175) at java.lang.reflect.Method.invoke(Native Method) at org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor.invoke(StatefulS essionContainer.java:664) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:12 7) at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSess ionInstanceInterceptor.java:242) at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:138) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT. java:347) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:100) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:170) at org.jboss.ejb.StatefulSessionContainer.invoke(StatefulSessionContainer.java: 339) at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerI nvoker.java:504) at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericPr oxy.java:335) at org.jboss.ejb.plugins.jrmp.interfaces.StatefulSessionProxy.invoke(StatefulSe ssionProxy.java:136) at $Proxy8.insert(Unknown Source) at java.lang.reflect.Method.invoke(Native Method) at org.apache.soap.providers.StatefulEJBProvider.invoke(StatefulEJBProvider.jav a:153) at org.apache.soap.server.http.RPCRouterServlet.doPost(RPCRouterServlet.java:28 7) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2 46) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :163) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java: 1011) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106 ) at java.lang.Thread.run(Thread.java:484) </stackTrace> </detail> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Does anyone know why it can't find the faultcode element? Thanks, Rich -------------------------------------------------------------------- Rich Bolen Senior Software Developer GretagMacbeth Advanced Technologies Center 79 T. W. Alexander Drive - Bldg. 4401 - Suite 250 PO Box 14026 Research Triangle Park, North Carolina 27709-4026 USA Phone: 919-549-7575 x239, Fax: 919-549-0421 http://www.gretagmacbeth.com/ --------------------------------------------------------------------
