Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need Support for Async implimentation for SOAP calls. #636

Open
sreekar12 opened this issue Dec 6, 2022 · 14 comments
Open

Need Support for Async implimentation for SOAP calls. #636

sreekar12 opened this issue Dec 6, 2022 · 14 comments

Comments

@sreekar12
Copy link

SOAP calls are not accepting as Uni as return type. Could you please help us any approach to make SOAP calls as Async.

For now i was using return type as Java class instead of Uni. For converting Uni to Java class i was using join() OR get().

Note: Join() and get() blocks until it gives response.

Could you please suggest any approach instead of above note....

@shumonsharif
Copy link
Contributor

@sreekar12 Not sure if it may be helpful, but have a look at the code posted here: #4 (comment)

@sreekar12
Copy link
Author

sreekar12 commented Dec 9, 2022

@shumonsharif How to extract an object from Uni without blocking method (ex: Without join() or get())

@shumonsharif
Copy link
Contributor

Hi @sreekar12 - Your question is unrelated to the extension, but I believe you may be able to find some answers on SO, for example here.

@tbkahuna48
Copy link

tbkahuna48 commented Dec 15, 2022

@shumonshariff Sorry, some additional context may help. The code is attempting to make several asynchronous parallel backend calls and aggregate the results. The current cxf SOAP implementation seems to require a join on the completion stages which is a blocking implementation. So the question is , how can the calls be made without blocking. Sreekar referred to Uni because most quarkus extensions work with Unis, the question though is how can the SOAP calls be made in parallel in a non-blocking way. This is specific to CXF SOAP as it is , among the many other implementations of parallel asynchronous calls using quarkus extension libraries, the only we as yet aren't able to figure out how to make in a non-blocking manner.
bryan.g.mclane@kp.org

@linktech1
Copy link

Here's another description of the problem. The Quarkus CXF extension does not currently support asynchronous response types in the service interface and need to convert async types (Uni, Completion or Future) to standard response types. This conversion results in the async type to block until backside responses are returned.

@linktech1
Copy link

linktech1 commented Dec 15, 2022

I tried using the @UseAsyncMethod annotation, https://cxf.apache.org/javadoc/latest-3.2.x/org/apache/cxf/annotations/UseAsyncMethod.html

The async methods I have implemented per the link above are not called. If the async methods were called I would also expect them to be called on the event-loop-thread

@WebService(endpointInterface = "io.quarkiverse.cxf.it.server.GreetingWebService", serviceName = "GreetingWebService")
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
public class GreetingWebServiceImpl implements GreetingWebService {

    private static final Logger LOG = LoggerFactory.getLogger(GreetingWebServiceImpl.class);

    @Inject
    HelloBean helloResource;

    @Override
    @UseAsyncMethod
    public String reply(@WebParam(name = "text") String text) {
        LOG.info("Calling reply ");
        return helloResource.getHello() + text;
    }

    @Override
    @UseAsyncMethod
    public String ping(@WebParam(name = "text") String text) throws GreetingException {
        if (text.equals("error")) {
            throw new GreetingException("foo", "bar");
        }
        LOG.info("Calling reply ");
        return helloResource.getHello() + text;
    }

    public Future<?> replyAsync(@WebParam(name = "text") String text,
            final AsyncHandler<GreetMeSometimeResponse> asyncHandler) {
        LOG.info("Calling replyAsync ");

        final ServerAsyncResponse<GreetMeSometimeResponse> response = new ServerAsyncResponse<GreetMeSometimeResponse>();
        GreetMeSometimeResponse tempResponse = new GreetMeSometimeResponse("Hello " + text);
        tempResponse.setResponseType(text);

        response.set(tempResponse);
        return response;
    }

    public Future<?> pingAsync(@WebParam(name = "text") String text,
            final AsyncHandler<GreetMeSometimeResponse> asyncHandler) throws GreetingException {
        LOG.info("Calling pingAsync ");
        if (text.equals("error")) {
            throw new GreetingException("foo", "bar");
        }
        final ServerAsyncResponse<GreetMeSometimeResponse> response = new ServerAsyncResponse<GreetMeSometimeResponse>();
        GreetMeSometimeResponse tempResponse = new GreetMeSometimeResponse("Hello " + text);
        tempResponse.setResponseType(text);
        response.set(tempResponse);
        return response;
    }

}

@shumonsharif
Copy link
Contributor

shumonsharif commented Dec 15, 2022

@shumonshariff Sorry, some additional context may help. The code is attempting to make several asynchronous parallel backend calls and aggregate the results. The current cxf SOAP implementation seems to require a join on the completion stages which is a blocking implementation. So the question is , how can the calls be made without blocking. Sreekar referred to Uni because most quarkus extensions work with Unis, the question though is how can the SOAP calls be made in parallel in a non-blocking way. This is specific to CXF SOAP as it is , among the many other implementations of parallel asynchronous calls using quarkus extension libraries, the only we as yet aren't able to figure out how to make in a non-blocking manner. bryan.g.mclane@kp.org

@tbkahuna48 Did you or Sreekar look at the example provided in my first comment? That example demonstrates exactly what you are describing? In case it doesn't address your use cases appropriately, could you kindly provide a small reproducer that shows the issue you are facing?

@shumonsharif
Copy link
Contributor

shumonsharif commented Dec 15, 2022

I tried using the @UseAsyncMethod annotation, https://cxf.apache.org/javadoc/latest-3.2.x/org/apache/cxf/annotations/UseAsyncMethod.html

The async methods I have implemented per the link above are not called. If the async methods were called I would also expect them to be called on the event-loop-thread

@linktech1 The @UseAsyncMethod as I understand is for CXF service providers, not consumers. Are you all trying to consume a web service (that's the impression I get from all the comments by @sreekar12 and @tbkahuna48) or provide a CXF service for others to consume?

I don't believe we've ever tested the @UseAsyncMethod successfully - in any case, I believe it's is a separate issue from what is being discussed here - would you mind opening a new issue and attaching a small reproducer?

@linktech1
Copy link

Yes. We are providing a service that calls other services. We have the the backend service clients being called asynchronously (they return Futures) but we also want the frontside service implementation to also be non-blocking. Looking for the same support as the Quarkus Rest services where the service is completely non-blocking and runs entirely on the vertex-event-loop.

@linktech1
Copy link

Anything on Quarkus CXF supporting service provider interfaces with non-blocking async behavior that runs on the vertex-io-thread?

@shumonsharif
Copy link
Contributor

@linktech1 I haven't had much time to look into this, and likely won't any time soon ... My take is that this is going to be a fairly major effort, and I don't believe the JAX-WS spec will allow us to mimic the same features / patterns as the Quarkus REST services. We may at most be able to possibly integrate the @UseAsyncMethod functionality offered in CXF.

@ppalaga @famod Any thoughts on this issue?

@linktech1
Copy link

I think the @UseAsyncMethod feature would work if the event-loop-thread is used. Async should be disabled if Quarkus detects other blocking code.

@ppalaga
Copy link
Contributor

ppalaga commented Aug 9, 2023

Thanks for reaching out, @sreekar12, @linktech1 and @tbkahuna48.

Would adding a proper support for @UseAsyncMethod solve your needs?

@linktech1
Copy link

linktech1 commented Aug 9, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants