Dear All,
I am getting the above exception java.lang.reflect.UndeclaredThrowableException in my client program.
java.lang.reflect.UndeclaredThrowableException
at $Proxy0.echo(Unknown Source)
at com.ss.Client.main(Client.java:41)
Caused by: java.rmi.RemoteException: Call invocation failed; nested exception is:
java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
at org.jboss.ws.core.jaxrpc.client.CallImpl.invokeInternal(CallImpl.java:536)
at org.jboss.ws.core.jaxrpc.client.CallImpl.invoke(CallImpl.java:277)
at org.jboss.ws.core.jaxrpc.client.PortProxy.invoke(PortProxy.java:156)
... 2 more
Caused by: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
at javax.xml.soap.SOAPMessage.setProperty(Unknown Source)
at org.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:83)
at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:171)
at org.jboss.ws.core.CommonSOAP11Binding.createMessage(CommonSOAP11Binding.java:59)
at org.jboss.ws.core.CommonSOAPBinding.bindRequestMessage(CommonSOAPBinding.java:158)
at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:291)
at org.jboss.ws.core.jaxrpc.client.CallImpl.invokeInternal(CallImpl.java:517)
... 4 more
My Coding is as follows:
Client.java:
-------------
package com.ss;
import java.net.URL;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceFactory;
public class Client {
/**
* @param args
*/
public static void main(
String[] args) {
// TODO Auto-generated method stub
try{
URL url = new URL("http://127.0.0.1:8080/TestWebServiceEAR-TestWebService/WSBean?wsdl");
QName qname = new QName("http://ss.com/","WSBeanService");
System.out.println("Creating a service Using: \n\t"
+ url + " \n\tand " + qname);
ServiceFactory factory = ServiceFactory.newInstance();
Service remote = factory.createService(url, qname);
/*Call c=remote.createCall(new QName("http://abc.org/","WebSPort"));
c.setTargetEndpointAddress("http://127.0.0.1:8080/WSEAR-WS/WebS?wsdl");*/
System.out.println("Obtaining reference to a proxy object");
WSBeanRemote proxy = (WSBeanRemote) remote.getPort(WSBeanRemote.class);
System.out.println("Accessed local proxy: " +proxy);
String string = "John";
System.out.println("Sending: " + string+"calling web service :");
proxy.echo(string);
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
}
WSBean.java:
----------------
package com.ss;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
/**
* Session Bean implementation class WSBean
*/
@Stateless
@WebService
@SOAPBinding(style = SOAPBinding.Style.RPC)
@Remote(WSBeanRemote.class)
public class WSBean implements WSBeanRemote {
/**
* Default constructor.
*/
public WSBean() {
// TODO Auto-generated constructor stub
}
@WebMethod
public String echo(String input)
{
System.out.println("inside echo method"+input);
return "sjdgfjsgdf"+input;
}
}
WSBeanRemote.java:
-------------------------
package com.ss;
import java.rmi.Remote;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@WebService
@SOAPBinding(style=Style.RPC)
public interface WSBeanRemote extends Remote{
@WebMethod
public String echo(String input);
}
I have been strucked in this for two days.Please help.
Thanks in Advance.