Hi all,
I wrote a Web Service which has two services such as calculate and print. Now I just use one endpoint to receive and handle two requests (calculateRequest and printRequest) as follow:
But I can also use two endpoints, so that each request can be handled by an endpoint as follow:Code:public class MyEndpoint exterds AbstractMarshallingPayloadEndpoint { ... @Override protected Object invokeInternal(Object obj) { if (obj instanceof CalculateRequest) { .... } else if (obj instanceof PrintRequest){ ..... } }
andCode:public class CalculateEndpoint exterds AbstractMarshallingPayloadEndpoint { ... @Override protected Object invokeInternal(Object obj) { CalculateRequest = calRequest = (CalculateRequest) obj; .... } }
Which method is better?Code:public class PrintEndpoint exterds AbstractMarshallingPayloadEndpoint { ... @Override protected Object invokeInternal(Object obj) { PrintRequest = prtRequest = (PrintRequest) obj; .... } }


Reply With Quote