You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Decker <pd...@gmail.com> on 2017/04/17 18:39:30 UTC
policy Reference URIs
Hi all,
I'm fairly new to CXF (started in the last couple months), and I've been
integrating it into a Spring Boot & Integration project (client) with some
success.
The thing is, I've been stuck on a couple issues for the last few days,
and after trial-and-error and stepping through apache-cxf-rt code, I
thought I'd finally admit I have a problem, and come and ask for help:
There's a wsdl for a service I have to integrate with, that has an external
file policyReference in a soap12:operation block. It allegedly works in a
legacy axis application without modification:
It is, literally:
<wsp:Policy>
<wsp:PolicyReference URI="policy:OurPolicy.xml#messageInput" />
</wsp:Policy>
How do you get this to resolve? Here's what I tried:
When I copy the contents of "OurPolicy.xml" into the wsdl itself, and get
rid of the bit before the '#', cxf resolves it properly and all is right
with the world. But I have several dozen wsdls like this, so hand editing
each one this way would be... undesirable.
I've become very familiar with the error "RuntimeException
policy:OurPolicy.xml#messageInput cannot be resoved":
I tried copying the file into the classpath in several different locations
to no avail.
I tried adding a <jaxws:features> to the <jaxws:client> like:
<jaxws:features>
<p:policies>
<externalAttachment location="policy.OurPolicy.xml"
</p:policies>
</jaxws:features>
which didn't work, and I tried "classpath" in place of the "policy:"
scheme, without success. Also thought maybe I could load it from a
location and give it the policy name, but that didn't work either. Google
was unhelpful, and the sample code in apache-cxf ws_security uses a policy
which is in the wsdl itself, (the version of the world I got to work
earlier).
I debugged down into the EffectivePolicyImpl class to see if I could find
what the policy was being named, but after tracing this around for another
hour I figured I'd break down and ask...
I'm assuming I need to do _something_ to make the Bus aware of this policy,
in such a way that the wsdls will resolve it, but I could certainly use any
help or suggestions you have.
Thanks in advance,
Decker
RE: policy Reference URIs
Posted by Andrei Shakirin <as...@talend.com>.
Hi,
I think policy attachments should help in your case: https://www.w3.org/TR/ws-policy-attach/
Take a look in CXF test: https://github.com/apache/cxf/blob/master/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyExternalAttachmentWsdl11Test.java
Regards,
Andrei.
> -----Original Message-----
> From: pdecker999@gmail.com [mailto:pdecker999@gmail.com] On Behalf Of
> Decker
> Sent: Montag, 17. April 2017 20:40
> To: users@cxf.apache.org
> Subject: policy Reference URIs
>
> Hi all,
>
> I'm fairly new to CXF (started in the last couple months), and I've been
> integrating it into a Spring Boot & Integration project (client) with some
> success.
>
> The thing is, I've been stuck on a couple issues for the last few days, and after
> trial-and-error and stepping through apache-cxf-rt code, I thought I'd finally
> admit I have a problem, and come and ask for help:
>
> There's a wsdl for a service I have to integrate with, that has an external file
> policyReference in a soap12:operation block. It allegedly works in a legacy axis
> application without modification:
>
> It is, literally:
> <wsp:Policy>
> <wsp:PolicyReference URI="policy:OurPolicy.xml#messageInput" />
> </wsp:Policy>
>
> How do you get this to resolve? Here's what I tried:
> When I copy the contents of "OurPolicy.xml" into the wsdl itself, and get rid of
> the bit before the '#', cxf resolves it properly and all is right with the world. But
> I have several dozen wsdls like this, so hand editing each one this way would
> be... undesirable.
>
> I've become very familiar with the error "RuntimeException
> policy:OurPolicy.xml#messageInput cannot be resoved":
>
> I tried copying the file into the classpath in several different locations to no
> avail.
> I tried adding a <jaxws:features> to the <jaxws:client> like:
> <jaxws:features>
> <p:policies>
> <externalAttachment location="policy.OurPolicy.xml"
> </p:policies>
> </jaxws:features>
> which didn't work, and I tried "classpath" in place of the "policy:"
> scheme, without success. Also thought maybe I could load it from a location
> and give it the policy name, but that didn't work either. Google was unhelpful,
> and the sample code in apache-cxf ws_security uses a policy which is in the
> wsdl itself, (the version of the world I got to work earlier).
> I debugged down into the EffectivePolicyImpl class to see if I could find what
> the policy was being named, but after tracing this around for another hour I
> figured I'd break down and ask...
>
> I'm assuming I need to do _something_ to make the Bus aware of this policy, in
> such a way that the wsdls will resolve it, but I could certainly use any help or
> suggestions you have.
>
> Thanks in advance,
> Decker