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

前端 未结 2 2019
谎友^
谎友^ 2021-02-09 19:24

Having a toy service as below

@WebService(targetNamespace=\"http://www.example.org/stock\")
@SOAPBinding(style=Style.RPC,parameterStyle=ParameterStyle.WRAPPED)
p         


        
相关标签:
2条回答
  • 2021-02-09 20:09

    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.

    0 讨论(0)
  • 2021-02-09 20:14

    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.

    0 讨论(0)
提交回复
热议问题