Hi,
I developed a WSDL first webservice with policies at Binding & Port type
operations Input & Output. Every thing worked fine as expected. I then
refactored the service to Java First. I created 3 policy XML files
1. Service Level
2. Input Policy
3. Output Policy.
I added the Policy annotations to the Service and the input and output
policies to the method of the WS interface with the above mentioned xmls.
When I access the WSDL, I get the following error:
Caused by: java.lang.IllegalArgumentException: local part cannot be "null"
when creating a QName
at javax.xml.namespace.QName.<init>(QName.java:246)
at javax.xml.namespace.QName.<init>(QName.java:190)
at
org.apache.neethi.builders.converters.AbstractDOMConverter.getAttributes(AbstractDOMConverter.java:51)
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor229.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.neethi.builders.converters.ConverterRegistry.getAttributes(ConverterRegistry.java:114)
at
org.apache.neethi.PolicyBuilder.getPolicyReference(PolicyBuilder.java:163)
at
org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getElementPolicy(Wsdl11AttachmentPolicyProvider.java:214)
at
org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getEffectivePolicy(Wsdl11AttachmentPolicyProvider.java:140)
at
org.apache.cxf.ws.policy.PolicyEngineImpl.getAggregatedMessagePolicy(PolicyEngineImpl.java:427)
at
org.apache.cxf.ws.policy.EffectivePolicyImpl.initialisePolicy(EffectivePolicyImpl.java:133)
at
org.apache.cxf.ws.policy.EffectivePolicyImpl.initialise(EffectivePolicyImpl.java:95)
at
org.apache.cxf.ws.policy.PolicyEngineImpl.getEffectiveServerRequestPolicy(PolicyEngineImpl.java:301)
at
org.apache.cxf.ws.policy.EndpointPolicyImpl.initializeInterceptors(EndpointPolicyImpl.java:296)
at
org.apache.cxf.ws.policy.EndpointPolicyImpl.getInterceptors(EndpointPolicyImpl.java:126)
at
org.apache.cxf.ws.policy.PolicyInInterceptor.handle(PolicyInInterceptor.java:136)
at
org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage(AbstractPolicyInterceptor.java:45)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:205)
at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:112)
Debugging the AbstractDOMConverter I found that the problem is with the
URI="#MyInputPolicy" (which is the WSU:ID in my input policy).
I remove the policy annotations from the method, keeping the policy at the
service, it works fine. Am I doing something wrong here? Please find the
code below.
@WebService
@Policies({
@Policy(uri = "MyPolicy.xml",placement=Placement.BINDING)
})
public interface UserManagementService {
@WebMethod
@WebResult( name = "user" )
@Policies({
@Policy(uri =
"MyInputPolicy.xml",placement=Placement.PORT_TYPE_OPERATION_INPUT),
@Policy(uri =
"MyOutputPolicy.xml",placement=Placement.PORT_TYPE_OPERATION_OUTPUT)
})
User findByLoginName(@WebParam( name = "loginName" ) String loginName) ;
}
The input and output policies are identical, here is the Input Policy
<wsp:Policy wsu:Id="MyInputPolicy"
xmlns:wsp="http://www.w3.org/ns/ws-policy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
xmlns:tns="http://webservice.user.admin.cs.sungard.com/">
<wsp:ExactlyOne>
<wsp:All>
<sp:EncryptedParts>
<sp:Body />
</sp:EncryptedParts>
<sp:SignedParts>
<sp:Body />
</sp:SignedParts>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
Thanks,
Rahul.
--
View this message in context:
http://cxf.547215.n5.nabble.com/Policy-annontations-on-opertaions-in-CXF-2-4-1-tp4581863p4581863.html
Sent from the cxf-user mailing list archive at Nabble.com.