xml-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Yves MENGANT" <jymeng...@ifrance.com>
Subject client side Fault unmarshalling : a tiny problem in V2.2
Date Fri, 05 Oct 2001 13:46:22 GMT
Hi ,

Not sure if this problem has already been reported , I did not see
it looking through the mail list archive ,

Using the soap 2.2

how to reproduce it :

  use xerces 1.3.1 as xml parser.
  use the sample TestProvider class.
  unregister the "hello" service if registered.
  ( in order to generate a server side SOAP fault )

  after the call you should expect to get back :

Ouch, the call failed:
Fault Code   = SOAP-ENV:Server
Fault String = service 'urn:testprovider' unknown

  you'll get this instead :

Hit uncaught exception org.apache.soap.SOAPException
[SOAPException: faultCode=SOAP-ENV:Client;
msg=A 'http://schemas.xmlsoap.org/soap/envelope/:Fault' element must contain
a: 'faultcode' element.; targetException=java.lang.IllegalArgumentException:
A 'http://schemas.xmlsoap.org/soap/envelope/:Fault' element must contain a:
'faultcode' element.] 	at org.apache.soap.rpc.Call.invoke(Call.java:246) 	at
sampleprovider.testprovider.main(TestProvider.java:31) Exception in thread
"main"

  The origin of the above problem seems to be in the
  Fault.java source when unmarshaling the exception fauly inside
  the unmarshall method :

  ******* ORIGINAL CODE
      // 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 )                  <---------------- OOPS
!!!!!!
            ||  namespaceURI.equals(Constants.NS_URI_SOAP_ENV)
            )
        {          if (localPart.equals(Constants.ELEM_FAULT_CODE))
          {
            faultCodeEl = tempEl;
          }

   ******

   Explanations : using xerces 1.3.1 xml parser , the nameSpaceUri is an
   empty non null variable, and the unmarshaller get confused with an empty
   String instead of a null there :

   the following lines fixes the problem for me :

         // SOAP-ENV namespace is ok, as is no namespace at all.
        if (( namespaceURI == null )
            || ( namespaceUri.length() == 0 )
            ||  namespaceURI.equals(Constants.NS_URI_SOAP_ENV)
            )
        {

    perhaps this problem is already fixed using recents nighty builds...
    but I need to use a 'stable' build to debug some SOAP server production
protocols


   Jean-Yves

 
______________________________________________________________________________
ifrance.com, l'email gratuit le plus complet de l'Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
http://www.ifrance.com/_reloc/email.emailif



Mime
View raw message