Skip to Content.
Sympa Menu

grouper-users - [grouper-users] RE: Server not responding while using Delete member lite service

Subject: Grouper Users - Open Discussion List

List archive

[grouper-users] RE: Server not responding while using Delete member lite service


Chronological Thread 
  • From: Chris Hyzer <>
  • To: "Doppala, Karthik" <>, "" <>
  • Subject: [grouper-users] RE: Server not responding while using Delete member lite service
  • Date: Wed, 18 Dec 2013 13:32:10 +0000
  • Accept-language: en-US

It works for me.  Are you sure you have the right URL and everything else?

 

This is based on this example:

 

http://anonsvn.internet2.edu/viewvc/viewvc.py/i2mi/trunk/grouper-ws/grouper-ws/doc/samples/deleteMember/WsSampleDeleteMemberRestLite_http_json.txt?revision=8390&view=co

 

From this page:

 

https://spaces.internet2.edu/display/Grouper/Delete+Member    (click samples)

 

This is my request:

 

DELETE /grouperWs/servicesRest/xml/v2_0_0/groups/test:testGroup/members/test.subject.1 HTTP/1.1

Connection: close

Authorization: Basic R3JvdXBlclN5cXXXXXXXXXXXXXXXXXXX==

User-Agent: Jakarta Commons-HttpClient/3.0

Host: localhost:8088

 

This is my response:

 

HTTP/1.1 200 OK

Server: Apache-Coyote/1.1

Pragma: No-cache

Cache-Control: no-cache

Expires: Wed, 31 Dec 1969 19:00:00 EST

Set-Cookie: JSESSIONID=AF7B6426D438E2557F59AB77D8F5CB89; Path=/grouperWs

X-Grouper-resultCode: SUCCESS

X-Grouper-success: T

X-Grouper-resultCode2: NONE

Content-Type: text/xml;charset=UTF-8

Date: Wed, 18 Dec 2013 13:26:45 GMT

Connection: close

 

<WsDeleteMemberLiteResult>

  <resultMetadata>

    <resultCode>SUCCESS</resultCode>

    <resultMessage>Success for: clientVersion: 2.0.0, wsGroupLookup:

      WsGroupLookup[pitGroups=[],groupName=test:testGroup], subjectLookups: Array size: 1:

      [0]: WsSubjectLookup[subjectId=test.subject.1]

 

      , actAsSubject: null, fieldName: null, txType: NONE

      , params: null</resultMessage>

    <success>T</success>

  </resultMetadata>

  <wsSubject>

    <resultCode>SUCCESS</resultCode>

    <success>T</success>

    <id>test.subject.1</id>

    <name>my name is test.subject.1</name>

    <sourceId>jdbc</sourceId>

  </wsSubject>

  <responseMetadata>

    <resultWarnings></resultWarnings>

    <millis>621</millis>

    <serverVersion>2.1.5</serverVersion>

  </responseMetadata>

  <wsGroup>

    <extension>testGroup</extension>

    <displayExtension>testGroup</displayExtension>

    <displayName>test:testGroup</displayName>

    <name>test:testGroup</name>

    <uuid>b5071f80239a4f30b29d1b335914ddbd</uuid>

  </wsGroup>

</WsDeleteMemberLiteResult>

 

 

This is my java code:

 

/**

* @author mchyzer

* $Id$

*/

package edu.internet2.middleware.grouper.ws.poc;

 

import org.apache.commons.httpclient.Credentials;

import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;

import org.apache.commons.httpclient.Header;

import org.apache.commons.httpclient.HttpClient;

import org.apache.commons.httpclient.UsernamePasswordCredentials;

import org.apache.commons.httpclient.auth.AuthScope;

import org.apache.commons.httpclient.methods.DeleteMethod;

import org.apache.commons.httpclient.params.DefaultHttpParams;

import org.apache.commons.httpclient.params.HttpMethodParams;

import org.apache.commons.lang.StringUtils;

 

import edu.internet2.middleware.grouper.ws.coresoap.WsDeleteMemberLiteResult;

import edu.internet2.middleware.grouper.ws.samples.types.WsSampleRestType;

import edu.internet2.middleware.grouper.ws.util.RestClientSettings;

 

 

/**

*

*/

public class SampleDeletePut {

 

  /**

   * @param args

   */

  public static void main(String[] args) {

 

    try {

      HttpClient httpClient = new HttpClient();

     

      DefaultHttpParams.getDefaultParams().setParameter(

          HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(0, false));

 

      //URL e.g. http://localhost:8093/grouper-ws/servicesRest/v1_3_000/...

      //NOTE: aStem:aGroup urlencoded substitutes %3A for a colon

      DeleteMethod method = new DeleteMethod(

          "http://localhost:8089/grouperWs" + "/servicesRest/" + WsSampleRestType.xml.getWsLiteResponseContentType().name()

            + "/v2_0_0"

            + "/groups/test:testGroup/members/test.subject.1");

 

      httpClient.getParams().setAuthenticationPreemptive(true);

      Credentials defaultcreds = new UsernamePasswordCredentials("GrouperSystem", "xxxxxxxxxxxxxxx");

     

      //no keep alive so response if easier to indent for tests

      method.setRequestHeader("Connection", "close");

     

      //e.g. localhost and 8093

      httpClient.getState()

          .setCredentials(new AuthScope("localhost", 8089), defaultcreds);

 

      httpClient.executeMethod(method);

 

      //make sure a request came back

      Header successHeader = method.getResponseHeader("X-Grouper-success");

      String successString = successHeader == null ? null : successHeader.getValue();

      if (StringUtils.isBlank(successString)) {

        throw new RuntimeException("Web service did not even respond!");

      }

      boolean success = "T".equals(successString);

      String resultCode = method.getResponseHeader("X-Grouper-resultCode").getValue();

     

      String response = RestClientSettings.responseBodyAsString(method);

 

      //convert to object (from xhtml, xml, json, etc)

      WsDeleteMemberLiteResult wsDeleteMemberLiteResult = (WsDeleteMemberLiteResult)WsSampleRestType.xml

        .getWsLiteResponseContentType().parseString(response);

     

      String resultMessage = wsDeleteMemberLiteResult.getResultMetadata().getResultMessage();

 

      // see if request worked or not

      if (!success) {

        throw new RuntimeException("Bad response from web service: resultCode: " + resultCode

            + ", " + resultMessage);

      }

     

      System.out.println("Server version: " + wsDeleteMemberLiteResult.getResponseMetadata().getServerVersion()

          + ", result code: " + resultCode

          + ", result message: " + resultMessage );

 

    } catch (Exception e) {

      throw new RuntimeException(e);

    }

   

  }

 

}

 

 

 

Thanks,

Chris

 

 

From: [mailto:] On Behalf Of Doppala, Karthik
Sent: Tuesday, December 17, 2013 2:20 PM
To:
Subject: [grouper-users] Server not responding while using Delete member lite service

 

Hi,

I have been having trouble using this service; I am able to add using the same uri  (HTTP PUT), but am unable to get the deleteMemberLite (HTTP  DELETE) working.

Following is the path I am using

 

grouper-ws/servicesRest/xml/v2_0_0/groups/testUniv:services:wel:l:test:100/members/202972041

 

I get a NoHttpResponseException (Target server failed to respond).

Can anyone share their thoughts on this?

 

Thanks,

Karthik




Archive powered by MHonArc 2.6.16.

Top of Page