Have you ever ready any documentation from XFire site ? If you take a
look at http://xfire.codehaus.org/Client+and+Server+Stub+Generation+from+WSDL
you will see how to add handler to generated code.

On 4/29/07, craig w <[EMAIL PROTECTED]> wrote:
ok I also tried this:


public static class MyInvoker extends ObjectInvoker {

     private ObjectInvoker delegate;

     public MyInvoker(ObjectInvoker delegate) {

          super(delegate.getScope ());

          this. delegate = delegate;

     }

     @Override

     public Object invoke(Method arg0, Object[] arg1, MessageContext arg2)
throws XFireFault {

          System.out.println( "Invoking: " + arg0 + ", " + arg1 + ", mc: " +
arg2);

          return delegate.invoke(arg0, arg1, arg2);

     }

     @Override

     public ScopePolicy getScope() {

          return delegate.getScope();

     }

     @Override

     public Object getServiceObject(MessageContext arg0) throws XFireFault {

          return delegate.getServiceObject(arg0);

     }

}

in my HelloServiceClient....

....


AnnotationServiceFactory asf = new AnnotationServiceFactory(new
Jsr181WebAnnotations(), tm, new AegisBindingProvider(new
JaxbTypeRegistry()));

asf.setBindingCreationEnabled(false);

service0 = asf.create((blah.HelloServiceSoap.class), props);
ObjectInvoker oi = (ObjectInvoker) service0.getInvoker();
service0.setInvoker(new MyInvoker(oi));


When I run my "main" method again....I don't even see anything printed out,
I should at least see the "Invoking...." message as printed from MyInvoker.
It almost seems like the "service0" object is not being used or something.


On 4/28/07, craig w <[EMAIL PROTECTED]> wrote:
>
> I found the example....and i see how to create the handler.  Problem is
with my generated code the handler doesn't seemed to be used.  I went into
my auto-generated HelloServiceClient.java and when it creates the service0
object, I then do...
>
> // i tried in handler and out handler, same results (none)
> service0.addInHandler(new MyHandler());
>
> class MyHandler extends AbstractHandler {
>     public void invoke(MessageContext mc) {
>
>               Element header = ctx.getInMessage().getHeader();
>               System.out.println("HEADER: " + header);
>
>     }
> }
>
> The "Book" example does things differently than my auto-generated code:
>
>   HelloServiceClient service = new HelloServiceClient();
>   HelloServiceSoap client = service.getHelloServiceSoap();
>   Holder<UserInfo> holder = new Holder<UserInfo>();
>   SayHelloResult result = client.sayHello("bob", holder);
>
> The output from this does not show "HEADER: ...." , as though my handler
is never being called.
>
> any ideas why?
>
>
>
>
> On 4/28/07, craig w <[EMAIL PROTECTED]> wrote:
> >
> > where can I find these?  I currently have
xfire-all-1.2-20070425.101013-38.jar and
xfire-all-1.2.5.jar...but they dont seem to have an examples folder in them.
> >
> > thanks again!
> >
> >
> >
> > On 4/28/07, Tomek Sztelak <[EMAIL PROTECTED] > wrote:
> > > Check book example and CheckVersionHandler .
> > >
> > > On 4/28/07, craig w < [EMAIL PROTECTED]> wrote:
> > > > anyone have an idea???
> > > >
> > > >
> > > >
> > > > On 4/27/07, craig w < [EMAIL PROTECTED]> wrote:
> > > > > ...things are very quiet...
> > > > >
> > > > >
> > > > >
> > > > > On 4/26/07, craig w < [EMAIL PROTECTED]> wrote:
> > > > > > Hi,
> > > > > >   I have the following WSDL2Java generated client code:
> > > > > >
> > > > > > public static void main(String[] args) {
> > > > > >     HelloServiceClient service = new HelloServiceClient();
> > > > > >     HelloServiceSoap client = service.getHelloServiceSoap ();
> > > > > >     Holder<UserInfo> holder = new Holder<UserInfo>();
> > > > > >     SayHelloResult result = client.sayHello ("bob", holder);
> > > > > >     System.out.println("context: " + AbstractInvoker.getContext
());
> > > > > > }
> > > > > >
> > > > > > This prints out null.
> > > > > >
> > > > > > In my HelloServiceClient I put a method to retrieve the
> > > > > > org.codehaus.xfire.service.Service object.  So
in my
> > > > > > HelloServiceClient there is this line:
> > > > > >
> > > > > > service0 = asf.create ((blah.HelloServiceSoap.class), props);
> > > > > >
> > > > > > and I added:
> > > > > > service0.addInHandler(new ReadHeadersHandler());
> > > > > >
> > > > > > So in my "main" I put a print at the end, such as:
> > > > > >
> > > > > > for (Handler h : service.getService ().getInHandlers()) {
> > > > > >     System.out.println(h + ", " + h.getBefore() + ", " +
h.getAfter ()
> > > > > > + ", " + h.getUnderstoodHeaders());
> > > > > > }
> > > > > >
> > > > > > each function call to the Handler "h" ( i.e. getBefore,
getAfter, etc)
> > > > > > just returns null or an empty list (depending on what it should
> > > > > > return).  I even tried adding the ReadHeadersHandler to the
> > > > > > "OutHandlers" list of my client.  Still no luck.
> > > > > >
> > > > > > One last thing I tried was to add my own handler to the In and
Out
> > > > > > handlers list.
> > > > > >
> > > > > > service.getService().addInHandler(new AbstractHandler() {
> > > > > >      public void invoke(MessageContext mc) {
> > > > > >               System.out.println("Message: " + mc);
> > > > > >      }
> > > > > > });
> > > > > >
> > > > > > This doesn't print anything.
> > > > > >
> > > > > > Any ideas???  The "sayHello" operation does return a soap
envelope
> > > > > > which has a UserInfo header and a body.
> > > > > >
> > > > > > thanks
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > -----
> > > When one of our products stops working, we'll blame another vendor
> > > within 24 hours.
> > >
> > >
---------------------------------------------------------------------
> > > To unsubscribe from this list please visit:
> > >
> > >    http://xircles.codehaus.org/manage_email
> > >
> > >
> >
> >
>
>




--
-----
When one of our products stops working, we'll blame another vendor
within 24 hours.

---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to