2


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

<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;
    }

}

任何线索我错过了什么?

4

1 回答 1

3

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

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

或者您可以显式指定atr1字段的命名空间

于 2012-11-30T21:01:50.843 回答