【问题标题】:Why are only some of my attributes shown in the response xml of jaxws?为什么jaxws的响应xml中只显示了我的一些属性?
【发布时间】:2010-04-27 12:32:05
【问题描述】:

我创建了一个 jaxws webservice,但它只返回响应 xml 中我的对象的一些属性。

例如

public class MyObject {
   private String attribute1;
   private String attribute2;

   //getter and setter
}

但是返回的 XML 只包含

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns2:mynamespaceResponse xmlns:ns2="mynamespace">
         <myObject>
            <attribute1>stringcontent</attribute1>
         </myObject>
             ....

【问题讨论】:

    标签: java xml jax-ws


    【解决方案1】:

    为 null 的属性不会显示在 XML 中。 在示例中,属性 2 为 null,因此未显示。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多