Forum Discussion

vineet131's avatar
vineet131
Occasional Contributor
13 years ago

How to Read specific text from Raw Response of REST service

Hi,
I am trying to to read the a specific text from the Raw response of REST service.
For example I need to read text "Could not map UserM for" from below mentioned Raw response:
------------
HTTP/1.1 500 Internal Server Error
Connection: close
Date: Thu, 18 Oct 2012 14:21:33 GMT
Content-Length: 8006
Content-Type: text/html; charset=UTF-8
X-Powered-By: Servlet/2.5 JSP/2.1

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN">
<HTML>
<HEAD>
<TITLE>Error 500--Internal Server Error</TITLE>
</HEAD>
<BODY bgcolor="white">
<FONT FACE=Helvetica><BR CLEAR=all>
<TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all>
<FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 500--Internal Server Error</H2>
</FONT></TD></TR>
</TABLE>
<TABLE border=0 width=100% cellpadding=10><TR><TD VALIGN=top WIDTH=100% BGCOLOR=white><FONT FACE="Courier New"><pre>com.az.rd.gsm.common.ext.GsmUncheckedException: Rest call unsuccessful: Request:
Response: status[500]
Date: [Thu, 18 Oct 2012 15:19:41 GMT] Server: [Oracle Containers for J2EE] Connection: [Keep-Alive] Keep-Alive: [timeout=15, max=100] Content-Type: [text/plain] Transfer-Encoding: [chunked] , entity: [glow][glow]Could not map UserM for: xxxxx[/glow][/glow]

------------------------

Can anybody help me on this issue?

Regards,
Vineet

3 Replies

  • A REST (REpresentational State Transfer) service is based on some basic concepts of the web such as the HTTP protocol and the HTTP verbs (GET, POST…). When using a REST service, we need to send a request to a particular URL and a response will be returned. This response is unique, based on the URL: never should a specific URL return a different schema of the response. The best example of a REST implementation is the web itself: when we send a request to a particular URL, we’ll get back a response. Such a response is generally known as a resource in the REST terminology. The response is plain text, XML or JSON. The schema for this response can be seen as a contract: the service promises that the response will always be of the specified format. This way, we can write parsing code for the schema.

    Over the last couple of years, REST has gained a lot of traction, mainly because of its simplicity. People are moving their services to REST in favor of SOAP-based services such as WCF. For many scenarios, REST is more than enough: simply sending a request and receiving a clear-text response makes thing simple. And isn’t that what we want?!

    Many big sites including Facebook, Twitter, Flickr and many more offer a REST API. Application developers can therefore easily connect with available services by sending a request to a URL dictated by the site (including some parameters such as a search term). The response is XML or JSON and the response format is specified by the API as well.
  • vineet131's avatar
    vineet131
    Occasional Contributor
    Hi Kristen,
    Thanks for your response. But your reply did not address my query !!

    Regards,

    Vineet Kumar


    Kristenastewart wrote:
    A REST (REpresentational State Transfer) service is based on some basic concepts of the web such as the HTTP protocol and the HTTP verbs (GET, POST…). When using a REST service, we need to send a request to a particular URL and a response will be returned. This response is unique, based on the URL: never should a specific URL return a different schema of the response. The best example of a REST implementation is the web itself: when we send a request to a particular URL, we’ll get back a response. Such a response is generally known as a resource in the REST terminology. The response is plain text, XML or JSON. The schema for this response can be seen as a contract: the service promises that the response will always be of the specified format. This way, we can write parsing code for the schema.

    Over the last couple of years, REST has gained a lot of traction, mainly because of its simplicity. People are moving their services to REST in favor of SOAP-based services such as WCF. For many scenarios, REST is more than enough: simply sending a request and receiving a clear-text response makes thing simple. And isn’t that what we want?!

    Many big sites including Facebook, Twitter, Flickr and many more offer a REST API. Application developers can therefore easily connect with available services by sending a request to a URL dictated by the site (including some parameters such as a search term). The response is XML or JSON and the response format is specified by the API as well.