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

How to send POST requests using JaxRsClientResource #1081

Closed
thboileau opened this issue May 29, 2015 · 4 comments
Closed

How to send POST requests using JaxRsClientResource #1081

thboileau opened this issue May 29, 2015 · 4 comments

Comments

@thboileau
Copy link
Contributor

mail sent by Hassene Ben Amara

I am facing a problem to create a Restlet client using JAXRS annotated resource class.
Snippet from Resource:

    @POST
    @Path("/getLoginAppInfo")
    @Consumes("application/xml")
    @Produces("application/xml")
    public GetLoginAppInfoResponse getLoginAppInfo(
            GetLoginAppInfoRequest request);
    @POST
    @Path("/appLogin")
    @Consumes("application/xml")
    @Produces("application/xml")
    public AppLoginResponse appLogin(AppLoginRequest request);

On my restlet client, I am using this code:

IAppLoginResource resource = JaxRsClientResource.createJaxRsClient("http://localhost:9090/rest", IAppLoginResource.class);          
final GetLoginAppInfoResponse response = resource.getLoginAppInfo( getLoginAppInfoRequest );

When I check the issued HTTP call, it's of type GET.
How do I set the HTTP call to POST using JaxRsClientResource?
Any help (or snippet of code) would be highly appreciated.
NB: I took a look at this link Referring to this post here #1072 but it didnt help much.

@thboileau
Copy link
Contributor Author

I've tested your interface:

and it works for me.

@hbenamara
Copy link

Hi Thierry,

Thank you very much for your help!
I do have the @path("/applogin") annotation already at the interface level, I removed the consume and produce as u suggested but still the HTTP request issued is of type GET.

Can you please share your working version, I might be missing something.

thanks

@thboileau
Copy link
Contributor Author

Hi @hbenamara , I send you my sample Eclipse project.

@thboileau
Copy link
Contributor Author

quite old ticket.
Let's close it.

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

No branches or pull requests

2 participants