You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Jerzy Kut <je...@rzeszow.tiger.com.pl> on 2002/03/05 14:25:17 UTC
oracle exception in my own soap service
Hi!
I have got:
- tomcat4.0.2
- soap2.2
- linux2.4.3 redhat6.2
I wrote simple application that uses oracle database.
SOAP and ORACLE are on same machine.
My service is declared as:
public class DBService {
public DBService() {}
public String doQuery(String input) {
String result = "GRUPA\t" + "OPIS\n";
// some code works with oracle and fill in result
return (result);
}
public static void main(String[] args) {
DBService service = new DBService();
String result = service.doQuery("jerzyk");
System.out.println(result);
}
}
Service is deployed as:
'DBService' Service Deployment Descriptor
ID: DBService
Scope: Application
Provider Type: java
Provider Class: DBService
Use Static Class: false
Methods: doQuery
and Client is defined as:
public class DBClient
{
public static void main(String[] args) throws Exception
{
try
{
URL url = new URL("http://localhost:8080/soap/servlet/rpcrouter");
String name = "jerzyk";
// Build the call.
Call call = new Call();
call.setTargetObjectURI("DBService");
call.setMethodName("doQuery");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector params = new Vector();
params.addElement(new Parameter("input", String.class, name,
null));
call.setParams(params);
// Invoke the call.
Response resp = null;
try
{
resp = call.invoke(url, null);
}
catch( SOAPException e )
{
System.err.println("Caught SOAPException (" + e.getFaultCode() +
"): " + e.getMessage());
System.exit(-1);
}
// Check the response.
if( !resp.generatedFault() )
{
Parameter ret = resp.getReturnValue();
Object value = ret.getValue();
System.out.println(value);
}
else
{
Fault fault = resp.getFault();
System.err.println("Generated fault: ");
System.out.println (" Fault Code = " +
fault.getFaultCode());
System.out.println (" Fault String = " +
fault.getFaultString());
System.out.println (" Fault Entries = " +
fault.getFaultEntries());
System.out.println (" Fault URI = " +
fault.getFaultActorURI());
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
My service works correctly when I try to run it from shell by:
$java DBService
but it didn't when I call it from shell by:
$java DBClient
It throws:
Generated fault:
Fault Code = SOAP-ENV:Server
Fault String = Exception from service object:
oracle/jdbc/driver/OracleDriver
Fault Entries = null
Fault URI = /soap/servlet/rpcrouter
I have got oracle driver classes12.zip and I have got set
CLASSPATH=path/to/oracle/driver/classes12.zip
Where is reason?
Best regards
Jerzy Kut