سؤال

I admit I'm a greenhorn with web services.

I am attempting to call an OpenAM restful web service from a legacy unprotected tomEE+ servlet. My problem is that I don't understand what I should be creating for the second argument of:

JAXRSClientFactory.create("http://openam.mylocalAMserver.lan:8080/openam/json/authenticate", WhatClassGoesHere.class);

The OpenAM documentation provides this:

3.3.1. Authentication & Logout

$ curl --request POST --header "X-OpenAM-Username: demo" --header "X-OpenAM-Password: changeit" --header "Content-Type: application/json" --data "{}" https://openam.example.com:8443/openam/json/authenticate

{ "tokenId": "AQIC5w...NTcy*", "successUrl": "/openam/console" }

Should I create a class with instance variables "tokenId", "successURL" and passing that as the second parameter to JAXRSClientFactory? Do I need to worry about all of the parameters specified? Once I figure this out, I've got to figure out how to actually pass the user name and password and invoke the service...

Thanks for your help.

هل كانت مفيدة؟

المحلول

This is really more of a JAXRS question, and is not specific to OpenAM. You need to write Java code to make requests and parse the JSON response. JAXRS is one way to do this- but there are others as well.

Look for a good JAXRS tutorial. The OpenAM part is very simple once you understand REST web services.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top