Hi again,

I have temporarily solved the problem (by double creating dom). 
In the invoke method of DOMOutHandler I have inserted the following code:

...
Document doc = writer.getDocument();
// make a string from Doc via Xalan
String docAsString = xmlToString(doc);

if (log.isDebugEnabled()) {
   log.debug("docAsString: " + docAsString);
}
Source source = new StreamSource(new StringReader(docAsString));
doc = this.builder.parse(org.apache.ws.security.util.XMLUtils
                                .sourceToInputSource(source));
message.setProperty(DOM_MESSAGE, doc);


In the constructor I set:

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
builder = dbf.newDocumentBuilder();

Now wss4j works. I think that there seems to be a problem in writeMessage.
Please could you check this. The above solution is not really a performance 
boost ;-)

Regards,
christoph

-------- Original-Nachricht --------
Datum: Tue, 24 Oct 2006 15:08:32 +0200
Von: [EMAIL PROTECTED]
An: [email protected]
Betreff: [xfire-user] NPE in wss4j out handler

> Hi,
> 
> I want to use outgoing encryption using Signature Cert of previous Client
> request (useReqSigCert).
> I got a NullPointerException at
> org.apache.ws.security.util.WSSecurityUtil.findElement(WSSecurityUtil.java:199)
>  using latest XFire distribution. In
> WSSecurityUtil the following call is made:
> startNode.getLocalName().equals(name). I assume, that getLocalName returns 
> null after stepping into the soap
> body of my response document.
> 
> I have Xerces in endorsed path and runtime inspection showed, that
> "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl" is used indeed.
> 
> After some time of code debugging, I think that problem is located in DOM
> building (using DOMOutHandler). If I use DocumentBuilderFactory in a local
> test class (without W3CDOMStreamWriter) with String as XML Document as
> source, I can reproduce this behaviour, if I do not call
> setNamespaceAware(true). By the way, the NPE is thrown, if the WSSecurityUtil 
> comes to an Element
> which is qualified by a Defaultnamespace (<elementName
> xmlns="http://...";>).
> 
> I try to track the problem further down.
> Do you have any fast idea, what could be the reason (maybe problem with
> evaluation of default namespaces in DOMOutHandler?)
> 
> Regards,
> Christoph
> -- 
> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
> Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
> 
>     http://xircles.codehaus.org/manage_email

-- 
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to