Sun Identity Manager 8.1 Web Services

ListTargetsRequest Examples

The examples in this section illustrate the ListsTargetsRequest capabilities that are available using Identity Manager.


Example 2–7 Example Client Code

The following example shows how a .jsp file invokes a ListTargetsRequest through Identity Manager’s SessionAwareSpml2Client class.

<%@page contentType="text/html"%>
<%@page import="org.openspml.v2.client.*,
                com.sun.idm.rpc.spml2.SessionAwareSpml2Client"%>
<%@page import="org.openspml.v2.profiles.dsml.*"%>
<%@page import="org.openspml.v2.profiles.*"%>
<%@page import="org.openspml.v2.util.xml.*"%>
<%@page import="org.openspml.v2.msg.*"%>
<%@page import="org.openspml.v2.msg.spml.*"%>
<%@page import="org.openspml.v2.util.*"%>
<%
final String url = "http://host:port/idm/servlet/openspml2";
%>
<html>
<head><title>SPML2 Test</title></head>
<body>
<%
 // need a client.
 SessionAwareSpml2Client client = new SessionAwareSpml2Client( url );
 // login (sends a ListTargetsRequest)
 Response res = client.login("configurator", "password");
%>
<%= res.toString()%>
</body>
</html>


Example 2–8 Example Request XML

This next example shows the body of the SPML request that is sent.

<listTargetsRequest xmlns='urn:oasis:names:tc:SPML:2:0' requestID='rid[7013]' 
    executionMode='synchronous'>
  <openspml:operationalNameValuePair xmlns:openspml='urn:org:openspml:v2:util:xml'
    name='accountId' value='configurator'/>
  <openspml:operationalNameValuePair xmlns:openspml='urn:org:openspml:v2:util:xml'
    name='password' value='password'/>
</listTargetsRequest>

This example shows the body of the SPML response that is received by or returned to the client.


Example 2–9 Example Response XML

   <openspml:operationalNameValuePair 
xmlns:openspml="urn:org:openspml:v2:util:xml" name="session" value="AAAM+wAAaC..."/>
   <target targetID="spml2-DSML-Target" profile="urn:oasis:names:tc:SPML:2:0:DSML">
      <schema>
         <spmldsml:schema xmlns:spmldsml="urn:oasis:names:tc:SPML:2:0:DSML">
            <spmldsml:objectClassDefinition name="spml2Person">
               <spmldsml:memberAttributes>
                  <spmldsml:attributeDefinitionReference required="true" 
name="objectclass"/>
                  <spmldsml:attributeDefinitionReference required="true" 
name="accountId"/>
                  <spmldsml:attributeDefinitionReference required="true" 
name="credentials"/>
                  <spmldsml:attributeDefinitionReference name="firstname"/>
                  <spmldsml:attributeDefinitionReference name="lastname"/>
                  <spmldsml:attributeDefinitionReference name="emailAddress"/>
               </spmldsml:memberAttributes>
            </spmldsml:objectClassDefinition>
            <spmldsml:attributeDefinition name="objectclass"/>
            <spmldsml:attributeDefinition description="Account Id" name="accountId"/>
            <spmldsml:attributeDefinition description="Credentials, e.g. password" 
name="credentials"/>
            <spmldsml:attributeDefinition description="First Name" name="firstname"/>
            <spmldsml:attributeDefinition description="Last Name" name="lastname"/>
            <spmldsml:attributeDefinition description="Email Address" 
name="emailAddress"/>
         </spmldsml:schema>
         <supportedSchemaEntity entityName="spml2Person"/>
      </schema>
      <capabilities>
         <capability namespaceURI="urn:oasis:names:tc:SPML:2:0:async"/>
         <capability namespaceURI="urn:oasis:names:tc:SPML:2:0:batch"/>
         <capability namespaceURI="urn:oasis:names:tc:SPML:2:0:bulk"/>
         <capability namespaceURI="urn:oasis:names:tc:SPML:2:0:password"/>
         <capability namespaceURI="urn:oasis:names:tc:SPML:2:0:suspend"/>
         <capability namespaceURI="urn:oasis:names:tc:SPML:2:0:search"/>
      </capabilities>
   </target>
</listTargetsResponse>