Grzzzzzzzzzzzzz
Grzzzzzzzzzzzzz

Reputation: 1341

Spring WS with jaxb null object in request


I have Spring WS to which i am sending request of Object Request.java class, if i hardcode value in jaxb class it is ok ( but this is not it..) my soap request i test in 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>

and what i get is :

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

my endpoint:

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

and my jaxb marshaller class:

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

}

any clue what am I missing?

Upvotes: 2

Views: 2730

Answers (1)

Biju Kunjummen
Biju Kunjummen

Reputation: 49915

Probably your atr1 element is in the default namespace and not in http://jakisadres.com/caservice namespace..your request should either be:

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

OR you can explicitly specify the namespace for atr1 field

Upvotes: 4

Related Questions