Doubt Receiving parameters (Webservice Soap)

Asked

Viewed 165 times

1

Guys, I’m having doubts in the following scenario:

I have this class, it is a webservice (contains the @Webservice method):

@WebService(name = "l", targetNamespace = "o")
    public abstract interface Service {

    @WebMethod(operationName = "Cancelar")
    @RequestWrapper(localName = "Cancelar", targetNamespace = "http://www.x.com.br/y/w", className = "br.com.x.y.w.CancelarRequest")
    @ResponseWrapper(localName = "CancelarResponse", targetNamespace = "http://www.x.com.br/y/w", className = "br.com.x.y.w.CancelarResponse")
    public abstract void Cancelar(
            @WebParam(name = "k", targetNamespace = "http://www.x.com.br/y/w", mode = WebParam.Mode.INOUT) Holder<String> paramHolder,
            @WebParam(name = "Result", targetNamespace = "http://www.x.com.br/y/w", mode = WebParam.Mode.OUT) Holder<ResultType> paramHolder1);
    }

My question is: if this class is a webservice why define it as "Abstract interface", alias, - what happens when I define a class using "Abstract interface". To this day I’ve only created classes that use one or the other.

Note that this class is the remote interface, it defines the remote services (@Method), but does not implement them, the entire implementation seems to be in the Serviceimpl class:

public class ServiceImpl implements Service     
    @Override
    public void Cancelar(
            Holder<String> k,
            Holder<ResultType> result) {

        CancelarP p = new CancelarP(ctx, k.value);
        CancelarResponseType execute = p.execute();
        ResultType resultType = execute.getResult();
        result.value = resultType;
    }

In the Serviceimpl class, if when I give a @Override I lose the parent class implementation, how do I make the xml Marshall received via Soap?. I’m failing to understand how these classes are working together.

I hope I have been able to be clear in the preparation of the question, since I thank you.

1 answer

1


Come on. When you give an @Override on Cancelar()you are not missing the implementation of the interface, precisely because there is none, being it an interface.

What may have led you to believe this is the notes that the interface creator placed in the method parameters.

For the first question, I will translate an answer to an identical question asked in the OS. I honestly never used anything to implement the annotation @WebServicethen I can only describe the technical part.

No need to put abstracton an interface, because it is already abstract, and adding it does not change at all.

public abstract interface Interface {
       \___.__/
           |
           '----> Não é necessário...

public void interfacing();
public abstract boolean interfacing(boolean really);
       \___.__/
           |
           '----> nem aqui.
}

There is some change in the implementation of a p/ other?

No, exactly the same thing. The methods will continue to be implemented concretely in your daughter classes.

Source

Editing: Something I forgot to comment on. The method annotations are probably there so that they are manipulated in the correct way by some framework. And as they are in the interface, there will be no harm in not putting them in the class impl.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.