cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukas Zapletal" <lukas.zaple...@gmail.com>
Subject Re: YOKO & CXF CORBA Web Service using Provider<CorbaMessage>
Date Thu, 02 Aug 2007 13:12:03 GMT
I thought DII and Dispatch are equal. So is there a possibility to
call a CORBA service in y dynamic way? Example of the client:

			QName svcQname = new QName(
					"http://schemas.apache.org/yoko/idl/calc",
					"com.pikeelectronic.calc.CalculatorCORBAService");
			QName portQName = new QName(
					"http://schemas.apache.org/yoko/idl/calc",
					"com.pikeelectronic.calc.CalculatorCORBAPort");

			Service svc = Service.create(svcQname);
			svc.addPort(portQName, SOAPBinding.SOAP11HTTP_BINDING,
					"corbaloc::localhost:40000/calc");
			
            // Create the dynamic invocation object from this service.
            Dispatch<Source> dispatch = svc.createDispatch(
                    portQName,
                    Source.class,
                    Service.Mode.PAYLOAD);

            String content =
                    "<tns:add
xmlns:tns=\"http://schemas.apache.org/yoko/idl/calc\">" +
                      "<x>2</x> <y>4</y>" +
                    "</tns:add>";

            ByteArrayInputStream bais = new
ByteArrayInputStream(content.getBytes());
            Source input = new StreamSource(bais);

            // Invoke the operation.
            Source response = dispatch.invoke(input);

            // Process the response.
            StreamResult result = new StreamResult(new ByteArrayOutputStream());
            Transformer trans =
TransformerFactory.newInstance().newTransformer();
            trans.transform(response, result);
            ByteArrayOutputStream baos = (ByteArrayOutputStream)
result.getOutputStream();

            // Write out the response content.
            String responseContent = new String(baos.toByteArray());
            System.out.println(responseContent);

I am getting an exception:

2.8.2007 15:11:31 org.apache.cxf.jaxws.DispatchImpl invoke
INFO: Dispatch: invoke called
2.8.2007 15:11:31 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
java.lang.NullPointerException
	at org.apache.yoko.bindings.corba.TypeMapCache.get(TypeMapCache.java:38)
	at org.apache.yoko.bindings.corba.CorbaConduit.<init>(CorbaConduit.java:86)
	at org.apache.yoko.bindings.corba.CorbaBindingFactory.getConduit(CorbaBindingFactory.java:109)
	at org.apache.yoko.bindings.corba.CorbaBindingFactory.getConduit(CorbaBindingFactory.java:104)
	at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:73)
	at org.apache.cxf.endpoint.UpfrontConduitSelector.selectConduit(UpfrontConduitSelector.java:71)
	at org.apache.cxf.message.ExchangeImpl.getConduit(ExchangeImpl.java:50)
	at org.apache.cxf.interceptor.MessageSenderInterceptor.getConduit(MessageSenderInterceptor.java:71)
	at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:206)
	at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:163)
	at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:112)
	at com.pikeelectronic.calc.WSDIIClient.main(WSDIIClient.java:51)
java.lang.ClassCastException: java.lang.NullPointerException cannot be
cast to org.apache.cxf.interceptor.Fault
	at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:171)
	at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:112)
	at com.pikeelectronic.calc.WSDIIClient.main(WSDIIClient.java:51)

How sould I pass the binding information into it?

Thanks, Lukas

2007/8/2, Liu, Jervis <jliu@iona.com>:
> JAX-WS does not support DII except the Dispatch interface, the old JAX-RPC spec does.
The reason is because DII in its nature, does not work well with Doc/Lit style web services.
BTW, one could also argue Dispatch interface is more powerful than DII.
>
> Cheers,
> Jervis
>
> -----Original Message-----
> From: Lukas Zapletal [mailto:lukas.zapletal@gmail.com]
> Sent: 2007年8月2日 16:11
> To: cxf-user@incubator.apache.org
> Subject: Re: YOKO & CXF CORBA Web Service using Provider<CorbaMessage>
>
>
> Hello,
>
> is it possible to call CORBA service with CXF using DII? How could I
> pass the request through the binding?
>
> LZ
>
> 2007/7/30, Liu, Jervis <jliu@iona.com>:
> > Hi Michal,
> >
> > The short answer is we do not support Provider<CorbaMessage> right now in
CXF, I will discuss into details why we can not support Provider<CorbaMessage> with
standard JAX-WS APIs in a following email. You mentioned CORBA binding is working for you
with the SEI style(client and server generated by wsdltojava), so why you wanted to try Provider
interface? Is it because you want to access raw message that sent and received by CORBA binding?
If this is the case, interceptors might help. I am not familiar with YOKO, but the underlying
principles should be same as other bindings, i.e., they should have some CORBA binding interceptors
that take an input stream, parse the input to get binding operation info, such as operation
name, input parameter types etc so that they know how to dispatch the request into implementation.
At the same time, some other CORBA binding interceptors will retrieve the payload from request
(maybe the CDR format?) and turn it into some kind of objects that represent CORBA payload
(maybe the CorbaMessage u referred to?). Lets say interceptor B, C, D are used by CORBA binding
to do the work mentioned about, at the end of interceptor D, both operation info and message
payload will be available for accessing.  So if you can ask YOKO team, they might help you
to find out what interceptors are used by CORBA binding and how they work. You shall be able
to access raw information from these interceptor directly. If you prefer not modify or use
these CORBA interceptors directly, you can write you own interceptor. As long as you put this
interceptor in a proper position of interceptor chain, you shall be able access all the information
as well. An example of how to write and configure your own interceptor can be found from samples\streamInterceptor
in CXF distribution.
> >
> > Hope this helps,
> > Jervis
> >
> > -----Original Message-----
> > From: msafr@pikeelectronic.com [mailto:msafr@pikeelectronic.com]
> > Sent: 2007?7?30? 16:31
> > To: cxf-user@incubator.apache.org
> > Subject: RE: YOKO & CXF CORBA Web Service using Provider<CorbaMessage>
> >
> >
> > Thanks guys for your helpful replies. Isn't there any way how to solve my
> > problem using Interceptor? I'll try ServerFactoryBean as you mentioned.
> > Thanks
> >
> >
> > > 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
> > daniel.kulp@iona.com
> > http://www.dankulp.com/blog
> >
> > ----------------------------
> > IONA Technologies PLC (registered in Ireland)
> > Registered Number: 171387
> > Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
> >
>
>
> --
> Lukas Zapletal
> http://lukas.zapletalovi.com
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
>


-- 
Lukas Zapletal
http://lukas.zapletalovi.com
Mime
View raw message