In earlier CXF versions is possible to specify it explicitly via endpoint
property "jaxws.provider.interpretNullAsOneway":
<bean id="BooleanTrue" class="java.lang.Boolean">
<constructor-arg index="0" value="true"/>
</bean>
<jaxws:endpoint xmlns:customer="http://customerservice.example.com/"
id="CustomerServiceHTTP"
address="http://xxx.yyy.com/service/customservice"
implementor="com.example.customerservice.server.CustomerServiceImpl">
<jaxws:properties>
<entry key="jaxws.provider.interpretNullAsOneway"
value-ref="BooleanTrue" />
</jaxws:properties>
</jaxws:endpoint>
Andrei.
-----Original Message-----
From: Aki Yoshida [mailto:[email protected]]
Sent: Donnerstag, 25. Oktober 2012 14:54
To: [email protected]
Cc: [email protected]
Subject: Re: Get a null pointer if provider returns null response in payload
message mode.
hi,
Which version of CXF are you using?
I thought it should automatically switch to a pseudo oneway mode and return an
empty http 202 response and this should be handled witout throwing an NPE.
regards, aki
p.s. moved this to users@cxf
2012/10/25 viola lu <[email protected]>:
> Hi, Dev:
>
> I wrote a sample DOMSource payload provider as below:
>
> @WebServiceProvider()
> public class GreeterDOMSourcePayloadProvider implements
> Provider<DOMSource> {
>
> public GreeterDOMSourcePayloadProvider() {
> //Complete
> }
>
> public DOMSource invoke(DOMSource request) {
> DOMSource response = new DOMSource();
> return null;
> }
> }
>
> and run client against it:
>
> QName serviceName3 = new
> QName("http://apache.org/hello_world_soap_http",
> "SOAPService3");
> QName portName3 = new
> QName("http://apache.org/hello_world_soap_http",
> "SoapPort3");
>
> SOAPService3 service3 = new SOAPService3(wsdlURL, serviceName3);
> InputStream is3 =
> Client.class.getResourceAsStream("GreetMeDocLiteralReq3.xml");
> if (is3 == null) {
> System.err.println("Failed to create input stream from file "
> + "GreetMeDocLiteralReq3.xml, please check");
> System.exit(-1);
> }
>
> SOAPMessage soapReq3 =
> MessageFactory.newInstance().createMessage(null, is3);
> DOMSource domReqPayload = new
> DOMSource(soapReq3.getSOAPBody().extractContentAsDocument());
>
> Dispatch<DOMSource> dispDOMSrcPayload =
> service3.createDispatch(portName3,
>
> DOMSource.class, Mode.PAYLOAD);
> System.out.println("Invoking server through Dispatch interface
> using DOMSource in PAYLOAD Mode");
> DOMSource domRespPayload =
> dispDOMSrcPayload.invoke(domReqPayload);
>
>
> but got an null pointer exception in BareOutputInterceptor.
>
> CXF doesn't support null return response in payload mode? I tried it
> in message mode, it returns an empty <soap-env:body></soap-env:body>,
> but not in payload mode.
>
> I think it should keep same in both mode. Is this a defect of cxf?
>
> You can reproduce it by reusing cxf sample : jaxws_dispatch_provider
>
> Appreciate your comments.
> --
> viola
>
> Apache Geronimo