%@page contentType="text/html" pageEncoding="UTF-8"%>
Profile
Profile Results
<%
String type = request.getParameter("type");
String token = request.getParameter("token");
String url = request.getParameter("url");
%>
<%-- start web service invocation --%>
<%
try {
if (type.equals("WS")) {
com.idsvcsclient.IdentityServicesImplService service = new com.idsvcsclient.IdentityServicesImplService();
com.idsvcsclient.IdentityServicesImpl port = service.getIdentityServicesImplPort();
java.util.List attributeNames = null;
com.idsvcsclient.Token subject = new com.idsvcsclient.Token();
subject.setId(token);
com.idsvcsclient.UserDetails results = port.attributes(attributeNames, subject);
out.println("Successful using Web Services (SOAP/WSDL)
");
java.util.List attrs =
results.getAttributes();
java.util.Iterator items =
attrs.iterator();
while (items.hasNext()) {
com.idsvcsclient.Attribute attr = items.next();
out.println("Attribute: name=" + attr.getName() +
"Values=" + attr.getValues() + "
");
}
out.println("
Roles=" + results.getRoles());
} else if (type.equals("REST")) {
if (url == null || url.length() == 0) {
out.println("Invalid URL:
" + url);
} else {
url += "/attributes";
java.net.URL iurl = new java.net.URL(url);
java.net.URLConnection connection = iurl.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setUseCaches(false);
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
// Send POST output.
java.io.DataOutputStream printout = new java.io.DataOutputStream(
connection.getOutputStream ());
String content = "subjectid=" + token;
printout.writeBytes (content);
printout.flush ();
printout.close ();
java.io.BufferedReader reader = new java.io.BufferedReader(
new java.io.InputStreamReader(
(java.io.InputStream) connection.getContent()));
out.println("Successful using REST
");
String line;
while ((line = reader.readLine()) != null) {
out.println(line + "
");
}
}
}
} catch (Exception ex) {
try {
ex.printStackTrace(new java.io.PrintWriter(out));
} catch (Exception e) {
// Ignore
}
}
%>
<%-- end web service invocation --%>