cancel
Showing results for 
Search instead for 
Did you mean: 

invocation bean method exposed as webservice

Former Member
0 Kudos

Hi All,

I created a webservice in NWDS 7.0 Sp 12. I made 3 methods and exposed the bean as a webservice. I can find my webservice with the webservice navigator in the NWDS. I can test it.

I made one simple method which only return a string. I get the right response.

But when I try to access another method which make a connection to SApP via SAP JCo, I get the error Exception in method <methodname>. No further information is given. Does anybody know how to see the complete error?

This is the code of my method:

try {

if(pdfSource != null || !pdfSource.equalsIgnoreCase("")){

xmlData = extractDataFromPDF(pdfSource);

}

} catch(Exception e){

System.out.println(e.getMessage());

throw new EJBException(e.getMessage());

}

String result="";

//Create Connection

JCO.Client clientConn = clientConn = JCO.createClient("400", // SAP client

"<userid>", // userid

"<password", // password

"NE", // language (null for the default language)

"<ip to as>", // application server host name

"02"); // system number

try{

//open connection

clientConn.connect();

result = clientConn.getClient();

}catch(Exception e){

throw new EJBException(e.getMessage());

}

finally{

clientConn.disconnect();

}

return result;

What can be wrong in teh above method?? What I also tried is accessing the webservice via WebDynpro Java. When I execute the method I get this error:

Exception on execution of web service with WSDL URL 'http://nlsap13:50200/PDFToSAPWS/Config2?wsdl' with operation 'sendDataToSAP' in interface 'PDFToSAPVI_Document'

Any help I appreciate very much.

Sandhya

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

There are methods to know the exception that has occured. Since you say the method calling the JCo has an exception, then catch the relevant exception. You are catching the generic Exception class and throwing an EJB exception. It would be easy if u first read the correct exception and then throw. U may use e.getStackTrace/printstacktrace and log it too (getCause()).

Throw a generic runtimeexception and it will show up. Be more specific in catching your exception. JCo client will throw exceptions and you catch only that is in the java doc.

in

catch(TheCheckedException e)

{

throw new RuntimeException("message", e);

}

or else swallow the exception (bad practice) and use e.getStackTrace(); and find the line number. (Java does it by default).

regards

LNV

Edited by: vln on Feb 14, 2008 12:40 PM

Former Member
0 Kudos

Hello Sandhya,

There could be multiple reasons for your issue like your ejbs may not be finding required jar files(JCO jars) and logon credentials can be wrong.

i hope u maintained the reference of JCO jars in your ear file.

if you expose it as web service you will not find complete exception/stack trace.instead i will recommend you to write a EJB client(simple java class) which on your machine and calls your method.if there is any exception in ejb method,that stack stace can be display in your EJB client.

hope this helps to debug your problem

With Regards,

Naidu

Former Member
0 Kudos

Hi,

Thankyou for your answer.

I made a WEBmodule project to use the bean. I made a simple Java class. But how should I access the bean??

Kind regards, Sandhya