I feel awful for asking so many questions but googling hasnt been helpful.

I am attempting to attach an external security policy to an endpoint with
no success. When I attempt to use a wsp:UI in the AppliesTo element cxf
blows up. Here is the contents of the file:

----
<?xml version="1.0" encoding="UTF-8" ?>
<attachments
xmlns:wsp="http://www.w3.org/ns/ws-policy";
xmlns:wsa="http://www.w3.org/2005/08/addressing";
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>
<wsp:PolicyAttachment>
<wsp:AppliesTo>
<wsp:URI>
http://cxf.apache.org/testutils/wsdl/greeter_control.wsdl#wsdl.port(GreeterService/GreeterPort)
</wsp:URI>
</wsp:AppliesTo>
<wsp:Policy>
<wsp:ExactlyOne>
<wsp:All>
<wsp:Policy>
<sp:UsernameToken sp:IncludeToken="
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient
">
<wsp:Policy>
<sp:WssUsernameToken10 />
</wsp:Policy>
</sp:UsernameToken>
</wsp:Policy>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
</wsp:PolicyAttachment>
</attachments>

----
And here is the error:
----
Caused by: javax.xml.ws.WebServiceException:
org.apache.cxf.ws.policy.PolicyException: NO_DOMAINEXPRESSIONBUILDER_EXC
----
It appears that the wsp:URI element passed
into DomainExpressionBuilderRegistry.build(Element element) has null
contents for a reason that I cannot figure out. I have tried different
syntaxes and URLs to try to get it to work and its always null.

Putting an EndpointReference in the AppliesTo element doesnt error:

<wsa:EndpointReference><wsa:Address>http://localhost:8080/user-service/userService</wsa:Address>
                </wsa:EndpointReference>

But it doesnt work either. It never seems to intercept calls to the
service hosted at the configured URL. The ONLY way I have able to get
it to work is by embedding the policy in the wsdl. I dont want to do
that however as I want a mediator to handle the policy and would like
the contract policies to configured differently in different
environments.


Any help would be appreciated. I am tearing my hair out over this. I cant
be the only one attempting to do this.

The code is on github:

https://github.com/MacFlecknoe/service-repository-sample/blob/master/schema/src/main/resources/policy/authentication-policy.xml

Thanks.

Mike

Reply via email to