JAX-WS: why nested elements are in “” namespace?

醉酒当歌 提交于 2019-12-03 07:49:49

This behavior is proper per the WSI-Basic Profile. If you look at:

http://www.ws-i.org/profiles/basicprofile-1.1.html#Part_Accessors

section 4.7.20, assertion R2735 specifically states that for RPC/Literal, the part accessor elements must be put in elements with no namspace.

I too have the same problem . i developed webservice clientusing JAX-WS, with SOAP UI simulation.My webservice client is working fine. but when i test with real server (axis web service). I got null values.

SOUP UI simulation response like this

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservice.aml.infrasofttech.biz" xmlns:dat="http://dataobject.aml.infrasofttech.biz">
   <soapenv:Header/>
   <soapenv:Body>
      <web:getCIPMatchResponse>
         <!--1 or more repetitions:-->
         <web:getCIPMatchReturn>
            <dat:countries>?</dat:countries>
            <dat:dob>?</dat:dob>
            <dat:fullName>?</dat:fullName>
            <dat:isError>?</dat:isError>
            <dat:listName>?</dat:listName>
            <dat:passport>?</dat:passport>
            <dat:percentage>?</dat:percentage>
            <dat:sdnId>?</dat:sdnId>
            <dat:sdnName>?</dat:sdnName>
         </web:getCIPMatchReturn>
      </web:getCIPMatchResponse>
   </soapenv:Body>
</soapenv:Envelope>

But in the server it response with out namespace like this..

        <countries>?</countries>
        <dob>?</dob>
        <fullName>?</fullName>
        <isError>?</isError>
        <listName>?</listName>
        <passport>?</passport>
        <percentage>?</percentage>
        <sdnId>?</sdnId>
        <sdnName>?</sdnName>

The JAX-WS generated code looks like this.

  @XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SdnBean", namespace = "http://dataobject.aml.infrasofttech.biz", propOrder = {
    "countries",
    "dob",
    "fullName",
    "isError",
    "listName",
    "passport",
    "percentage",
    "sdnId",
    "sdnName"
})
public class SdnBean {

Then i have change the client jax-ws code @XmlType as shown below

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "countries",
    "dob",
    "fullName",
    "isError",
    "listName",
    "passport",
    "percentage",
    "sdnId",
    "sdnName"
})
public class SdnBean {

Now this will bind the soap response without namespace.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!