Hi All,
I have developed Simple webservice and Iam generarting the Client .In that
client iam calling the service then iam getting the error....
Error:--------------------------
Exception in thread "main" org.codehaus.xfire.XFireRuntimeException: Could
not invoke service.. Nested exception is
org.codehaus.xfire.fault.XFireFault: java.lang.InstantiationException:
com.simple.Simple
org.codehaus.xfire.fault.XFireFault: java.lang.InstantiationException:
com.simple.Simple
at
org.codehaus.xfire.fault.Soap11FaultSerializer.readMessage(Soap11FaultSerializer.java:31)
at
org.codehaus.xfire.fault.SoapFaultSerializer.readMessage(SoapFaultSerializer.java:28)
at
org.codehaus.xfire.soap.handler.ReadHeadersHandler.checkForFault(ReadHeadersHandler.java:111)
at
org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke(ReadHeadersHandler.java:67)
at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Client.onReceive(Client.java:406)
at
org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)
at
org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
at
org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
at org.codehaus.xfire.client.Client.invoke(Client.java:336)
at
org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
at $Proxy8.setName(Unknown Source)
at com.simple.SimpleServiceClient.main(SimpleServiceClient.java:105)
This is My Client Code------------------------------
package com.simple;
import java.net.MalformedURLException;
import java.util.Collection;
import java.util.HashMap;
import javax.xml.namespace.QName;
import org.codehaus.xfire.XFireRuntimeException;
import org.codehaus.xfire.aegis.AegisBindingProvider;
import org.codehaus.xfire.annotations.AnnotationServiceFactory;
import org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.jaxb2.JaxbTypeRegistry;
import org.codehaus.xfire.service.Endpoint;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.soap.AbstractSoapBinding;
import org.codehaus.xfire.transport.TransportManager;
public class SimpleServiceClient {
private static XFireProxyFactory proxyFactory = new XFireProxyFactory();
private HashMap endpoints = new HashMap();
private Service service0;
public SimpleServiceClient() {
create0();
Endpoint SimpleLocalEndpointEP = service0 .addEndpoint(new
QName("http://simple.com", "SimpleLocalEndpoint"), new
QName("http://simple.com", "SimpleLocalBinding"),
"xfire.local://SimpleService");
endpoints.put(new QName("http://simple.com", "SimpleLocalEndpoint"),
SimpleLocalEndpointEP);
Endpoint SimpleEP = service0 .addEndpoint(new
QName("http://simple.com", "Simple"), new QName("http://simple.com",
"SimpleSoapBinding"), "http://localhost:8083/Simple/services/Simple");
endpoints.put(new QName("http://simple.com", "Simple"), SimpleEP);
}
public Object getEndpoint(Endpoint endpoint) {
try {
return proxyFactory.create((endpoint).getBinding(),
(endpoint).getUrl());
} catch (MalformedURLException e) {
throw new XFireRuntimeException("Invalid URL", e);
}
}
public Object getEndpoint(QName name) {
Endpoint endpoint = ((Endpoint) endpoints.get((name)));
if ((endpoint) == null) {
throw new IllegalStateException("No such endpoint!");
}
return getEndpoint((endpoint));
}
public Collection getEndpoints() {
return endpoints.values();
}
private void create0() {
System.out.println("Create0");
TransportManager tm =
(org.codehaus.xfire.XFireFactory.newInstance().getXFire().getTransportManager());
HashMap props = new HashMap();
props.put("annotations.allow.interface", true);
System.out.println("HashMap Size"+props.size());
AnnotationServiceFactory asf = new AnnotationServiceFactory(new
Jsr181WebAnnotations(), tm, new AegisBindingProvider(new
JaxbTypeRegistry()));
asf.setBindingCreationEnabled(false);
service0 = asf.create((com.simple.Simple.class), props);
{
System.out.println("In Side");
AbstractSoapBinding soapBinding =
asf.createSoap11Binding(service0,
new QName("http://simple.com", "SimpleLocalBinding"),
"urn:xfire:transport:local");
}
{
System.out.println("Out Side");
AbstractSoapBinding soapBinding =
asf.createSoap11Binding(service0, new QName("http://simple.com",
"SimpleSoapBinding"), "http://schemas.xmlsoap.org/soap/http");
System.out.println(soapBinding.getName());
}
}
public Simple getSimpleLocalEndpoint() {
return ((Simple)(this).getEndpoint(new QName("http://simple.com",
"SimpleLocalEndpoint")));
}
public Simple getSimpleLocalEndpoint(String url) {
Simple var = getSimpleLocalEndpoint();
org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);
return var;
}
public Simple getSimple() {
return ((Simple)(this).getEndpoint(new QName("http://simple.com",
"Simple")));
}
public Simple getSimple(String url) {
Simple var = getSimple();
org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);
return var;
}
public static void main(String[] args) {
SimpleServiceClient client = new SimpleServiceClient();
//create a default service endpoint
Simple service = client.getSimple();
//TODO: Add custom client code here
//
//service.yourServiceOperationHere();
service.setName("Simple");
System.out.println("test client completed");
System.exit(0);
}
}
Here is my Simple.java------
package com.simple;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
@WebService(name = "Simple", targetNamespace = "http://simple.com")
@SOAPBinding(use = SOAPBinding.Use.LITERAL, parameterStyle =
SOAPBinding.ParameterStyle.WRAPPED)
public interface Simple {
@WebMethod(operationName = "getName", action = "")
@WebResult(name = "getNameReturn", targetNamespace =
"http://simple.com")
public String getName();
@WebMethod(operationName = "setName", action = "setNameRequest")
public void setName(
@WebParam(name = "name", targetNamespace = "http://simple.com")
String name);
}
Please anybody have idea please advice me........................
--
View this message in context:
http://www.nabble.com/XFireFault-Exception-when-Running-Simple-Webservice-Exceptions-tp14994513p14994513.html
Sent from the XFire - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email