Hi All,
I'm having a problem configuring WSS4J with my project.
I have a standalone class A which sends a soap message to service B. The
message going from A to B is correctly altered by the WSDoAllSender handler
and it has all the WS-Sec headers.
Now I want B to recieve this securitized message, desecuritize it, do some
stuff, then send a new message to service C, and then wait for a response
from C, whereupon B sends a message back to the standalone class A.
A -> B -> C
|
A<-B <-
SO far, i have a WSDoAllReceiver on B which desecuritizes the incoming
message correctly. But what it is failing to do is to securitize the
outgoing message that B sends to C. What do I need to do to achieve this? Is
there any way to restrict (in the handler parameters) which message types to
securitize?
My wsdd looks like:
<service name="B" provider="java:MSG">
<parameter name="allowedMethods"
value="receiveIncomingMessage"/>
<parameter name="className"
value="SoapShibboleth.server.ValidationRequestSoapListener"/>
<requestFlow>
<handler
type="java:org.apache.ws.axis.security.WSDoAllReceiver">
<parameter name="passwordCallbackClass"
value="org.apache.ws.axis.oasis.PWCallback"/>
<parameter name="action"
value="UsernameToken"/>
</handler>
<handler type="soapmonitor"/>
</requestFlow>
<responseFlow>
<handler type="soapmonitor"/>
</responseFlow>
</service>
I have tried putting a WSDoAllSender in the requestFlow like this:
<service name="B" provider="java:MSG">
<parameter name="allowedMethods"
value="receiveIncomingMessage"/>
<parameter name="className"
value="SoapShibboleth.server.ValidationRequestSoapListener"/>
<requestFlow>
<handler
type="java:org.apache.ws.axis.security.WSDoAllReceiver">
<parameter name="passwordCallbackClass"
value="org.apache.ws.axis.oasis.PWCallback"/>
<parameter name="action"
value="UsernameToken"/>
</handler>
<handler
type="java:org.apache.ws.axis.security.WSDoAllSender">
<parameter name="action"
value="UsernameToken"/>
<parameter name="user"
value="16c73ab6-b892-458f-abf5-2f875f74882e"/>
<parameter name="passwordCallbackClass"
value="org.apache.ws.axis.oasis.PWCallback"/>
<parameter name="passwordType"
value="PasswordDigest"/>
</handler>
<handler type="soapmonitor"/>
</requestFlow>
<responseFlow>
<handler type="soapmonitor"/>
</responseFlow>
</service>
Is this the right thing to do?
I get the error below when I do the above. I have looked on the net about
this error and the xalan problem I have heard is about the xalan.jar being
endorsed. I have tried putting it in java_home/jre/lib/endorsed and even it
tomcat/common/endorsed and nothing seems to solve it. I have tried different
versions (and even the version that comes with WSS4J) but it doesn't seem to
make a difference.
Thank you so much for your time.
Shahzad
ERROR
=====
- Unable to patch xalan function table.
java.lang.NoSuchFieldException: m_functions
at java.lang.Class.getField(Unknown Source)
at org.apache.xml.security.Init.registerHereFunction(Unknown Source)
at org.apache.xml.security.Init.init(Unknown Source)
at
org.apache.ws.security.WSSecurityEngine.<clinit>(WSSecurityEngine.java:132)
at
org.apache.ws.axis.security.WSDoAllSender.<clinit>(WSDoAllSender.java:69)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160)
at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:100)
at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getJavaClass(WSDDDeployab
leItem.java:353)
at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.makeNewInstance(WSDDDeplo
yableItem.java:295)
at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeploy
ableItem.java:274)
at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployabl
eItem.java:260)
at
org.apache.axis.deployment.wsdd.WSDDChain.makeNewInstance(WSDDChain.java:125
)
at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeploy
ableItem.java:274)
at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployabl
eItem.java:260)
at
org.apache.axis.deployment.wsdd.WSDDDeployment.getGlobalRequest(WSDDDeployme
nt.java:507)
at
org.apache.axis.configuration.FileProvider.getGlobalRequest(FileProvider.jav
a:269)
at org.apache.axis.AxisEngine.getGlobalRequest(AxisEngine.java:365)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:126)
at org.apache.axis.client.Call.invokeEngine(Call.java:2754)
at org.apache.axis.client.Call.invoke(Call.java:2737)
at org.apache.axis.client.Call.invoke(Call.java:1891)
at
SoapShibboleth.common.ConnectionManager.sendMessage(ConnectionManager.java:5
9)
at
SoapShibboleth.client.SoapShibbolethConnection.sendRequest(SoapShibbolethCon
nection.java:117)
at
SoapShibboleth.client.SoapShibbolethConnection.makeValidationRequest(SoapShi
bbolethConnection.java:81)
at SoapShibboleth.TestApplicaton.main(TestApplicaton.java:34)
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand
faultSubcode:
faultString: Did not understand "MustUnderstand" header(s):
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:dellpc
Did not understand "MustUnderstand" header(s):
at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:2
21)
at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:12
8)
at
org.apache.axis.encoding.DeserializationContext.endElement(DeserializationCo
ntext.java:1087)
at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)
at org.apache.crimson.parser.Parser2.content(Unknown Source)