Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Team
Is it possible to GET OData data from within JSP code? Calling to some Java interface within WRS, so I can pass in some OData parameters and receive the Windchill data.
The JSP code is invoked after user authentication, so I would not want to be re-authenticating in the call to WRS.
Solved! Go to Solution.
Hi @rleir
The import is just example of my own class and how to call the method from JSP page.
You can use any classes what you need from the Windchill.
My class contains my own methods that do something.
If you call the ODATA from JSP you always need to authenticate even though the user session is logged in.
The OData RestAPI are usually used outside the Windchill and it is designed for it. If you don't want to reauthenticate you need to use some SSO method same as from thingworx.
PS: you can not retrieve a password from the user. It is not possible because it would be a security black hole.
You can use universal user to authenticate for the Odata call. so you would have static user and psw that can be used from your own config. ...
PetrH
Hi @rleir
I guess if you call RestApi you need to authenticate even though you call it from Windchill page.
Someone can correct me.
If I call rest api from thingworx that is set with Windchill wit SSO, if I call rest api, I need to authenticate the call.
I may do something wrong but I have to do so.
PetrH
No, I am asking about a Java API callable from some JSP in the Windchill server.
Thanks for your insight Petr
Hi @rleir
It is simple
<%@ page import="cz.aveng.AVWPublish.AVPublishConfigure" %>
<%
AVPublishConfigure.reloadConfigData();
%>
PetrH
Petr, tell more about your import
"cz.aveng.AVWPublish.AVPublishConfigure"
It would be your company's product, but I did not see it on the web site. Can you tell more please?
Just to be clear, I have a user running some JSP (so they are currently logged in) and I want the JSP to get data from OData without having to re-authenticate.
And there is likely a better way to get access to the data, but this way I can re-use an algorithm based on accesses to OData.
Hi @rleir
The import is just example of my own class and how to call the method from JSP page.
You can use any classes what you need from the Windchill.
My class contains my own methods that do something.
If you call the ODATA from JSP you always need to authenticate even though the user session is logged in.
The OData RestAPI are usually used outside the Windchill and it is designed for it. If you don't want to reauthenticate you need to use some SSO method same as from thingworx.
PS: you can not retrieve a password from the user. It is not possible because it would be a security black hole.
You can use universal user to authenticate for the Odata call. so you would have static user and psw that can be used from your own config. ...
PetrH