PlanetJava
Custom Search

java-jdom-general
[Top] [All Lists]

Re: Passing Element parameter in Jax-ws web method

Subject: Re: Passing Element parameter in Jax-ws web method
Date: Sat, 17 Mar 2012 11:47:56 -0400
Hi Dehaene
Technically, the Element instance does have a no-arg constructor, only it is 'protected', not public.
For you to solve your problem in the short term, you may want to do:
class MyElement extends Element {
  public MyElement() {
    super();
  }
}
Then you can make the method:
public void hello(@WebParam(name = "xmlElement") MyElement element){
I am not familiar enough with the jax-ws to know whether this will help enough.... It will make the implementation a little messier, but, by default, JDOM doe s not let you create invalid Elements (which an Element without a name would be...).
It is not likely possible to make the no-arg constructor public.
Anothe roption is to create a serialized Element? Element serialization (at least in JDOM2) is reliable....
Rolf
On 17/03/2012 11:14 AM, Dehaene Thomas wrote:
Hello,
I have a problem when accepting a web parameter of the type Element. My code is 
as follows:
     @WebMethod(operationName = "hello")
     public void hello(@WebParam(name = "xmlElement") Element element){
         String name = new String();
         name = element.getChild("FirstName").getValue();
     }
Which generates an error when I try to deploy the web service. Namely that the 
Element class
does not have a no-arg constructor.
If this where a normal method, I would simply make it a 'public static void' 
method,
but since WebMethods in Jax-ws can't be of the 'final' or 'static' type, I 
can't seem to
accept an Element parameter.
Any suggestions how to solve this?
Many thanks and greetings
Thomas Dehaene
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
msgmiddle
<Prev in Thread] Current Thread [Next in Thread>
Current Sitemap | © 2012 planetjava | Contact | Privacy Policy