[jboss-user] [JBossWS] - Re: Type Substitution doesn't work with Schema2Java Client a

mrokka123 do-not-reply at jboss.com
Thu Oct 4 05:33:05 EDT 2007


WOW! It really works. Thanks a lot Richard. 
It even works on JBossWs 1.2.1 [I think Which was default JBossWs for JBoss4.2.0].

Here?s the working version:

POJO Class
A.java

package com.d2.client;
public abstract class A implements java.io.Serializable{
private String name;
public void setName(String name){
	this.name=name;
}
public String getName(){
	return name;
}
}

B.java

package com.d2.client;
public class B extends A implements java.io.Serializable{
}


package-info.java //this class does the magic

@javax.xml.bind.annotation.XmlSchema(namespace = "http://client.d2.com/")
package com.d2.client;
-------------------------------------------------------------------------------------
WebService

package com.d2.webservice;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.soap.SOAPBinding;
import com.d2.client.*;
@WebService(name = "MyWebServicePortType", serviceName = "MyWebService",
        portName = "MyWebServicePort",targetNamespace = "http://client.d2.com")

@SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
        use = SOAPBinding.Use.LITERAL,
        parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)

public class MyWebService{
@WebMethod
public String getClassName(A obj){
	System.out.println("class name:"+obj.getClass().getName());
	System.out.println("Parent name:"+obj.getName());
	return obj.getClass().getName();
}
@WebMethod
public void dummyMethod(B obj)//if we use @XmlSeeAlso then this method not needed
{
}
}

Regards,



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091427#4091427

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091427



More information about the jboss-user mailing list