You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by "Colic, Nedim" <Ne...@mediaocean.com> on 2002/06/13 17:20:18 UTC
Fix for "Element must contain a:'faultcode' element" problem
I've seen numerous posts about this on the list. The FAQ at http://xml.apache.org/soap/faq/faq_chawke.html#Q1_1 says that it's Xerces problem, but after I tried many different parsers/versions none of them seem to help. So I traced the problem and yes, it has nothing to do with the parser I was using!
To fix the problem in version 2.3.1 open org.apache.soap.Fault.java, go to line 316 and add these lines:
if( null != namespaceURI && namespaceURI.length() == 0 ) {
namespaceURI = null;
}
They go right before the line
if (namespaceURI == null || namespaceURI.equals(Constants.NS_URI_SOAP_ENV)) {
which is the problem as it checks namespaceURI for null, but not for empty string.
After this I tried different versions of Xerces, Crimson and Weblogic's parser and they all worked fine.
Nedim Colic
Software Architect
MediaOcean
p: 404-879-2537
f: 404-885-9949
RE: Fix for "Element must contain a:'faultcode' element" problem
Posted by "Matthew J. Duftler" <du...@watson.ibm.com>.
Hi Nedim,
Node.getNamespaceURI() is not supposed to return an empty string. It is
supposed to return a namespace URI, or null if none was specified. This
behavior is described by both the actual DOM Level 2 Core specification
(http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-195064
1247) and the JavaDocs for the various DOM implementations.
If Node.getNamespaceURI() is returning an empty string on your system, than
the Element is not being created correctly. This can be due to a bug in your
parser, or (if you are creating the DOM structures yourself) a bug in your
code.
Most likely, you did not correctly change the parser you are using. Remember
that Apache SOAP uses the JAXP APIs to retrieve parser instances, so there
are several different ways that a parser can be specified.
Thanks,
-Matt
> -----Original Message-----
> From: Colic, Nedim [mailto:Nedim@mediaocean.com]
> Sent: Thursday, June 13, 2002 11:20 AM
> To: soap-user@xml.apache.org
> Cc: duftler@us.ibm.com; sanjiva@watson.ibm.com; edashofy@ics.uci.edu;
> kevin.mitchell@xmls.com
> Subject: Fix for "Element must contain a:'faultcode' element" problem
>
>
> I've seen numerous posts about this on the list. The FAQ at
> http://xml.apache.org/soap/faq/faq_chawke.html#Q1_1 says that
> it's Xerces problem, but after I tried many different
> parsers/versions none of them seem to help. So I traced the
> problem and yes, it has nothing to do with the parser I was using!
>
> To fix the problem in version 2.3.1 open
> org.apache.soap.Fault.java, go to line 316 and add these lines:
>
> if( null != namespaceURI && namespaceURI.length() == 0 ) {
> namespaceURI = null;
> }
>
> They go right before the line
> if (namespaceURI == null ||
> namespaceURI.equals(Constants.NS_URI_SOAP_ENV)) {
> which is the problem as it checks namespaceURI for null, but not
> for empty string.
>
> After this I tried different versions of Xerces, Crimson and
> Weblogic's parser and they all worked fine.
>
>
> Nedim Colic
> Software Architect
> MediaOcean
> p: 404-879-2537
> f: 404-885-9949
>
RE: Fix for "Element must contain a:'faultcode' element" problem
Posted by "Matthew J. Duftler" <du...@watson.ibm.com>.
Hi Nedim,
Node.getNamespaceURI() is not supposed to return an empty string. It is
supposed to return a namespace URI, or null if none was specified. This
behavior is described by both the actual DOM Level 2 Core specification
(http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-195064
1247) and the JavaDocs for the various DOM implementations.
If Node.getNamespaceURI() is returning an empty string on your system, than
the Element is not being created correctly. This can be due to a bug in your
parser, or (if you are creating the DOM structures yourself) a bug in your
code.
Most likely, you did not correctly change the parser you are using. Remember
that Apache SOAP uses the JAXP APIs to retrieve parser instances, so there
are several different ways that a parser can be specified.
Thanks,
-Matt
> -----Original Message-----
> From: Colic, Nedim [mailto:Nedim@mediaocean.com]
> Sent: Thursday, June 13, 2002 11:20 AM
> To: soap-user@xml.apache.org
> Cc: duftler@us.ibm.com; sanjiva@watson.ibm.com; edashofy@ics.uci.edu;
> kevin.mitchell@xmls.com
> Subject: Fix for "Element must contain a:'faultcode' element" problem
>
>
> I've seen numerous posts about this on the list. The FAQ at
> http://xml.apache.org/soap/faq/faq_chawke.html#Q1_1 says that
> it's Xerces problem, but after I tried many different
> parsers/versions none of them seem to help. So I traced the
> problem and yes, it has nothing to do with the parser I was using!
>
> To fix the problem in version 2.3.1 open
> org.apache.soap.Fault.java, go to line 316 and add these lines:
>
> if( null != namespaceURI && namespaceURI.length() == 0 ) {
> namespaceURI = null;
> }
>
> They go right before the line
> if (namespaceURI == null ||
> namespaceURI.equals(Constants.NS_URI_SOAP_ENV)) {
> which is the problem as it checks namespaceURI for null, but not
> for empty string.
>
> After this I tried different versions of Xerces, Crimson and
> Weblogic's parser and they all worked fine.
>
>
> Nedim Colic
> Software Architect
> MediaOcean
> p: 404-879-2537
> f: 404-885-9949
>