[JBossWS] - Ejb3.0 Stateless session bean as webservice in jboss4.2.2
by HTCPrasad
I had created three files like
SimpleWS.java
package com.htc.htcws;
import javax.jws.WebService;
import javax.jws.WebMethod;
import java.rmi.Remote;
import java.rmi.RemoteException;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@WebService
@SOAPBinding(style=Style.RPC)
public interface SimpleWS extends Remote
{
@WebMethod
public String greet(String person)
throws RemoteException;
}
SimpleWSBean.java
package com.htc.htcws;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@Stateless
@Remote(SimpleWS.class)
@WebService(endpointInterface="com.htc.htcws.SimpleWS")
@SOAPBinding(style=SOAPBinding.Style.RPC)
public class SimpleWSBean implements SimpleWS
{
@WebMethod
public String greet(String person)
{
return "Hi "+person+" all Good Wishes for Tamil New Year's Day";
}
}
SimpleWSClient.java
package com.htc.htcws;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.Service;
import javax.xml.namespace.QName;
import java.net.URL;
import org.apache.log4j.Logger;
import org.apache.log4j.FileAppender;
import org.apache.log4j.HTMLLayout;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service.Mode;
import javax.xml.ws.Response;
import java.io.StringReader;
public class SimpleWSClient
{
static Logger logger;
public static void main(String[] args)
{
final String _NAMESPACE = "http://htcws.htc.com/";
final String _SERVICE = "SimpleWSBeanService";
try
{
logger = Logger.getRootLogger();
logger.addAppender(new FileAppender(new HTMLLayout(),
"mylog1.log",true));
URL url =
new URL("http://127.0.0.1:10080/simpws/SimpleWSBean?wsdl");
QName qName = new QName(_NAMESPACE,_SERVICE);
if(args.length!=1)
{
System.out.print("Give the person-name as args[0]");
System.exit(1);
}
ServiceFactory sFactory = ServiceFactory.newInstance();
Service service = sFactory.createService(url,qName);
System.out.println(".."+service);
SimpleWS invoker =
(SimpleWS)service.getPort(SimpleWS.class);
System.out.println("##"+invoker);
String res = invoker.greet(args[0]);
System.out.println("Response is::"+res);
}
catch(Exception ex)
{
System.err.println("Caught the exception as"+ex);
}
}
}
the bean getting deployed.but whie running client the error is
java:
[java] ..org.jboss.ws.core.jaxrpc.client.ServiceImpl@b8c8e6
[java] ##org.jboss.ws.core.jaxrpc.client.CallImpl@1542a75
[java] Caught the exception asjava.rmi.RemoteException: Call invocation failed; nested exception is:
[java] java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
My os is windows vistas ,browser is firefox beta4.0
can you please suggest where the error is or how to use Dispatch,Response objects here
mail is dtrprasad(a)gmail.com
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4139926#4139926
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4139926
16 years, 9 months
[JBossWS] - Re: Deployment failure
by whitexos12
"kk1107" wrote : Please let me know how did you solve this problem. I am facing similar problem. thanks
|
| ~Samy
I too am getting the same error can someone please tell how to solve this issue it's very important any help is appreciated.
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of
| IllegalAnnotationExceptions
| java.util.List is an interface, and JAXB can't handle interfaces.
| this problem is related to the following location:
| at java.util.List
| java.util.List does not have a no-arg default constructor.
| this problem is related to the following location:
| at java.util.List
|
| at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check
| (IllegalAnnotationsException.java:102)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4139873#4139873
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4139873
16 years, 9 months
[JBossWS] - Re: Deployment failure
by whitexos12
"kk1107" wrote : Please let me know how did you solve this problem. I am facing similar problem. thanks
|
| ~Samy
I too am getting the same error can someone please tell how to solve this issue it's very important any help is appreciated.
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of
| IllegalAnnotationExceptions
| java.util.List is an interface, and JAXB can't handle interfaces.
| this problem is related to the following location:
| at java.util.List
| java.util.List does not have a no-arg default constructor.
| this problem is related to the following location:
| at java.util.List
|
| at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check
| (IllegalAnnotationsException.java:102)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4139865#4139865
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4139865
16 years, 9 months
[JBossWS] - How to create a Web Service in JBoss
by whitexos12
Hi,
I am new to JBoss and mostly work with BEA and Oracle AS. I just downloaded jboss-4.2.2.GA. Now how do I deploy a Web Service are there any special kinds to create an ear for a Web Service. As I just have a simple HelloWorld program that I need to expose it as a Web Service and deploy it on JBoss but don't know what commands do I need to create a Web Service ear out of it and how to deploy it on the server.
Can someone please provide a simple example step by step to build and deploy a Web Service in JBoss.
As in oracle I can use the following to build an ear for a Web Service
<target name="assemble-webservice" depends="setup">
| <echo message="-----> Assembling the service ear file." />
| <copy todir="${out.dir}/war/WEB-INF/lib">
| <fileset dir="${out.lib}">
| <include name="*.jar"/>
| </fileset>
| </copy>
| <oracle:topDownAssemble appName="${app.name}"
| wsdl="${wsdl.file}" className="${implementaion.class}"
| input="${bld.webservice.dir}" output="${out.dir}"
| ear="${lib.dir}/${app.name}_service.ear">
| <!--fileset refid="resources" /-->
| </oracle:topDownAssemble>
| </target>
and in BEA can use the following:
<servicegen
| destEar="${build}"
| warName="helloWorldService.war">
| <service
| javaClassComponents="com.xx.ab.webservice.helloWorldWebservice"
| targetNamespace="http://xmlns.xx.com/ab/helloWorldService"
| serviceName="HelloWorldService"
| serviceURI="/helloWorldService"
| style="document"
| protocol="http"
| expandMethods="True">
| <handlerChain name="ExpressChain" handlers="com.xx.ab.handler.SOAPHandler"/>
| </service>
| <classpath>
| <pathelement path="${classes}"/>
| <pathelement path="${lib}/dynamic/*.jar"/>
| </classpath>
| </servicegen>
Now how do I do it in JBoss. What commands to use to create an ear for a Web Service. Any small tutorial will really help alot. Any help is really appreciated.
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4139846#4139846
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4139846
16 years, 9 months