开发者

Why are only some of my attributes shown in the response xml of jaxws?

开发者 https://www.devze.com 2022-12-28 20:42 出处:网络
I created a jaxws webservice, but it returns only some of the attributes of my objects in the response xml.

I created a jaxws webservice, but it returns only some of the attributes of my objects in the response xml.

E.g.

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

   //getter and setter
}

But the returned XML only contains

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns2:mynamespaceResponse xmlns:ns2="myn开发者_JAVA技巧amespace">
         <myObject>
            <attribute1>stringcontent</attribute1>
         </myObject>
             ....


Attributes which are null are not shown in the XML. In the example, attribute 2 is null, and therefore it's not shown.

0

精彩评论

暂无评论...
验证码 换一张
取 消