Just to record for everyone else. Again my thanks to Dan.

The specific "rule" is in the WSI Basic Profile:

http://www.ws-i.org/profiles/basicprofile-1.1.html

Section 4.4.1:

R2211 An ENVELOPE described with an rpc-literal binding MUST NOT have the xsi:nil attribute with a value of "1" or "true" on the part accessors.

and:

When a wsdl:part element is defined using the type attribute, the serialization of that part in a message is equivalent to an implicit (XML Schema) qualification of a minOccurs attribute with the value "1", a maxOccurs attribute with the value "1" and a nillable attribute with the value "false".

It is necessary to specify the equivalent implicit qualification because the wsdl:part element does not allow one to specify the cardinality and nillability rules. Specifying the cardinality and the nillability rules facilitates interoperability between implementations. The equivalent implicit qualification for nillable attribute has a value of "false" because if it is specified to be "true" one cannot design a part whereby the client is always required to send a value. For applications that want to allow the wsdl:part to to be nillable, it is expected that applications will generate a complexType wrapper and specify the nillability rules for the contained elements of such a wrapper.



Hope that helps!
Dan



Daniel Kulp wrote:
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


------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 270.13.83/2352 - Release Date: 09/07/09 18:03:00

Reply via email to