简体   繁体   English

使用JAX-WS 2.1时请求XML中不必要的属性

[英]Unnecessary attribute in request XML when using JAX-WS 2.1

I'm using JAX-WS 2.1 (uses JAXB 2.1) under WAS7.0 app server. 我在WAS7.0应用服务器下使用JAX-WS 2.1(使用JAXB 2.1)。 I've written a client code and below is the snippet from my request xml. 我已经写了一个客户端代码,下面是我的请求xml的代码段。

      <additionalCriteria>
         <ns5:keyword xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
         <ns5:maxResultsToReturn>10</ns5:maxResultsToReturn>
         <ns5:nextResultBlockKey xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
         <ns5:scope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
         <ns5:sortBy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
         <ns5:sortOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      </additionalCriteria>

As you can see, the attribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" is getting added to each element. 如您所见,属性xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"已添加到每个元素。 I dont want this in my request. 我不想在我的要求。 Can any one suggest please as it is blocking my project delivery? 有人可以提出建议,因为它阻碍了我的项目交付吗?

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" is necessary in case there are any nillable fields with null values down in the depths of the message. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"是必要的,以防在消息的深度范围内有任何空值可空的可空字段。 The JAX-B spec requires these to be represented with xsi:nil. JAX-B规范要求这些必须用xsi:nil表示。 JAX-WS/JAX-B cannot possibly predict if there are any of these, since it streams out the XML while walking the tree. JAX-WS / JAX-B可能无法预测其中是否有任何一个,因为它在遍历树时会流出XML。 So it always adds that namespace. 因此,它总是添加该名称空间。 It is standard, normal, and anyone who objects needs to rethink. 这是标准的,正常的,任何反对的人都需要重新考虑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM