相当于WCF [DataMember(Name =和[DataContract(Name = in Java)

时间:2015-03-05 11:41:09

标签: java wcf soap

我在Java和.Net之间有一个SOAP Web服务

在.net中,我们可以指定datacontract的数据库名称 像

这样的东西
[DataContract(Name = "Class")]
public class ClassWithASoLongNameThatIWantToRenameIt
{
    [DataMember(Name = "Property")]
    public string PropertyWithASoLongNameThatIWantToRenameIt  { get; set;}

Java中的等效注释知道我正在使用

import javax.jws.*;
import javax.jws.soap.SOAPBinding;

@WebService(targetNamespace = "http://MyNameSpace/")
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.BARE)

感谢您的时间:)

1 个答案:

答案 0 :(得分:0)

我认为Java中的等价物将类似于

@XmlRootElement(name="Class", namespace="http://MyNameSpace/")
@XmlAccessorType(XmlAccessType.FIELD)
public class ClassWithASoLongNameThatIWantToRenameIt {

     @XmlElement(name="Property")
     private String propertyWithASoLongNameThatIWantToRenameIt;

     public String getPropertyWithASoLongNameThatIWantToRenameIt {
           return propertyWithASoLongNameThatIWantToRenameIt;
     }