Thanks Andrei! That helps a lot... I'll try your suggestion and let you
know how it goes.

Any insight as to why I can't get end point references to work? Is there a
trick to configuring it? I followed the example on the samples but can't
seem to get it to work with my wsdl. Does the end point need to match what
is in the wsdl or what cxf generates the address to be when it starts? Any
documentation surrounding this?

Thanks much!
On Jul 2, 2014 3:19 AM, "Andrei Shakirin" <[email protected]> wrote:

> Hi,
>
> If you use CXF >= 3.0.0, 2.7.12,
> you should register
> org.apache.cxf.ws.policy.attachment.external.URIDomainExpressionBuilder as
> bus extension.
> It supports all policy attachment URL syntaxes (except extension).
>
> By default CXF registers the
> org.apache.cxf.ws.policy.attachment.external.EndpointReferenceDomainExpressionBuilder
> supporting only wsa:EndpointReference.
>
> See https://issues.apache.org/jira/browse/CXF-5685 for details.
>
> Either add following string into META-INF/cxf/bus-extensions.txt:
>
> org.apache.cxf.ws.policy.attachment.external.URIDomainExpressionBuilder::true
> or add bean in Spring/Blueprint context with URIDomainExpressionBuilder
> type.
>
> System test registering URIDomainExpressionBuilder:
> https://git-wip-us.apache.org/repos/asf?p=cxf.git;a=blob;f=systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyExternalAttachmentWsdl11Test.java;h=d44ee8decf628a57edbf402bc6d8ff0c0042b649;hb=HEAD
> .
>
> If you use CXF version < 3.0.0, 2.7.12, just copy the classes
> URIDomainExpressionBuilder.java, URIDomainExpression.java and register
> URIDomainExpressionBuilder as bus extension.
>
> Let me know if it works as expected.
>
> Regards,
> Andrei.
>
> > -----Original Message-----
> > From: Lambert, Michael [mailto:[email protected]]
> > Sent: Mittwoch, 2. Juli 2014 08:13
> > To: [email protected]
> > Subject: policy attachment
> >
> > 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(GreeterSer
> > vice/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/AlwaysTo
> > Recipient
> > ">
> > <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