There pretty much isn't a way to allow nulls for parameters with rpc/lit. Its completely against spec and the tck actually tests it. The part accessor elements aren't allows to have xsi:nil="true" on them. :-( When I first discovered this, I actually went and tracked down some wsdl folks to ask about it cause I couldn't believe it either (major deficiency IMO), but it's true.
The only way to "allow" it would be for you to grab the code for the RPCOutInterceptor and "hack it" to remove the above check. However, that would probably not end up being interopable since it is against spec. Otherwise, you would need to wrapper the return in some object. The object itself would exist, but it could have a nillable (or minOccurs=0) element in it. Dan On Fri September 4 2009 4:27:04 am Gabo Manuel wrote: > Hi All, > > I developed a basic crud service. It is set to RPC/Lit. Everything works > fine for valid transactions, i.e. those with non-null results. But when > I try to retrieve a non-existing record, I end up with the following error: > > org.apache.cxf.interceptor.Fault: Cannot write part currency. > RPC/Literal parts cannot be null. (WS-I BP R2211) > at > org.apache.cxf.binding.soap.interceptor.RPCOutInterceptor.handleMessage(RPC > OutInterceptor.java:82) at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai > n.java:236) at > org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingC > hainInterceptor.java:74) at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai > n.java:236) at > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationO > bserver.java:104) at > org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestinati > on.java:99) at > org.apache.cxf.transport.servlet.ServletController.invokeDestination(Servle > tController.java:452) at > org.apache.cxf.transport.servlet.ServletController.invoke(ServletController > .java:196) at > org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServl > et.java:220) at > org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServl > et.java:153) at > javax.servlet.http.HttpServlet.service(HttpServlet.java:807) at > org.apache.cxf.transport.servlet.AbstractCXFServlet.service(AbstractCXFServ > let.java:211) at > org.apache.catalina.core.StandardWrapperValve.invokeServletService(Standard > WrapperValve.java:771) at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j > ava:322) at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.j > ava:212) at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:20 > 9) at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509) > at > com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.j > ava:161) at com.iplanet.ias.web.WebContainer.service(WebContainer.java:580) > > I was wondering if there was a way to allow null results, or if a custom > handler would be necessary? > > Thanks > > Gabo > -- Daniel Kulp [email protected] http://www.dankulp.com/blog
