2012-11-30 56 views
0


我有春天WS我發送對象Request.java類的請求,如果我硬編碼jaxb類中的值是好的(但這不是它..) 我的肥皂請求我測試在了SoapUI:春季WS與jaxb空對象在請求

<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編組類:

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

} 

任何線索,我缺少什麼?

回答

1

可能是你atr1元素是默認的命名空間,而不是在http://jakisadres.com/caservice namespace..your請求的值應爲:

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

或者你可以顯式指定命名空間atr1