I am trying to send an XML object to a WebService that I published on a WebLogic server, but even if I do this object it is always received as null.
Here is the code of the WebService and the way in which I send the XML. Any ideas ?
Code JAVA Service method:
@WebMethod(operationName = "ConsultarRecibosPendientes")
@WebResult(name = "ConsultarRecibosPendientesResult")
public ConsultarRecibosPendientesRes ConsultarRecibosPendientes(@WebParam( name = "oReq")
ConsultarRecibosPendientesReq objeto) {
ConsultarRecibosPendientesRes recibosRes = new ConsultarRecibosPendientesRes();
String LlaveAcceso = objeto.getStrLlaveAcceso();
recibosRes.setStrIdentificacion(LlaveAcceso);
return recibosRes;
}
Class of the object that is received by parameter:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ConsultarRecibosPendientesReq")
public class ConsultarRecibosPendientesReq {
@XmlElement(name = "strLlaveAcceso")
protected String strLlaveAcceso;
public ConsultarRecibosPendientesReq(){ }
public String getStrLlaveAcceso() {
return strLlaveAcceso;
}
public void setStrLlaveAcceso(String strLlaveAcceso) {
this.strLlaveAcceso = strLlaveAcceso;
}
}
The object QueryReceivePendientesReq is always null. Does anyone know how to fix it?
First I made some changes in the class of the object that is received by parameter:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "consultarRecibosPendientesReq", propOrder = {
"strLlaveAcceso"
})
public class ConsultarRecibosPendientesReq {
protected String strLlaveAcceso;
public String getStrLlaveAcceso() {
return strLlaveAcceso;
}
public void setStrLlaveAcceso(String value) {
this.strLlaveAcceso = value;
}
}
I made a change to the WebService method:
@WebMethod(operationName = "ConsultarRecibosPendientes")
@WebResult(name = "ConsultarRecibosPendientesResult")
public ConsultarRecibosPendientesRes ConsultarRecibosPendientes(
@WebParam(name = "oReq", targetNamespace = "")
ConsultarRecibosPendientesReq oReq) {...}
And finally, I made a change to the XML that is sent, I added the "web" clause to the "method" and "target name space" tags, example:
<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<web:ConsultarRecibosPendientes xmlns:web="http://websercice.fi.co/">
<oReq>
<strLlaveAcceso>llave de acceso</strLlaveAcceso>
</oReq>
</web:ConsultarRecibosPendientes>
</soap:Body>
</soap:Envelope>