|
Ron,
I'm not familiar with these Java classes. (This is definitely not
JavaScript, it is Java.)
If I had to guess, I'd say this is simply creating a web form (not a
JSON document.) Can you explain why you used a JSON document in your
earlier RPG example?
-SK
On 4/4/19 1:22 PM, Hudson, Ron wrote:
Hi Scott,provided the following explanation and Javascript solution. Does your tool
After getting in touch with the Vertex Cloud technical team, they
have a solution for this?
JSON at this moment because this is throwing a security flag from our auth
The Authentication server is not going to be compatible with the RAW
server. The authentication process that will have to be implemented into
your client in order to get the accessToken should look something like the
following Javascript:
"e645xxxx-xxxx-xxxx-xxxx-xxxxaf9a317c");
public OAuthResponse getAccessToken() {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap<String,String> map = new LinkedMultiValueMap<>();
map.add("client_id", "1c2fxxxx-xxxx-xxxx-xxxx-xxxx9a5b2474");
map.add("client_secret",
map.add("grant_type", "password");HttpEntity<>(map, headers);
map.add("username", "c7ddxxxx-xxxx-xxxx-xxxx-xxxx6a8a32b1");
map.add("password", "a6adxxxx-xxxx-xxxx-xxxx-xxxx22c0b8d7");
map.add("scope", "calc-rest-api");
HttpEntity<MultiValueMap<String,String>> entity = new
ResponseEntity<OAuthResponse> response;OAuthResponse.class);
OAuthResponse oAuthResponse = null;
try {
response = restTemplate.postForEntity(oauthUrl, entity,
oAuthResponse = response.getBody();refreshAccessToken("350630f9-4b6e-47cf-86e3-c1682fcb4ed5");
} catch (HttpClientErrorException e) {
if (e.getStatusCode().value() >= 400) {
return
} else {with auth server: %s", e.getMessage());
String msg = String.format("error while communicating
throw new GeneralAuthServerException(msg);auth server: %s", e.getMessage());
}
} catch (Exception e) {
String msg = String.format("error while communicating with
throw new GeneralAuthServerException(msg);invalid response");
}
if (oAuthResponse == null) {
throw new GeneralAuthServerException("OAuth server returned
} else {Klement
return oAuthResponse;
}
}
Ron Hudson | Programmer / Analyst
+1.704.752.6513 x1324
www.invue.com
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Scott
Sent: Wednesday, April 3, 2019 11:45 AMyour post.
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: REST request to Vertex Cloud
Ron,
I am not familiar with 'Vertex Cloud' and hadn't heard of it prior to
would be 'application/json'. You say that gives you a 415 response, which
The data you're sending is a JSON document, so the correct content-type
makes me think I'm missing something in how this is supposed to work.
type at all. You probably meant 'application/x-www-form-urlencoded',
You say you tried 'x-www-form-urlencoded' but that is not a valid media
which is the default media type for HTML form data. (However, your JSONdocument is not HTML form data, at least not the way you've coded it.)
to do it in HTTPAPI. But, I can't figure it out from the info you've
If you can tell me how you're supposed to send it, I could tell you how
supplied.
sales tax calculations? If so, any advice? Vertex has been of little
-SK
On 4/3/19 10:28 AM, Hudson, Ron wrote:
Has anyone had success using a REST request to the Vertex Cloud for
help, all their IBM i connections are SOAP.
either 400 Bad Request or 415 Unsupported Media Type , depending on what
I'm attempting to use Scott's HTTPAPI version 1.39, O/S version V7R3M0.
The debug log shows I am making the connection, but I am receiving
"Content-Type" is sent.
(this was successful in Postman)Testing the connection with Postman is successful.
Entire test program below:
http_debug(*on: '/tmp/debug.txt');
JSONsecurity = '+
{"client_id":"Rest-API-xxxxxxxxxxxxxxxxx",+
"client_secret":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",+
"username":"xxxxxxxxxxxxxx",+
"password":"xxxxxxxxxx",+
"scope":"calc-rest-api",+
"grant_type":"password"}';
URL = 'https://auth.vertexsmb.com/identity/connect/token';
monitor;
resp= http_string('POST': url : JSONsecurity :
'x-www-form-urlencoded'); on-error;
httpcode = http_error();
endmon;
*inlr = *on;
Results from different "Content-Type" below
// 'x-www-form-urlencoded' 400 Bad Request
Type// 'application/json' 415 Unsupported Media Type
// 'accept: text/json' 400 Bad Request
// 'text/json' 415 Unsupported Media
Type// 'text/plain' 415 Unsupported Media
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or// 'accept: text/plain' 400 Bad Request--
Thanks
Ron
Scott Klement
http://www.scottklement.com
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-lhttps://archive.midrange.com/rpg400-l.
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
questions.
Please contact support@xxxxxxxxxxxx for any subscription related
link: https://amazon.midrange.com
Help support midrange.com by shopping at amazon.com with our affiliate
--
Scott Klement
http://www.scottklement.com
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.