I have opened a jira around this issue - 4774. My solution is not to try and fix the neethi issue, but instead to work around it. I am planning to cache the Policy Element in the PolicyAttachment class which simplifies the code in org.apache.cxf.ws.policy.ServiceModelPolicyUpdater anyway and avoids reserialising the Policy file for the WSDL.
I am still looking to see if its possible to more tightly integrate the external attachments stuff in so that the service model gets the ws policy stuff included as part of loading the external attachments. So unless anyone has an issue with caching the Element object in PolicyAttachment I don't have to worry about trying to fix ExactlyOne or All classes in Neethi, which seeing as its been over a year since a release of neethi (at least so far as maven repo is concerned) thats a good thing :-) On Wed, Jan 23, 2013 at 6:15 PM, Jason Pell <[email protected]> wrote: > Hi, > > I have an issue with latest CXF when serialising a Policy. The > <ExactlyOne> and <All> tags do not include the prefix. I believe this > is causing my jaxws:client to fail when pointing at the WSDL. > > This only happens when using policy attachments > > <wsp:Policy > xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" > xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" > wsu:Id="UsernameToken"><ExactlyOne><All><sp:SupportingTokens > xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"><wsp:Policy > xmlns:wsp="http://www.w3.org/ns/ws-policy"><sp:UsernameToken > xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" > sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Always"><wsp:Policy><sp:WssUsernameToken10/></wsp:Policy></sp:UsernameToken></wsp:Policy></sp:SupportingTokens></All></ExactlyOne></wsp:Policy> > > > The code in cxf is using W3CDOMStreamWriter and in the ExactlyOne and > All classes calling the > > writer.writeStartElement(namespace,Constants.ELEM_EXACTLYONE); > > But it does this when the prefix is NOT null. This seems wrong to me. > > The classes involved are: > > org.apache.neethi.ExactlyOne > org.apache.neethi.All > > I think these classes should actually be calling: > > writer.writeStartElement(prefix, Constants.ELEM_EXACTLYONE, namespace); > > Basically same as PolicyReference > > Can someone with familiarity with Neethi help me here please. > > I have downloaded the neethi trunk and am going to make the changes in > my local and see if it fixes my own problem, but I was hoping for some > additional assistance with the problem.
