Just realized that we do support something similar:
public class MyService {
public void invoke(Exchange ex) {
Message in = ex.getInMessage();
Message out = ex.getOutMessage(); // not sure if the outmessage has been
created at this point or not, so you may have to experiment
...
}
}
sf = new ServerFactoryBean();
sf.setServiceClass(MyService.class);
....
sf.create();
OR you can use the stax databinding in 2.0.1 that I added if you just want
access to the streams:
http://fisheye6.cenqua.com/browse/celtixfire/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/stax/StaxDatabindingTest.java?r=557406
public class AnotherService {
public XMLStreamWriterCallback invoke(final XMLStreamReader reader) {
try {
reader.nextTag();
} catch (XMLStreamException e) {
throw new Fault(e);
}
return new XMLStreamWriterCallback() {
public void write(XMLStreamWriter writer) throws Fault,
XMLStreamException {
writer.writeEmptyElement("bleh");
}
};
}
}
NOTE: you can add the Exchange object to any operation and CXF will
automatically inject it. Meaning the above could have a signature like
"XMLStreamWriterCallback invoke(final XMLStreamReader reader, Exchange ex)"
if you wanted it to.
Cheers,
- Dan
On 7/27/07, Daniel Kulp <[EMAIL PROTECTED]> wrote:
>
>
> Michal,
>
> Right now, we don't support any Provider (or Dispatch) that takes the raw
> CXF Message types. That's a good suggestion though. Could you log a
> Jira for it?
>
> What's worse, looking at the code for the Dispatch/Provider stuff on
> trunk, it only will work for XML and SOAP bindings. It specifically
> checks for those and does "bad" things. I was hoping to say you could
> do something like:
>
> public class CalculatorImpl implements Provider<XMLStreamReader> {
> }
>
> to use the data from the CORBA stream reader, but that doesn't even work
> right now. Even trying a Source doesn't work. I think some Jira's
> need to be added for that as well.
>
>
> Dan
>
>
> On Friday 27 July 2007 09:29, Michal Šafr wrote:
> >
> > firstly I'm not sure, if this is CXF or YOKO problem, so please excuse
> > me if I've sent this problem to a wrong place. I've got the problem
> > described below.
> >
> > I started from simple WSDL describing service with CORBA binding. I
> > generated standalone server and client using CXF tool wsdl2java
> > -server (-client) . Implemented service and everything worked fine
> > without any problem. I was able to call WS using generated client and
> > WS was returning expected values. Then I decided to implement WS using
> > interface javax.xml.ws.Provider so I had:
> >
> > //Service class, annotations are not mentioned here, but i changed
> > @WebService annotation to @WebServiceProvider and added @ServiceMode
> >
> > public class CalculatorImpl implements Provider<CorbaMessage> {
> >
> > public CorbaMessage invoke(CorbaMessage arg0) {
> >
> > System.out.println("corba service called");
> >
> > return arg0;
> >
> > }
> >
> > }
> >
> >
> >
> > Every time I try to call WS a receive following exception on the
> > client side:
> >
> >
> >
> > org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 207 completed: No
> >
> > at
> > com.sun.corba.se.impl.logging.ORBUtilSystemException.endOfStream(ORBUt
> >ilSyst emException.java:6386)
> >
> > at
> > com.sun.corba.se.impl.logging.ORBUtilSystemException.endOfStream(ORBUt
> >ilSyst emException.java:6408)
> >
> > at
> > com.sun.corba.se.impl.encoding.BufferManagerReadStream.underflow(Buffe
> >rManag erReadStream.java:93)
> >
> > at
> > com.sun.corba.se.impl.encoding.CDRInputStream_1_1.grow(CDRInputStream_
> >1_1.ja va:75)
> >
> > at
> > com.sun.corba.se.impl.encoding.CDRInputStream_1_2.alignAndCheck(CDRInp
> >utStre am_1_2.java:80)
> >
> > at
> > com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_longlong(CDRInp
> >utStre am_1_0.java:504)
> >
> > at
> > com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_double(CDRInput
> >Stream _1_0.java:526)
> >
> > at
> > com.sun.corba.se.impl.encoding.CDRInputStream.read_double(CDRInputStre
> >am.jav a:153)
> >
> > at
> > com.pikeelectronic.calc._CalculatorStub.add(_CalculatorStub.java:182)
> >
> > at
> > com.pikeelectronic.calc.CORBAClient.Client.main(Client.java:32)
> >
> >
> >
> > And following exception on the server side:
> >
> >
> >
> > 27.7.2007 13:21:05 org.apache.cxf.phase.PhaseInterceptorChain
> > doIntercept
> >
> > INFO: Interceptor has thrown exception, unwinding now
> >
> > java.lang.NullPointerException
> >
> > at java.lang.Class.isAssignableFrom(Native Method)
> >
> > at
> > org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDa
> >taRead er.java:56)
> >
> > at
> > org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDa
> >taRead er.java:52)
> >
> > at
> > org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDa
> >taRead er.java:48)
> >
> > at
> > org.apache.cxf.interceptor.BareInInterceptor.handleMessage(BareInInter
> >ceptor .java:138)
> >
> > at
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
> >rChain .java:206)
> >
> > at
> > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitia
> >tionOb server.java:67)
> >
> > at
> > org.apache.yoko.bindings.corba.runtime.CorbaDSIServant.invoke(CorbaDSI
> >Servan t.java:156)
> >
> > at
> > org.apache.yoko.orb.OBPortableServer.ServantDispatcher.dispatch(Servan
> >tDispa tcher.java:225)
> >
> > at
> > org.apache.yoko.orb.OBPortableServer.POA_impl._OB_dispatch(POA_impl.ja
> >va:160 7)
> >
> > at
> > org.apache.yoko.orb.OB.DispatchRequest_impl.invoke(DispatchRequest_imp
> >l.java
> >
> > :56)
> >
> > at
> > org.apache.yoko.orb.OB.DispatchSameThread_impl.dispatch(DispatchStrate
> >gyFact ory_impl.java:53)
> >
> > at org.apache.yoko.orb.OB.Upcall.invoke(Upcall.java:360)
> >
> > at
> > org.apache.yoko.orb.OB.GIOPConnectionThreaded.execReceive(GIOPConnecti
> >onThre aded.java:502)
> >
> > at
> > org.apache.yoko.orb.OB.GIOPConnectionThreaded$ReceiverThread.run(GIOPC
> >onnect ionThreaded.java:64)
> >
> > 27.7.2007 13:21:06 org.apache.cxf.phase.PhaseInterceptorChain
> > doIntercept
> >
> > INFO: Interceptor has thrown exception, unwinding now
> >
> > org.apache.yoko.bindings.corba.CorbaBindingException:
> > java.lang.NullPointerException
> >
> > at
> > org.apache.yoko.bindings.corba.interceptors.CorbaStreamFaultOutInterce
> >ptor.h andleMessage(CorbaStreamFaultOutInterceptor.java:113)
> >
> > at
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
> >rChain .java:206)
> >
> > at
> > org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessa
> >ge(Abs tractFaultChainInitiatorObserver.java:86)
> >
> > at
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
> >rChain .java:223)
> >
> > at
> > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitia
> >tionOb server.java:67)
> >
> > at
> > org.apache.yoko.bindings.corba.runtime.CorbaDSIServant.invoke(CorbaDSI
> >Servan t.java:156)
> >
> > at
> > org.apache.yoko.orb.OBPortableServer.ServantDispatcher.dispatch(Servan
> >tDispa tcher.java:225)
> >
> > at
> > org.apache.yoko.orb.OBPortableServer.POA_impl._OB_dispatch(POA_impl.ja
> >va:160 7)
> >
> > at
> > org.apache.yoko.orb.OB.DispatchRequest_impl.invoke(DispatchRequest_imp
> >l.java
> >
> > :56)
> >
> > at
> > org.apache.yoko.orb.OB.DispatchSameThread_impl.dispatch(DispatchStrate
> >gyFact ory_impl.java:53)
> >
> > at org.apache.yoko.orb.OB.Upcall.invoke(Upcall.java:360)
> >
> > at
> > org.apache.yoko.orb.OB.GIOPConnectionThreaded.execReceive(GIOPConnecti
> >onThre aded.java:502)
> >
> > at
> > org.apache.yoko.orb.OB.GIOPConnectionThreaded$ReceiverThread.run(GIOPC
> >onnect ionThreaded.java:64)
> >
> > Caused by: java.lang.NullPointerException
> >
> > at java.lang.Class.isAssignableFrom(Native Method)
> >
> > at
> > org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDa
> >taRead er.java:56)
> >
> > at
> > org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDa
> >taRead er.java:52)
> >
> > at
> > org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDa
> >taRead er.java:48)
> >
> > at
> > org.apache.cxf.interceptor.BareInInterceptor.handleMessage(BareInInter
> >ceptor .java:138)
> >
> > at
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
> >rChain .java:206)
> >
> > ... 9 more
> >
> >
> >
> > I have changed nothing else than WS implementation on server side.
> > Could anyone help please? Every advice is welcome, thank you very
> > much.
>
> --
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727 C: 508-380-7194
> [EMAIL PROTECTED]
> http://www.dankulp.com/blog
>
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog