views:

50

answers:

0

Hello, we are currently having problems with a JAX-WS implementation, particulary in getting a value returned by the service, which in our case is always null, although we give it a value.

Some code before more explanations of our problem :

Here is the signature of our operation :

@WebMethod(action = "urn:genererEdition")
public void genererEdition(
    @WebParam(name = "requeteEdition", targetNamespace = "http://creditcgi.com/serviceeditique", partName = "requete")
    RequeteEdition requete,
    @WebParam(name = "reponseEdition", targetNamespace = "http://creditcgi.com/serviceeditique", mode = WebParam.Mode.OUT, partName = "reponse")
    Holder<ReponseEdition> reponse,
    @WebParam(name = "documentProduit", targetNamespace = "", mode = WebParam.Mode.OUT, partName = "documentProduit")
    Holder<byte[]> documentProduit);

Here is our web service test case :

@Test
public void testCallGenererEdition() {
    RequeteEdition requete = new RequeteEdition();

    Holder<ReponseEdition> reponseHolder = new Holder<ReponseEdition>(new ReponseEdition());
    Holder<byte[]> documentHolder = new Holder<byte[]>(new byte[512]);

    editique.genererEdition(requete, reponseHolder, documentHolder);

    Assert.assertNotNull(reponseHolder.value);
    Assert.assertNotNull(reponseHolder.value.getCodeRetour());
}

And finally, our WS implementation :

@Override
public void genererEdition(RequeteEdition requete,
        Holder<ReponseEdition> reponse, Holder<byte[]> documentProduit) {

    // if we do no instanciate ReponseEdition, we got a Null Pointer Exception
    reponse.value = new ReponseEdition();

    reponse.value.setCodeRetour("OK");
}

As you can see with the test, we are always getting null. What do we do wrong for always having a null object returned in the reponse Holder ?

Thank you in advance.