Exceptions and Web Services

Im uses the standard java ws implementation that comes with, for example. java6 (javax.jws. *).

I have the following:

import javax.jws.*;


@WebService(name="Widget")
public interface Widget {
    @WebMethod
    public @WebResult String getGadget(@WebParam(name = "id") long id) throw MyOwnException;    
}

Is it possible? Should I comment on MyOwnException, for example with @WebFault annotation? During my initial tests, I also noticed that on the client side, an auto-generated MyOwnException was renamed MyOwnException_Exception and the “original” MyOwnException was thrown.

Or, if this is a bad idea, are there any recommended exceptions for getting out of a web service as follows?

+3
source share
1 answer

! @WebFault, . - , . (Fault Contract). Google " SOAP" , , .

... .

, , "" (, ):

№1

, , , 3 2 . , .

№ 2

, , , , , .

/ , , , . - , , .

, , " ", . , .

REST. Http . , ... , () , , , , , .. http- , - . HTTP-. .

, , , .

-

+4
source

Source: https://habr.com/ru/post/1715047/


All Articles