繁体   English   中英

请求中带有 jaxb null 对象的 Spring WS

[英]Spring WS with jaxb null object in request


我有 Spring WS,我要向它发送 Object Request.java类的请求,如果我在 jaxb 类中硬编码值就可以了(但这不是它......)我在 SoapUI 中测试的soap请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cas="http://jakisadres.com/caservice">
   <soapenv:Header/>
   <soapenv:Body>
      <cas:Request>
         <cas:atr1>some value</cas:machineName>
      </cas:Request>
   </soapenv:Body>
</soapenv:Envelope>

我得到的是:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <SOAP-ENV:Body>
      <ns3:Response xmlns:ns3="http://jakisadres.com/caservice">
         <responseValue>response: null</responseValue>
      </ns3:CARevokeCertResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

我的终点:

    @PayloadRoot(localPart = "Request", namespace = "http://jakisadres.com/caservice")
    @ResponsePayload
    public Response revokeCert(@RequestPayload Request param) {
        String request= param.getAtr1();
        Resoponse response_ = new Response();
        response.setResponseValue("response: "+request);
        return response;
    }

和我的 jaxb marshaller 类:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "atr1"
})
@XmlRootElement(name = "Request")
public class Request{

    protected String atr1;


    public String getAtr1() {
        return atr1;
    }

    public void setAtr1(String value) {
        this.atr1 = value;
    }

}

任何线索我错过了什么?

可能您的atr1元素位于默认命名空间中,而不是在http://jakisadres.com/caservice命名空间中atr1您的请求应该是:

  <cas:Request>
     <atr1>some value</atr1>
  </cas:Request>

或者您可以明确指定atr1字段的命名空间

暂无
暂无

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

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