|
'llo,
I
have a webservice on Axis, which has two methods. I' ve added a method to
samples/userguide/example3.
One
of them has calling the database; second - just returns the
string.
When
I call first method - it
throws java.lang.reflect.InvocationTargetException.
The
second one works.
Does
anybody meet this problem
before?
Thanks,
Ghena.
this
is the webservice:
import
java.sql.*;
public
class WebService
{ public String serviceMethod(String arg) { return "WebService: you typed - " + arg; }
public String findAccountby(String fieldValue)
{ try { DriverManager.registerDriver(new com.inet.tds.TdsDriver()); Connection conn = DriverManager.getConnection("jdbc:inetdae:sigma:?database=air_database","vbank_user","vbank_passwd"); String aQuery = "select id from account where firstname = ?"; System.out.println("query=" + aQuery); PreparedStatement state = conn.prepareStatement(aQuery); state.setObject(1, fieldValue); ResultSet rs = state.executeQuery(); if (rs.next()) { String s = rs.getString("id");
return ("id = " + s);
} else { return ("The query is empty!"); }
}
catch (Exception nExcep) { return nExcep.toString();
}
} this
is the client:
import
org.apache.axis.client.Call;
import org.apache.axis.client.Service; import org.apache.axis.encoding.XMLType; import org.apache.axis.utils.Options; public
class TestClient
{ public static void main(String [] args) { try { Options options = new Options(args); String endpointURL = options.getURL(); String textToSend; args = options.getRemainingArgs(); if ((args == null) || (args.length < 1)) { textToSend = "<nothing>"; } else { textToSend = args[0]; } Service service = new Service(); Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpointURL)
);
call.setOperationName("findAccountby");//"serviceMethod" ); call.setProperty( Call.NAMESPACE, "WebService" ); call.addParameter( "arg1", XMLType.XSD_STRING, Call.PARAM_MODE_IN);
String result = (String) call.invoke( new Object[] { textToSend }
);
System.out.println(result); } catch (Exception e) { System.err.println(e.toString()); } } } |
- RE: java.lang.reflect.InvocationTargetException Ghenadie Dumanov
- RE: java.lang.reflect.InvocationTargetException Venkat Dokiparthi
- java.lang.reflect.InvocationTargetException Nightingale, Martin
- java.lang.reflect.InvocationTargetException Nightingale, Martin
- java.lang.reflect.InvocationTargetException Iv�n Escobedo
- RE: java.lang.reflect.InvocationTargetException Vidyanand Murunikkara
- RE: java.lang.reflect.InvocationTargetException Iv�n Escobedo
- java.lang.reflect.InvocationTargetException Agarwal, Naresh
- java.lang.reflect.InvocationTargetException Harsh Nagpal
- java.lang.reflect.InvocationTargetException Srinivas Vemula
- Re: java.lang.reflect.InvocationTargetExcep... Thorsten Jungblut
