4 Replies Latest reply on Apr 18, 2013 12:32 AM by Tom Cunningham

    Client code can be written with C++?

    zjr_nuaa ZJR Newbie

      Client code can be written with C++?

        • 2. Re: Client code can be written with C++?
          Tom Cunningham Master

          I suppose if you wrote a JNI wrapper, you could write code you call in an action in C++.    I'm not sure that's what you are asking.

          • 3. Re: Client code can be written with C++?
            zjr_nuaa ZJR Newbie

            I mean now the client code like this :

            "

            public class WebServiceConsumer1Client {

                       private QueueConnection connection; 

                                     private QueueSession session; 

                                     private Queue queue; 

                                     

                                     public void setupConnection() throws Exception 

                                     { 

                                         Properties properties = new Properties(); 

                                        properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");    

                                         properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");    

                                         properties.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099"); 

                                         InitialContext context = new InitialContext(properties); 

                                         

                                         QueueConnectionFactory factory = (QueueConnectionFactory) context.lookup("ConnectionFactory"); 

                                        connection = factory.createQueueConnection(); 

                                      //  queue = (Queue) context.lookup("queue/webserviceproducerGw"); 

                                        queue = (Queue) context.lookup("queue/webserviceconsumer1RequestGw"); 

                                        session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE); 

                                        connection.start(); 

                                         

                                        System.out.println("Connection Started"); 

                                    } 

                                     

                                    public void stop() throws Exception 

                                    { 

                                        if(connection != null) connection.stop(); 

                                        if(session != null) session.close(); 

                                        if(connection != null) connection.close(); 

                                         

                                        System.out.println("Client Stopped"); 

                                    } 

                                     

                                    public void sendAMessage(String text) throws Exception 

                                    { 

                                        QueueSender sender = session.createSender(queue); 

                                         ObjectMessage message = session.createObjectMessage(text); 

                                         sender.send(message); 

                                         sender.close(); 

                                    } 

                                 

                                   

                                    public static void main(String[] args) throws Exception 

                                    { 

                                        WebServiceConsumer1Client client = new WebServiceConsumer1Client(); 

                                        client.setupConnection(); 

                                       

                                        client.sendAMessage("* 2.0 2.0");

                                        client.stop(); 

                                    } 

             

            }

             

            "

            can we write the client code using C + + instead of JAVA?

            • 4. Re: Client code can be written with C++?
              Tom Cunningham Master

              I don't see why not.