Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

java.lang.reflect.UndeclaredThrowableException in JBOSS with EJB 3 as a web service

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this
 
Sowjanya Venkiteela
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You Jaikiran,

My problem is resolved.

This is Bottom Up Approach where we are exposing EJB as a web service.

But,I want to know the Top Down Approach where I had a WSDL and I want to generate EJB classes.

Please provide necessary information.

Thanks in advance.

 
Ranch Hand
Posts: 101
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Jaikiran that link is broken. Can you please provide a detailed solution. Someone is having a really tough time here.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Oladeji Oluwasayo wrote:@Jaikiran that link is broken. Can you please provide a detailed solution. Someone is having a really tough time here.



I've updated my previous post in this thread to contain the working link. Also, here's another discussion about this issue https://coderanch.com/t/91307/JBoss/JBoss-EJB-Webservices
 
Nothing up my sleeve ... and ... presto! A tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic