Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

jaxb and complex types extending hashtable , dont work.

843833Nov 13 2006
hello all
im trying to create web service with jaxws and jaxb for complex types
but im facing problem when it comes with complex type that extend hashtable here is my code ( very simple ):
the complex type :
package com.ws.test;

import java.util.Hashtable;

public class MyHash extends Hashtable {

public MyHash(){
super();
}

public void add(String k,String v){
super.put(k,v);
}

public String getValueFromKey(String k){
return (String) super.get(k);
}
}

server class :
package com.ws.test;

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService
public class WsTest {

MyHash mh = null;


public WsTest(){
mh = new MyHash();
mh.add("Meir","Meir");
}

@WebMethod
public MyHash PrintFromMyHash(){
String v = mh.getValueFromKey("Meir");
System.out.println(v);
return mh;
}



public static void main (String args[]){
WsTest wt = new WsTest();
wt.PrintFromMyHash();
}

} 

the client class :

package com.ws.test.client;
public class Main {

public static void main(String[] args) {
// TODO Auto-generated method stub
WsTestService wts = new WsTestService();
com.ws.test.client.MyHash mh = new com.ws.test.client.MyHash();
mh = wts.getWsTestPort().printFromMyHash();


}

}
now the server generating is fine and working ( deployment to tomcat 5.5 )
when I try to call some method from the "mh" ( hashtable ) I dont get any methods
when I look in to MyHash.java that the is generated in the client
I see that besides the definition of MyHash all the methods are missing what is wrong here ?

Here is the class that is generated from the client:
package com.ws.test.client;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;


/**
* <p>Java class for myHash complex type.
* 
* <p>The following schema fragment specifies the expected content contained within this class.
* 
* <pre>
* <complexType name="myHash">
* <complexContent>
* <extension base="{http://test.ws.com/}hashtable">
* <sequence>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
* 
* 
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "myHash")
public class MyHash
extends Hashtable
{


}
can someone please give me simple example on how to make it work
thanks allot
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 11 2006
Added on Nov 13 2006
0 comments
70 views