Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can any one give me the solution ...

 
Anjana Chowdary
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi There!!!

I am working on Apache Axis. I wrote some sample web service program which peforms the database select and prints the result set data. Here it is the service program..

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.ResultSetMetaData;

class DbTest {

private static final String SELECT_USER_DETAILS_QUERY ="SELECT FIRST_NAME, COMPANY_NAME,COMPNAY NAME,EMAIL_ADDRESS FROM USER_REGISTRATION WHERE USER_ID=? ";
Statement stmt = null;
ResultSet rs = null;
Connection dbConnection = null;
PreparedStatement pStmtSelect = null;


public void getUserDetails(int userId) throws Exception{
try {
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
dbConnection =

DriverManager.getConnection("jdbc:mysql://xxx/testdrvdb?user=fcrs-user&password=fcrs");
pStmtSelect = dbConnection.prepareStatement(SELECT_USER_DETAILS_QUERY);
pStmtSelect.setInt(1, userId);
rs = pStmtSelect.executeQuery();
ResultSetMetaData rm = rs.getMetaData();
int cols = rm.getColumnCount();

for(int i=1; i<=cols; i++)
{
System.out.print(rm.getColumnLabel(i) + "\t");
}
System.out.println("\n");
while(rs.next())
{
String FirstName = rs.getString(1);
String CompanyName = rs.getString(2);
String EmailAddress = rs.getString (3);
System.out.println(FirstName + "\t" + CompanyName + "\t" + EmailAddress );
}
rs.close();
pStmtSelect.close();
dbConnection .close();

} catch (Exception e) {
e.printStackTrace();
} finally {
if (pStmtSelect != null) {
pStmtSelect.close();
}
}
}
}

After this I am trying out the following out steps....

1)Compile the sources: Run command javac *.java.
2)Copy the class files: Copy class files AddFunction1.class, Complex.class and LogHandler.class to the class directory of Axis Servlet (usually %TOMCAT_HOME%\webapps\axis\WEB-INF\classes.
3)Deploy the service: Run command java org.apache.axis.client.AdminClient deploy.wsdd
4)Test the deployment: Point your browser to the WSDL URL http://localhost:8080/axis/services/DbTestService?wsdl and examine the returned WSDL.

Deployment Descriptor(WSDD)---

<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

<handler name="print" type="java:LogHandler"/>

<service name="DbTestService" provider="java:RPC">
<requestFlow>
<handler type="print"/>
</requestFlow>
<parameter name="className" value="DbTest"/>
<parameter name="allowedMethods" value="*"/>

</service>

</deployment>


Every thing has gone fine but in 4 step i am getting the following error ....



AXIS error
Sorry, something seems to have gone wrong... here are the details:

Fault - Failed to determine deployed service names.; nested exception is:
org.apache.axis.ConfigurationException: Could not find class for the service named: getUserDetails
Hint: you may need to copy your class files/tree into the right location (which depends on the servlet system you are using).; nested exception is:
java.lang.ClassNotFoundException: getUserDetails
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: Could not find class for the service named: getUserDetails
Hint: you may need to copy your class files/tree into the right location (which depends on the servlet system you are using).; nested exception is:
java.lang.ClassNotFoundException: getUserDetails
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:Jupiter

Could not find class for the service named: getUserDetails
Hint: you may need to copy your class files/tree into the right location (which depends on the servlet system you are using).; nested exception is:
java.lang.ClassNotFoundException: getUserDetails
at org.apache.axis.providers.java.JavaProvider.getServiceClass(JavaProvider.java:432)
at org.apache.axis.providers.java.JavaProvider.initServiceDesc(JavaProvider.java:461)
at org.apache.axis.handlers.soap.SOAPService.getInitializedServiceDesc(SOAPService.java:286)
at org.apache.axis.deployment.wsdd.WSDDService.makeNewInstance(WSDDService.java:500)
at org.apache.axis.deployment.wsdd.WSDDDeployment.getDeployedServices(WSDDDeployment.java:503)
at org.apache.axis.configuration.FileProvider.getDeployedServices(FileProvider.java:296)
at org.apache.axis.transport.http.QSWSDLHandler.getDeployedServiceNames(QSWSDLHandler.java:218)
at org.apache.axis.transport.http.QSWSDLHandler.updateSoapAddressLocationURLs
...........


Could any one give me the why Axis unable to create WSDL for my service program???

I am also including client program here, so have a look at this..

public class DbClient
{
public static void main(String [] args) {
try {
int userId=1001;
localhost.axis.services.DbTest.DbTest afs = new localhost.axis.services.DbTest.DbTestServiceLocator();
localhost.axis.services.DbTestService.DbTest af = afs.getDbTestService();
af.getuserDetails(userId);
} catch (Exception e) {
System.err.println("Execution failed. Exception: " + e);
}
}
}


waiting for reply...
Thanks in advance..

-Anjana

[ September 01, 2006: Message edited by: Anjana Chowdary ]
[ September 01, 2006: Message edited by: Anjana Chowdary ]
 
Reza Ravasizadeh
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you should also add your Database driver to webserver to.
Axis try to compile it and it doesn't find database driver.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic