This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes can any one give  me the solution ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "can any one give  me the solution ..." Watch "can any one give  me the solution ..." New topic
Author

can any one give me the solution ...

Anjana Chowdary
Greenhorn

Joined: Oct 25, 2005
Posts: 8
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

Joined: Jun 08, 2004
Posts: 177
I think you should also add your Database driver to webserver to.
Axis try to compile it and it doesn't find database driver.


Reza
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can any one give me the solution ...
 
Similar Threads
Can you develop a Stubs class from local WSDD
deployment question
msg=No Deserializer found to deserialize a ':return'
de/serializers for ArrayLists
WSDP and AXIS