ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » java compute code

Post new topic  Reply to topic
 java compute code « View previous topic :: View next topic » 
Author Message
mehdi_b_y
PostPosted: Thu Jun 15, 2006 3:20 am    Post subject: java compute code Reply with quote

Novice

Joined: 11 Jun 2006
Posts: 12

hi all,

this is my code in the java compute node
but I have a problem to invoke a service web
into this code :
Code:
public class VerificationStock_JavaCompute extends MbJavaComputeNode {

   public void evaluate(MbMessageAssembly assembly) throws MbException {

      MbOutputTerminal out = getOutputTerminal("out");
      MbOutputTerminal alt = getOutputTerminal("alternate");
      boolean test=false;
      MbMessage message = assembly.getMessage();

      elm=message.getRootElement().getLastChild().getFirstChild();
      String arg1=elm.getValue();
      elm.getNextSibling();
      String arg2=elm.getValue();
      test = this.traitement(arg1,arg2);
      
      if(test)
         out.propagate(assembly);
      else
         alt.propagate(assembly);
   }
   
   public  boolean traitement(String article,String quantite){
      
      boolean   existe=false;
      
      String endpoint = "http://localhost:8080/axis/Stock.jws";
      Service  service = new Service();
       Call     call;
      try {
         call = (Call) service.createCall();
         try {
            call.setTargetEndpointAddress(new java.net.URL(endpoint));
         } catch (MalformedURLException e1) {
            // TODO Bloc catch auto-généré
            e1.printStackTrace();
         }
         String param1=new String(article);
         String param2=new String(quantite);
          call.setOperationName( "testStock" );
          call.addParameter("op1", XMLType.XSD_STRING, ParameterMode.IN);
          call.addParameter("op2", XMLType.XSD_STRING, ParameterMode.IN);
          call.setReturnType(XMLType.XSD_STRING);
          try {
            String ret =(String)call.invoke( new Object [] { param1, param2 });
            if(ret.equals("oui"))
               existe=true;
         } catch (RemoteException e2) {
            // TODO Bloc catch auto-généré
            e2.printStackTrace();
         }
      } catch (ServiceException e) {
         // TODO Bloc catch auto-généré
         e.printStackTrace();
      }
      

      
      return existe;
   }
}


I need your help

thanks.
Back to top
View user's profile Send private message
mehdi_b_y
PostPosted: Thu Jun 15, 2006 3:24 am    Post subject: Re: java compute code Reply with quote

Novice

Joined: 11 Jun 2006
Posts: 12

mehdi_b_y wrote:
hi all,

this is my code in the java compute node
but I have a problem to invoke a service web
into this code :
Code:
public class VerificationStock_JavaCompute extends MbJavaComputeNode {

   public void evaluate(MbMessageAssembly assembly) throws MbException {

      MbOutputTerminal out = getOutputTerminal("out");
      MbOutputTerminal alt = getOutputTerminal("alternate");
      boolean test=false;
      MbMessage message = assembly.getMessage();

      elm=message.getRootElement().getLastChild().getFirstChild();
      String arg1=elm.getValue();
      elm.getNextSibling();
      String arg2=elm.getValue();
      test = this.traitement(arg1,arg2);
      
      if(test)
         out.propagate(assembly);
      else
         alt.propagate(assembly);
   }
   
   public  boolean traitement(String article,String quantite){
      
      boolean   existe=false;
      
      String endpoint = "http://localhost:8080/axis/Stock.jws";
      Service  service = new Service();
       Call     call;
      try {
         call = (Call) service.createCall();
         try {
            call.setTargetEndpointAddress(new java.net.URL(endpoint));
         } catch (MalformedURLException e1) {
            // TODO Bloc catch auto-généré
            e1.printStackTrace();
         }
         String param1=new String(article);
         String param2=new String(quantite);
          call.setOperationName( "testStock" );
          call.addParameter("op1", XMLType.XSD_STRING, ParameterMode.IN);
          call.addParameter("op2", XMLType.XSD_STRING, ParameterMode.IN);
          call.setReturnType(XMLType.XSD_STRING);
          try {
            String ret =(String)call.invoke( new Object [] { param1, param2 });
            if(ret.equals("oui"))
               existe=true;
         } catch (RemoteException e2) {
            // TODO Bloc catch auto-généré
            e2.printStackTrace();
         }
      } catch (ServiceException e) {
         // TODO Bloc catch auto-généré
         e.printStackTrace();
      }
      

      
      return existe;
   }
}


I need your help

thanks.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Thu Jun 15, 2006 4:13 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi mehdi_b_y,

What is the error ?

Or what is happening in the code during debug...is anything being returned or the service in not getting called at all...

Regards.
Back to top
View user's profile Send private message Send e-mail
mehdi_b_y
PostPosted: Thu Jun 15, 2006 4:44 am    Post subject: Reply with quote

Novice

Joined: 11 Jun 2006
Posts: 12

Hi elvis_gn,

I can't debug my message flow because the jvm port is not opened.
the result of the execution is always going in the fail queue.
when I tested the flow without web service,it work excellent.
I'm sure that the invocation of the web service is the essential reason
of this fail.

thanks.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Thu Jun 15, 2006 4:57 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi mehdi_b_y,

mehdi_b_y wrote:
I can't debug my message flow because the jvm port is not opened.

Quote:
Configure the environment to enable debugging of Java plug-in nodes.

1. Set the debug port number (any unused port) for the JVM in the broker by running the following command:
mqsichangeproperties BROKER_NAME -e EXECUTIONGROUPNAME -o ComIbmJVMManager -n jvmDebugPort -v PORTNUMBER
2. Restart the broker. Ensure that your JVM debug port has been correctly set by running the following DOS command: netstat --a, inspect the output and verify that the specified port is "LISTENING".


Test and tell us the error...or atleast the failure exceptionlist.

Regards.
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Thu Jun 15, 2006 7:24 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Look in the system log. You will see information about the exception that the Java code has thrown.

Enable usertrace. Look at the trace log. You will see information about the exception.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » java compute code
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.