cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manoel Farrugia <manoelka...@gmail.com>
Subject Re: Interceptors: How to handle an unknown request?
Date Mon, 06 Dec 2010 09:16:54 GMT
Sorry but I am new with CXF and have not understand the last post Sergey


On Thu, Dec 2, 2010 at 11:52 AM, Sergey Beryozkin <sberyozkin@gmail.com> wrote:
> Having a custom CXF invoker is probably one option, it should be able to
> ensure the right Method is invoked,
> another option is to register a custom CXF ServletFilter which would provide
> a custom HttpServletRequest which would in turn manipulate the request body
> such that CXF is made to believe it is getGreeting() which has to be
> invoked.
> You may also want to debug and check how CXF SOAP interceptors determine the
> method name and may be you can register a custom XMLStreamReader which will
> make CXF to invoke getGreeting.
>
> Sergey
>
>
> On Thu, Dec 2, 2010 at 10:37 AM, Manoel Farrugia <manoelkazza@gmail.com>wrote:
>
>> No I have only getGreeting implemented and want that every other wrong
>> request is directed to getGreeting.
>>
>> If one requests getGreeting2 it directs him to getGreeting.
>>
>>
>> On Thu, Dec 2, 2010 at 11:34 AM, Sergey Beryozkin <sberyozkin@gmail.com>
>> wrote:
>> > Do you actually have getGreeting2 implemented ? Example, do you have two
>> > SOAP endpoints, one implementing getGreeting and one getGreeting2 and you
>> > want the consumers of getGreeting2 be able to work with the old
>> > getGreeting() ?
>> >
>> > cheers, Sergey
>> >
>> > On Thu, Dec 2, 2010 at 9:43 AM, Manoel Farrugia <manoelkazza@gmail.com
>> >wrote:
>> >
>> >> I can even scrap the idea of Interceptors if there is a better way to
>> >> do my wanted job!
>> >>
>> >> Instead of receiving soap:ServerNo such operation: getGreeting2 (HTTP
>> >> GET PATH_INFO: /HelloWorldWebServices/HelloWorldPort/getGreeting2) I
>> >> want to see the getGreeting response!
>> >>
>> >> How can I do it in CXF Web Services?
>> >>
>> >>
>> >>
>> >> On Wed, Dec 1, 2010 at 8:10 PM, Manoel Farrugia <manoelkazza@gmail.com>
>> >> wrote:
>> >> > I am not restricted to handleFault only. I want to redirect any wrong
>> >> > methods to getGreeting() method.
>> >> >
>> >> > On Wed, Dec 1, 2010 at 8:07 PM, Daniel Kulp <dkulp@apache.org>
wrote:
>> >> >>
>> >> >> On Wednesday 01 December 2010 5:49:41 am Manoel Farrugia wrote:
>> >> >> > Something like this:
>> >> >> >
>> >> >> > public void handleFault(Message message) {
>> >> >> >      System.out.println("------FAAAAAUUUUUUUULLLLLLTTTTTT-------");
>> >> >> >
>> >> >> >      String path = (String)message.get(Message.PATH_INFO);
>> >> >> >      String basePath = (String)message.get(Message.BASE_PATH);
>> >> >> >      String query = (String)message.get(Message.QUERY_STRING);
>> >> >> >      System.out.println("Path: "+path+". BasePath: "+basePath+".
>> >> Query:
>> >> >> > "+query+".");
>> >> >> >      System.out.println("------FAAAAAUUUUUUUULLLLLLTTTTTT-------");
>> >> >> >
>> >> >> >      message.put(Message.PATH_INFO,
>> >> >> > "/HelloWorldWebServices/HelloWorldPort/getGreeting");
>> >> >> >
>> >> >> >      path = (String)message.get(Message.PATH_INFO);
>> >> >> >      System.out.println("NEW PATH: "+path);
>> >> >> >     }
>> >> >> >
>> >> >> > That is changing the message's pathinfo from the wrong one
>> >> >> > to /HelloWorldWebServices/HelloWorldPort/getGreeting
>> >> >> >
>> >> >> > But I want to direct to
>> >> >> > /HelloWorldWebServices/HelloWorldPort/getGreeting
>> >> >> > from the handleFault method.
>> >> >> > How should I do this?
>> >> >>
>> >> >> From handleFault?   Hmm...  No idea really.
>> >> >>
>> >> >> You  could TRY to do something like
>> >> >> message.getInterceptorChain().reset();
>> >> >> message.getIntercetporChain().processMessage(message);
>> >> >> message.getInterceptorChain().pause();
>> >> >>
>> >> >> or similar.  I really have no idea what that would do.   Honestly,
>> once
>> >> >> the
>> >> >> fault occurs, things are somewhat left in an unpredictable state
and
>> I'm
>> >> >> not
>> >> >> sure what would happen.
>> >> >>
>> >> >> Dan
>> >> >>
>> >> >>
>> >> >>
>> >> >> >
>> >> >> > On Tue, Nov 30, 2010 at 10:01 PM, Daniel Kulp <dkulp@apache.org>
>> >> wrote:
>> >> >> > > On Tuesday 30 November 2010 5:31:10 am Manoel Farrugia
wrote:
>> >> >> > > > As a web service I have a getGreeting() method which
is
>> accessed
>> >> by:
>> >> >> > >
>> >> >> > >
>> >>
>> http://localhost:8080/HelloWorldWebServices/services/HelloWorldPort/getGr
>> >> >> > > ee
>> >> >> > >
>> >> >> > > > ting<
>> >> >> > >
>> >> >> > >
>> >> http://localhost:8080/HelloWorldWebServices/services/HelloWorldPort/ge
>> >> >> > >
>> >> >> > > > tGreeting1?arg0=Manoel>
>> >> >> > > >
>> >> >> > > > Now I want that any other request method which does
not exist
>> in
>> >> my
>> >> >> > > > web
>> >> >> > > > service (for example getGreetingMe()) is redirected
to
>> >> getGreeting()
>> >> >> > > > as
>> >> >> > >
>> >> >> > > the
>> >> >> > >
>> >> >> > > > address above.
>> >> >> > > >
>> >> >> > > > How should I tackle this idea?
>> >> >> > >
>> >> >> > > If  this is just for the "GET" requests, it shouldn't
be too
>> hard.
>> >> >> > >
>> >> >> > > String path = (String)message.get(Message.PATH_INFO);
>> >> >> > > String basePath = (String)message.get(Message.BASE_PATH);
>> >> >> > > String query = (String)message.get(Message.QUERY_STRING);
>> >> >> > >
>> >> >> > > would get you the values that were sent in.  You would
just need
>> to
>> >> >> > > reset
>> >> >> > > them
>> >> >> > > to the "getGreeting" versions of those via message.put(...)
type
>> >> >> > > things.
>> >> >> > >
>> >> >> > > --
>> >> >> > > Daniel Kulp
>> >> >> > > dkulp@apache.org
>> >> >> > > http://dankulp.com/blog
>> >> >>
>> >> >> --
>> >> >> Daniel Kulp
>> >> >> dkulp@apache.org
>> >> >> http://dankulp.com/blog
>> >> >
>> >> >
>> >>
>> >
>>
>

Mime
View raw message