|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
java compute code |
« View previous topic :: View next topic » |
Author |
Message
|
mehdi_b_y |
Posted: Thu Jun 15, 2006 3:20 am Post subject: java compute code |
|
|
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 |
|
 |
mehdi_b_y |
Posted: Thu Jun 15, 2006 3:24 am Post subject: Re: java compute code |
|
|
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 |
|
 |
elvis_gn |
Posted: Thu Jun 15, 2006 4:13 am Post subject: |
|
|
 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 |
|
 |
mehdi_b_y |
Posted: Thu Jun 15, 2006 4:44 am Post subject: |
|
|
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 |
|
 |
elvis_gn |
Posted: Thu Jun 15, 2006 4:57 am Post subject: |
|
|
 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 |
|
 |
jefflowrey |
Posted: Thu Jun 15, 2006 7:24 am Post subject: |
|
|
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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|