questions while creating webservice
anny_lut Jul 23, 2008 8:06 AM1. I have jboss 321 = tomcat + axis
2. Have deployed EJB rbank.ear wuth such clasess
org.rbank.ejb.bean.RBankBean
org.rbank.ejb.interfaces.RBank
org.rbank.ejb.interfaces.RBankHome
3. Write rbank.wsdd to deploy webservice
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"> <service name="rbank" provider = "java:EJB"> <parameter name="beanJndiName" value = "RBank" /> <parameter name="className" value="org.rbank.ejb.interfaces.RBank"/> <parameter name="homeInterfaceName" value = "org.rbank.ejb.interfaces.RBankHome" /> <parameter name="remoteInterfaceName" value = "org.rbank.ejb.interfaces.RBank"/> <parameter name="jndiContextClass" value = "org.jnp.interfaces.NamingContextFactory" /> <parameter name="jndiURL" value = "jnp://localhost:8080" /> <parameter name="allowedMethods" value = "*" /> </service> </deployment>
4. Deploy this wsdd with command
java org.apache.axis.client.AdminClient rbank.wsdd
5. Copy all needed classes to jboss.net\server\all\deploy\axis.war\WEB-INF\classes\
6. Test my se4rvice throuth http://localhost:8080/axis/services
I see my service
But when I try to see WSDL - I get an error
Fault - WSDLException: faultCode=OTHER_ERROR: Can't find prefix for 'http://www.w3.org/1999/XMLSchema'. Namespace prefixes must be set on the Definition object using the addNamespace(...) method.:
AxisFault
faultCode: {http://xml.apache.org/axis/}Server.userException
faultString: WSDLException: faultCode=OTHER_ERROR: Can't find prefix for 'http://www.w3.org/1999/XMLSchema'. Namespace prefixes must be set on the Definition object using the addNamespace(...) method.:
faultActor: null
faultDetail:
7. I wrote simple client test
import java.net.URL;
import org.apache.axis.client.Service;
import org.apache.axis.client.Call;
import org.apache.axis.encoding.XMLType;
import javax.xml.rpc.ParameterMode;
import javax.xml.namespace.QName;
public class testwebservice
{
public static void main(String args[]){
try{
String serviceName = "rbank";
String url = "http://localhost:8080/axis/services/rbank";
String method = "getTest";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress ( url);
call.setOperationName ( new QName( serviceName,method));
call.addParameter("sTestMessage", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
Object[] params = new Object[] { args[0] };
String s = (String) call.invoke(params);
}catch(Exception e1) {
System.out.println(""+e1);
}
}
}
But in service.log I see an errors:
[org.jnp.interfaces.NamingContext] Failed to connect to localhost:8080 javax.naming.CommunicationException: Failed to retrieve stub from server localhost:8080 [Root exception is java.io.EOFException] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:210)
can anybody help with this questions