cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From viola lu <viola...@gmail.com>
Subject Re: Get a null pointer if provider returns null response in payload message mode.
Date Fri, 26 Oct 2012 03:30:44 GMT
I saw changes in jira https://issues.apache.org/jira/browse/CXF-4182, and i
tried this property, it worked. But from
Jaxws spec 5.1.1 Invocation
A Provider based service instance’s invoke method is called for each
message received for the service.
When an invoke method returns null, it is considered that no response needs
to be sent by service

i think it's better to automatically switch to oneway and return 202 as Aki
Yoshida mentioned . I can update JAXWSMethodInvoker to make this happen.
Your comments?

On Fri, Oct 26, 2012 at 10:06 AM, viola lu <viola.lu@gmail.com> wrote:

> i am using cxf 2.6.2, does it support jaxws.provider.interpretNullAsOneway
> property?
>
>
> On Thu, Oct 25, 2012 at 9:20 PM, Andrei Shakirin <ashakirin@talend.com>wrote:
>
>> 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:elakito@gmail.com]
>> Sent: Donnerstag, 25. Oktober 2012 14:54
>> To: users@cxf.apache.org
>> Cc: viola.lu@gmail.com
>> 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 <viola.lu@gmail.com>:
>> > 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
>>
>
>
>
> --
> viola
>
> Apache Geronimo
>
>


-- 
viola

Apache Geronimo

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message