Running CXF+WSS4J on Weblogic

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Running CXF+WSS4J on Weblogic

Dmitriev Vadim
Hi!

I'm trying to create WS-S enabled service based on CXF to run inside
WebLogic container. Currently I got stuck at overriding custom weblogic
classes related to XML processing. Sadly, this certified enterprise
bla-bla-bla server doesn't ship level 3 DOM and many other JVM XML
services required for WSS4J (and Apache Santuario underneath it) to run.

First, XMLInputFactory shipped with WL eventually created half-working
DOM that was failing when both WSS4JInInterceptor was installed and
schema-validation-enabled was set to "true" on the endpoint:
java.lang.AssertionError: UNIMPLEMENTED
     at weblogic.xml.domimpl.NodeImpl.getUserData(NodeImpl.java:488)
     at
org.apache.cxf.staxutils.W3CDOMStreamReader.getLocation(W3CDOMStreamReader.java:408)
     at
org.apache.cxf.staxutils.DepthXMLStreamReader.getLocation(DepthXMLStreamReader.java:110)
     ...

Ok, got around it by specifying javax.xml.stream.XMLInputFactory on the
endpoint:
<entry key="javax.xml.stream.XMLInputFactory">
<bean class="com.ctc.wstx.stax.WstxInputFactory"/>
</entry>

Figure two: now I'm getting
java.lang.AssertionError: UNIMPLEMENTED
     at
weblogic.xml.domimpl.ElementBase.setIdAttributeNode(ElementBase.java:333)
     at
org.apache.jcp.xml.dsig.internal.dom.DOMKeyInfo.<init>(DOMKeyInfo.java:94)
     at
org.apache.jcp.xml.dsig.internal.dom.DOMXMLSignature.<init>(DOMXMLSignature.java:150)
...

There is a workaround for this problem too by setting system property
"org.apache.cxf.binding.soap.messageFactoryClassName" to JVM's own
MessageFactory. Though it works, this solution has downsides:
1. it is set for the whole JVM, not CXF instance. It can have
unpredictable effects on the other CXF apps installed on the same app
server;
2. this property is not per SOAP version. So if I set it to SOAP 1.1
MessageFactory, SOAP 1.2 may stop working.

I wanted to fix these issues before going production. My initial attempt
was to define impl classes for both SOAP 1.1 and 1.2 message factories
in SoapMessage contextual properties and cache instantiated objects in
o.a.c.binding.soap.saaj.SAAJFactoryResolver. Now that I described source
of the problems, is my approach proper from architectural POV? Is it
worth filing an enhancement ticket for this?

Thanks!

P.S. They do really love "AssertionError("UNIMPLEMENTED")" there at
BEA/Oracle.
P.P.S. Sorry for all there emotions, but I'm very very tired of this app
server.