mercredi 29 juin 2016

Unable to capture Axis2 SOAP service exception

I created a SOAP web service client using eclipse Luna & Java 7 to call a service sits on a Windows server in my network. This is my 1st time and I all figured and made it work fine. Problem happens when I used build.mxl and created the jar via Ant and deploy it on AS/400 IFS folder to run as standalone java application. Somehow, when I try to instantiate the service stub the log4j logging and everything stops and program terminates with code 0. Below is the code snippet where it stops.

public  void testsubmitTransactionXml() {
            SOAPFaultBuilder.captureStackTrace=true;

            AS400 system = null;
            try {
                system = EDAServiceUtil.getAS400();
            } catch (Exception e1) {
                log.info("ERROR connecting to AS400: "+e1.getMessage());
                e1.printStackTrace();
            }
            try {**log.info("before stub...");**
            org.tempuri.EnterpriseDataAdapterServiceStub stub =
                        new org.tempuri.EnterpriseDataAdapterServiceStub();//the default implementation should point to the right endpoint

                String xmlFile = "";  
**log.info("after stub...");**
...
//PAY ATTENTION HERE--> trying to capture  SOAPFaultException below
//} catch (javax.xml.rpc.soap.SOAPFaultException af) {log.info("Fault Exception..error captured!!!");af.printStackTrace();
} catch (java.rmi.RemoteException ex) {log.error("error...");
            ex.printStackTrace();
            } catch (Exception e) {
                log.info("ERROR calling the service: "+e.getMessage());
                e.printStackTrace();
            } 

And the mysterious part is when activate the line of code to capture SOAPFaultException then logging in this class stops completely without any notice and I get nothing, not even info before the stub instantiate...

I only included the JAR file in lib folder of my deployment, did not include any Axis2 related stuff thinking the JAR has it all??. I only included necessary JARs for AS/400 stuff. enter image description here

And Here is my shell (I tried 32 and/or 64 bit which did not matter):

echo --- Setting CLASSPATH variable for a process

CP=/QIBM/ProdData/aerodata/EDAService/lib:/QIBM/ProdData/aerodata/EDAService/lib/EnterpriseDataAdapterService-test-client.jar:/QIBM/ProdData/aerodata/EDAService/lib/log4j-1.2.15.jar:/QIBM/ProdData/aerodata/EDAService/lib/jt400.jar:/QIBM/ProdData/aerodata/EDAService/lib/mail.jar:/QIBM/ProdData/aerodata/EDAService/lib/activation.jar: export -s CLASSPATH=$CP

echo Using CLASSPATH: $CP

/QOpenSys/QIBM/ProdData/JavaVM/jdk71/32bit/jre/bin/java org.tempuri.CallService

echo -- done!!! exit

I appreciate your help a lot since I am so stuck! BTW, I tried to give as much detail about environment which some may possibly irrelevant. Thanks again!

Aucun commentaire:

Enregistrer un commentaire