Hi Dan
Hi Sergey

Thank you very much for your help. I applied Dan's suggestion to add 
"META-INF/cxf/cxf-extension-policy.xml" and it works great now.
By the way, I am using CXF 2.2.7.

Best regards
Daniel Putra

----- Original Message ----- 
From: "Daniel Kulp" <[email protected]>
To: <[email protected]>
Cc: "Daniel Putra" <[email protected]>
Sent: Friday, April 23, 2010 8:28 PM
Subject: Re: CFX PolicyEngine Exception


| On Friday 23 April 2010 7:28:28 am Daniel Putra wrote:
| > Hi
| >
| > I have multiple third party web services (I connect to a third party web
| > service) and a server RESTfull web service (web service clients connect 
to
| > me) in a Spring application.
| >
| > One third party web service is only working if a policy engine is 
specified
| > like
| >
| >    <bean id="org.apache.cxf.ws.policy.PolicyEngine"
| > class="org.apache.cxf.ws.policy.PolicyEngineImpl"> <property name="bus"
| > ref="cxf"/>
| >       <property name="enabled" value="true"/>
| >    </bean>
|
| Note:  just importing   META-INF/cxf/cxf-extension-policy.xml  should
| accomplish the same thing.
|
|
| Dan
|
|
|
| >
| > as it otherwise throws the following exception:
| >
| > java.lang.NullPointerException
| >  at
| > 
org.apache.cxf.ws.policy.WSPolicyFeature.initialize(WSPolicyFeature.java:1
| > 00) at
| > 
org.apache.cxf.ws.policy.WSPolicyFeature.initializeEndpointPolicy(WSPolicy
| > Feature.java:139) at
| > 
org.apache.cxf.ws.policy.WSPolicyFeature.initialize(WSPolicyFeature.java:1
| > 12) at
| > 
org.apache.cxf.frontend.ClientFactoryBean.applyFeatures(ClientFactoryBean.
| > java:71) at
| > 
org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:60
| > ) at
| > 
org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBe
| > an.java:102) at
| > 
org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.ja
| > va:115)
| >
| >
| > But as soon as I add the PolicyEngine bean into the xml my RESTful web
| > service does not work any longer. It throws the following null pointer
| > exception:
| >
| > 2010-04-23 13:08:40,758 WARN 
[org.apache.cxf.phase.PhaseInterceptorChain] -
| > Interceptor for {http://party.misc.profidaweb/}PartyServiceRest has 
thrown
| > exception, unwinding now java.lang.NullPointerException
| >  at
| > 
org.apache.cxf.ws.policy.PolicyInInterceptor.handle(PolicyInInterceptor.ja
| > va:132) at
| > 
org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage(AbstractP
| > olicyInterceptor.java:45) at
| > 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorCha
| > in.java:243) at
| > 
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiation
| > Observer.java:110) at
| > 
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestinat
| > ion.java:98) at
| > 
org.apache.cxf.transport.servlet.ServletController.invokeDestination(Servl
| > etController.java:423) at
| > 
org.apache.cxf.transport.servlet.ServletController.invoke(ServletControlle
| > r.java:139) at
| > 
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServ
| > let.java:142) at
| > 
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(Abstrac
| > tHTTPServlet.java:179) at
| > 
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPSer
| > vlet.java:108) at
| > javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
| >
| >
| > I attach my configuration file for the RESTfull web service. The client 
web
| > services are defined in java like:
| >
| >             Map<String, Object> outProps = new HashMap<String, 
Object>();
| >             outProps.put(WSHandlerConstants.ACTION,
| > WSHandlerConstants.TIMESTAMP + " " + WSHandlerConstants.USERNAME_TOKEN);
| > outProps.put(WSHandlerConstants.USER, userPerson.fseLoginType() + "\\" +
| > userPerson.getFSELoginName());
| > outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
| > outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,
| > PasswordCallbackHandler.class.getName()); WSS4JOutInterceptor wss4jOut =
| > new WSS4JOutInterceptor(outProps);
| >
| >             JaxWsProxyFactoryBean wsFactory = new 
JaxWsProxyFactoryBean();
| >             wsFactory.getOutInterceptors().add(wss4jOut);
| >             wsFactory.setServiceClass(FseWebService_DEF.class);
| >             wsFactory.setAddress(url);
| >             wsFactory.getFeatures().add(new WSPolicyFeature());
| >
| >             FseWebService_DEF fseWebService =
| > (FseWebService_DEF)wsFactory.create();
| >
| >
| > Please help, how can I either change the client or the RESTfull web 
service
| > declaration to avoid the null pointer exception and have both working 
next
| > to each other?
| >
| > Best regards
| > Daniel Putra
|
| -- 
| Daniel Kulp
| [email protected]
| http://dankulp.com/blog 

Reply via email to