Hi,

I mentioned this previously but I'll just substantiate this and make
available my solution. The SOAP 1.2 standard says:


5.4.2.1 SOAP Text Element

The Text *element information item* is intended to carry the text of a human
readable explanation of the fault.

The Text *element information item* has:

  -

  A [local name] of Text .
  -

  A [namespace name] of http://www.w3.org/2003/05/soap-envelope .
  -

  A *mandatory* *attribute information item* with a [local name] of
langand [namespace name] of "
  http://www.w3.org/XML/1998/namespace";. Note that the definition in of
  the lang *attribute information item* requires that the [prefix] is
  "xml" or any capitalization thereof (see XML 1.0 [XML
1.0]<http://www.w3.org/TR/soap12-part1/#XML>,
  Language Identification<http://www.w3.org/TR/REC-xml.html#sec-lang-tag>
  ).
  -

  ...


My XFire WS sends back a SOAP 1.2 fault message to a .NET client that
correctly rejects the message as not conforming to the SOAP standard because
the Text element is missing the mandatory xml:lang attribute.

I hacked a change to the file
org.codehaus.xfire.fault.Soap12FaultSerializerin the xfire-core
directory as follows:

           writer.writeStartElement("soap:Reason");
           writer.writeStartElement("soap:Text");
           if (fault.getReason() != null)
               writer.writeCharacters(fault.getReason());
           writer.writeEndElement(); // Text
           writer.writeEndElement(); // Reason

becomes

           writer.writeStartElement("soap:Reason");
           writer.writeStartElement("soap:Text");

           writer.writeAttribute("xml:lang", "en");

           if (fault.getReason() != null)
               writer.writeCharacters(fault.getReason());
           writer.writeEndElement(); // Text
           writer.writeEndElement(); // Reason


This is clearly a hack as it hard codes "en" (English) as the text language,
but this satisfies the requirements for my project and doesn't clash too
much with the current XFire implementation that has hard coded error
messages in English ;-)

This has solved my interoperability problem with my .NET client.

Phil B.

Reply via email to