Oh it seems I have generated the stubs for JacORB with idlj Suns tool. It seems I cant do it -- its the same when I try to generate Java stubs from WSDL with tool from Axis and use them in CXF (this cannot work too).
LZ 2007/7/19, Lukas Zapletal <[EMAIL PROTECTED]>:
Thanks. I have generated my stubs with idlj tool from JDK 6.0. I googled that I might have wrong bootclasspath - the ORB is usually needed to be in the bootclasspath. So I have added JacORB to bootclasspath and it does not work. It seems it has nothing to do with Yoko. I created JacORB server and I am trying to reach it with JacORB client with the same exception :-( LZ 2007/7/19, Darren Middleman <[EMAIL PROTECTED]>: > Hi Lukas, > > No, I don't believe you will need to have a name service running for the > example that you mentioned. This should be a straight forward setup using > the Yoko binding and an a CORBA client. > > Usually, you get a BAD_PARAM exception when doing a narrow on an object > which is of the wrong type, for example, trying to narrow something as a > calculator when it is not. However, I don't see why this could happening > yet in your code. I will try and set up a small test using the code you > provided to see if I can see what is happening. > > I'll let you know what I find out. > > Cheers, > Darren > > > > > > On 7/19/07, Lukas Zapletal < [EMAIL PROTECTED]> wrote: > > I googled that Name Server may not have started. Proposed solution is > > to start the Java IDL Name Server: > > > > <JDK1.4 Home>/bin/ tnameserv -ORBInitialPort 1050 > > > > Do I need the nameserver when accessing WS in CXF/Yoko Binding from > > JacORB? I will try to run the JacORBs naming service. > > > > I am sorry I am new to CORBA. Thanks for help > > > > LZ > > > > 2007/7/19, Lukas Zapletal <[EMAIL PROTECTED]>: > > > Hello all! > > > > > > I have problem with calling WS from corba. My interface is simple: > > > > > > module com { > > > module pikeelectronic { > > > module calc { > > > > > > interface Calculator { > > > double add(in double x, in double y); > > > double sub(in double x, in double y); > > > double mul(in double x, in double y); > > > double div(in double x, in double y); > > > }; > > > }; > > > }; > > > }; > > > > > > I have converted this to WSDL and created a WS using CXF wsdl2java > tools: > > > > > > > > > /** > > > * Please modify this class to meet your needs > > > * This class is not complete > > > */ > > > > > > package com.pikeelectronic.calc.wsserver; > > > > > > import java.util.logging.Logger ; > > > import javax.jws.WebMethod; > > > import javax.jws.WebResult; > > > import javax.xml.ws.RequestWrapper; > > > import javax.xml.ws.ResponseWrapper; > > > > > > /** > > > * This class was generated by the CXF 2.0-incubator > > > * Wed Jul 18 14:05:16 CEST 2007 > > > * Generated source version: 2.0-incubator > > > * > > > */ > > > > > > @javax.jws.WebService(name = > "ComPikeelectronicCalcCalculator", > > > serviceName = > "com.pikeelectronic.calc.CalculatorCORBAService", > > > portName = > "com.pikeelectronic.calc.CalculatorCORBAPort", > > > targetNamespace = > > > "http://schemas.apache.org/yoko/idl/calc", > > > wsdlLocation = "file:calc.wsdl" , > > > endpointInterface = > > > > "com.pikeelectronic.calc.wsserver.ComPikeelectronicCalcCalculator") > > > > > > public class ComPikeelectronicCalcCalculatorImpl > implements > > > ComPikeelectronicCalcCalculator { > > > > > > private static final Logger LOG = > > > > Logger.getLogger(ComPikeelectronicCalcCalculatorImpl.class.getPackage().getName()); > > > > > > /* (non-Javadoc) > > > * @see > com.pikeelectronic.calc.wsserver.ComPikeelectronicCalcCalculator#sub > (double > > > x ,)double y )* > > > */ > > > public double sub( > > > double x, > > > double y > > > ) > > > { > > > LOG.info("Executing operation sub"); > > > return x - y; > > > } > > > > > > /* (non-Javadoc) > > > * @see > com.pikeelectronic.calc.wsserver.ComPikeelectronicCalcCalculator#div(double > > > x ,)double y )* > > > */ > > > public double div( > > > double x, > > > double y > > > ) > > > { > > > LOG.info("Executing operation div"); > > > return x / y; > > > } > > > > > > /* (non-Javadoc) > > > * @see > com.pikeelectronic.calc.wsserver.ComPikeelectronicCalcCalculator#mul(double > > > x ,)double y )* > > > */ > > > public double mul( > > > double x, > > > double y > > > ) > > > { > > > LOG.info("Executing operation mul"); > > > return x * y; > > > } > > > > > > /* (non-Javadoc) > > > * @see > com.pikeelectronic.calc.wsserver.ComPikeelectronicCalcCalculator#add > (double > > > x ,)double y )* > > > */ > > > public double add( > > > double x, > > > double y > > > ) > > > { > > > LOG.info("Executing operation add"); > > > return x + y; > > > } > > > > > > } > > > > > > I have implemented a client in JacORB: > > > > > > package com.pikeelectronic.calc.CORBAClient; > > > > > > /** > > > * An example for using the Dynamic Invocation Interface > > > */ > > > //import org.omg.CosNaming.*; > > > > > > public class Client > > > { > > > public static void main( String[] args ) > > > { > > > org.omg.CORBA.ORB orb = null; > > > > > > try > > > { > > > orb = org.omg.CORBA.ORB.init(args,null); > > > > > > org.omg.CORBA.Object obj = > > > orb.string_to_object("corbaloc:: 192.168.3.230:40000/calc"); > > > > > > /*org.omg.CORBA.Object object = > orb.resolve_initial_references( > > > "NameService" ); > > > NamingContext context = NamingContextHelper.narrow ( > object );*/ > > > > > > Calculator c = CalculatorHelper.narrow(obj); > > > > > > System.out.println("Initialize ready....."); > > > > > > System.out.println ("2 + 2 = " + c.add((double)2, > (double)2)); > > > System.out.println("2 * 2 = " + c.mul((double)2, > (double)2)); > > > System.out.println("2 / 2 = " + c.div ((double)2, > (double)2)); > > > System.out.println("2 - 2 = " + c.sub((double)2, > (double)2)); > > > > > > } > > > catch (Exception e) > > > { > > > e.printStackTrace(); > > > } > > > orb.shutdown(false); > > > } > > > } > > > > > > I run the server (in the CXF standalone mode): > > > > > > public class ComPikeelectronicCalcCalculatorServer{ > > > > > > protected ComPikeelectronicCalcCalculatorServer() > throws Exception { > > > System.out.println("Starting Server"); > > > Object implementor = new > ComPikeelectronicCalcCalculatorImpl(); > > > String address = "corbaloc::192.168.3.230:40000/calc"; > > > Endpoint.publish(address, implementor); > > > } > > > > > > public static void main(String args[]) throws Exception { > > > new ComPikeelectronicCalcCalculatorServer(); > > > System.out.println("Server ready..."); > > > > > > Thread.sleep(60 * 60 * 1000); > > > System.out.println("Server exitting"); > > > System.exit(0); > > > } > > > } > > > > > > And I run the client. Its giving me this result: > > > > > > org.omg.CORBA.BAD_PARAM: vmcid: 0x0 minor code: 0 completed: No > > > at > com.pikeelectronic.calc.CORBAClient.CalculatorHelper.narrow(CalculatorHelper.java:60) > > > at > com.pikeelectronic.calc.CORBAClient.Client.main(Client.java:23) > > > > > > Whats wrong? Did I miss something? > > > > > > -- > > > Lukas Zapletal > > > http://lukas.zapletalovi.com > > > > > > > > > -- > > Lukas Zapletal > > http://lukas.zapletalovi.com > > > > -- Lukas Zapletal http://lukas.zapletalovi.com
-- Lukas Zapletal http://lukas.zapletalovi.com