C# - What Is The Difference Between Rest Web Service And Rest Enabled Wcf Service

Oct 15, 2010

I have developed an rest enable wcf service by using the following link

[URL]

Now I want to know is there any difference between rest enabled wcf service (or restful web service) & rest web service ? If there is any difference then what is that ? If there is difference the can you provide me any link (which represents steps visually as in above link) through which I can develop rest web service ?

View 2 Replies


Similar Messages:

Talking To A Rest Service / Call A Rest Service Without Having To Redirect?

Feb 8, 2010

I need to call a Rest service but would like to do so without having to redirect. Here is my dilemma. The Rest service we are trying to integrate offers the option to sign up for a subscription but does not allow us to upgrade an existing subscription. So if a user wants to upgrade an existing subscription we have to first cancel and then have the user sign up for a brand new subscription. I don't know how I can make this so it flows nicely in my code. I ideally I would like to do something like this

User decides to upgrade

Click upgrade button

Existing account is being cancelled, if cancellation was successful

New account is being created

How can I do this with a Rest service? Here is a sample URI/URL

https://someservice.com?
Action=CancelSubscriptionAndRefund
&AWSAccessKeyId=AKIAIIFXJCFIHITREP4Q
&CallerReference=CallerReference07
&CancelReason=MyWish
&RefundAmount.CurrencyCode=USD
&RefundAmount.Value=1
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&Signature=1uFUSSFvau1zadnSzKRS5ZchuLMn9p5M3ifaHGHie7M%3D
&SubscriptionId=17d62772-c53e-4bdb-9667-65d7b7841cfc
&Timestamp=2009-10-06T08%3A05%3A13.296Z
&Version=2008-09-

Could anybody give me some ideas how to make this work in an elegant manner. We thought we could keep the old subscription and then just sign the user up for a new subscription for the difference of the money. For example the first subscription would be 2.95 and the second one would be 2.00 which would amount to a subscription of 4.95. I think it is not elegant and the user would see 2 charges on the credit card, weird, I think. Since I don't know much about Rest maybe there is a way that this can be solved.

View 1 Replies

WCF Rest Service With A Clean URL?

Aug 24, 2010

I'm considering to host WCF Rest Service that i've built on IIS 7. The URL to access my service will be something like

[URL]

Recently, i've been looking to some REST API implementation with a clean URL like Yahoo API

[URL]

I'm wondering what will be the best WCF host environment (e.g. Windows Service) or any solution (e.g. URL rewrite module) considering that I dont want to have application name and .svc in my URL so that I can have a completely clean URL for my REST API

View 2 Replies

C# - Consuming A Rest XML Web Service?

Jan 14, 2011

I'm trying to consume the following web service http://ipinfodb.com/ip_location_api.php
this web service returns an xml response, the code below gets the XML response, but somehow when phasing the values from the XML response it does not work.

What is wrong with my code?

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.IO;
using System.Net;
using System.Xml;

namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
HttpWebRequest request = null;
HttpWebResponse response = null;
String Xml;
// Create the web request
request = WebRequest.Create("http://api.ipinfodb.com/v2/ip_query.php?key=<yourkey>&ip=74.125.45.100&timezone=true") as HttpWebRequest;
// Get response
using (response = request.GetResponse() as HttpWebResponse)
{
// Get the response stream
StreamReader reader = new StreamReader(response.GetResponseStream());
Xml = reader.ReadToEnd();
}
// Console xml output
Console.WriteLine(Xml); //see if we get the xml response, (YES we do)
Console.ReadLine();
string _currentField = "";
StringReader _sr = new StringReader(Xml);
XmlTextReader _xtr = new XmlTextReader(_sr);
_xtr.XmlResolver = null;
_xtr.WhitespaceHandling = WhitespaceHandling.None;
// get the root node
_xtr.Read();
if ((_xtr.NodeType == XmlNodeType.Element) && (_xtr.Name == "Response"))
{
while (_xtr.Read())
{
if ((_xtr.NodeType == XmlNodeType.Element) && (!_xtr.IsEmptyElement))
{
_currentField = _xtr.Name;
_xtr.Read();
if (_xtr.NodeType == XmlNodeType.Text)
{
switch (_currentField)
{
case "Status":
Console.WriteLine(_xtr.Value); //we print to console for testing purposes, normally assign it to a variable here!
break;
case "CountryCode":
Console.WriteLine(_xtr.Value);
break;
case "CountryName":
Console.WriteLine(_xtr.Value);
break;
case "RegionCode":
Console.WriteLine(_xtr.Value);
break;
case "RegionName":
Console.WriteLine(_xtr.Value);
break;
case "City":
Console.WriteLine(_xtr.Value);
break;
case "ZipPostalCode":
Console.WriteLine(_xtr.Value);
break;
case "Latitude":
Console.WriteLine(_xtr.Value);
break;
case "Longitude":
Console.WriteLine(_xtr.Value);
break;
case "Gmtoffset":
Console.WriteLine(_xtr.Value);
break;
case "Dstoffset":
Console.WriteLine(_xtr.Value);
break;
case "TimezoneName":
Console.WriteLine(_xtr.Value);
break;
case "Isdst":
Console.WriteLine(_xtr.Value);
break;
case "Ip":
Console.WriteLine(_xtr.Value);
break;
default:
// unknown field
throw new Exception("Unknown field in response.");
}
}
}
}
}
Console.ReadLine();
}
}
}
EDIT: this is the XML response returned
<?xml version="1.0" encoding="UTF-8" ?>
- <Response>
<Status>OK</Status>
<CountryCode>US</CountryCode>
<CountryName>United States</CountryName>
<RegionCode>06</RegionCode>
<RegionName>California</RegionName>
<City>Mountain View</City>
<ZipPostalCode>94043</ZipPostalCode>
<Latitude>37.4192</Latitude>
<Longitude>-122.057</Longitude>
<Gmtoffset>-28800</Gmtoffset>
<Dstoffset>0</Dstoffset>
<TimezoneName>America/Los_Angeles</TimezoneName>
<Isdst>0</Isdst>
<Ip>74.125.45.100</Ip>
</Response>

View 4 Replies

VS 2008 Calling Rest Web Service?

Aug 27, 2010

I am trying to interface a website we have with our helpdesk software. The helpdesk software has a REST API that i can connect to. So far I have been successful in getting a current ticket with the following code.

[Code]....

[URL] How would I implement this in ASP.Net? I want to create the ticket, and need to be able to retrieve the access key that it returns. I tried using the same code above, but instead changing the method string to this.

Code:

method = "request.create&tNote=Testing method&sFirstName=Jose"
But I get a "Bad Request" error from it.

View 3 Replies

Membership / Authorization Over A REST Service?

Mar 23, 2011

I'm investigating creating a WCF REST service for an existing asp.net application to be consumed by various clients including Windows Phone 7, Android, iPhone apps etc.Creating a simple WCF REST service and consuming it from the above platforms is not a problem and works really well. What I am struggling to get my head around is authorization.The asp.net application uses the Membership provider to provide authentication and authorization and I'm comfortable in using that API from the REST service.

How do I secure my REST service so that the first call has to be to authenticate (passing the username and password) and following calls know who is 'logged in'. I'm guessing the authenticate method will have to pass back some sort of token to be used in subsequent calls identifying the caller. Is this secure enough as the whole site / service is over SSL?

View 2 Replies

WCF REST Service AspCompatibilityMode Not Working In IIS?

Dec 3, 2010

Trying to deploy a wcf rest service inside of an asp.net web application. Works wonderfully when deploying to test server in visual studio, however when i deploy to iis 6 I get nothing. It is as if my service is not there at all.

here is my web config under system.service model:

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

and im registering a route in the global.cs

routes.Add(new ServiceRoute("Service", new WebServiceHostFactory3(), typeof(WcfJQueryService)));

my web service class is decorated with:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]

I am using windows authentication if that matters in this case.

View 1 Replies

WCF / ASMX :: Can Pass Object In Rest Service Uri

Jan 18, 2011

can Pass object in Rest Service Uri

View 1 Replies

WCF Rest Web Service Working On Localhost But Not On Host?

Mar 29, 2011

I made a simple WCF web-service inside an ASP.net website.

The web-service is hosted by IIS and works fine on localhost, ie when accessing for exemple to
[URL] I get the correct "Hello World" response as expected.

But accessing to it by my computer hostname [URL] gets me an error 404 response. This is particularly confusing as the remaining of the site (mainly aspx pages) is accessible without any problem from both ways.

[code]....

View 2 Replies

Consuming A WCF REST Service From Android Is Very Slow?

Aug 31, 2010

I have a WCF REST service built with C# and it returns an image as part of a CPU intensive operation. The client is running on Android (Java) By default, it will return a text JSON object that looks something like this:

{"d",[9,0,77,12,11,...]}

Those are they bytes of the image. Fine. However, all the solutions for decoding this JSON are intolerably slow. I've tried Gson, Jackson, and the built-in Android JSONObject class. I have no idea why they are so slow.

As an alternative solution, I have my REST service return a GUID, and then that GUID can be used by the Android client to go to a regular URL that serves up the image as a regular binary stream, via an MVC controller.

This works well, and it fast, and is pretty easy to handle on the Android side. However, it does feel like a bit of kludge and kind of a violation of the REST design principles. Am I missing something here? Is there a better way to do this?

View 4 Replies

Linq2Xml Parse Output From REST Web Service?

Jan 3, 2011

I am attempting to parse the XML output from a REST web service and have been pointed in the direction of using Linq2Xml to query the XML for the attributes that I am after. The XML output is as follows:

<?xml version="1.0" encoding="UTF-8"standalone="yes" ?>
<Response Status="OK">
<Item Name="NumberZones">2</Item>

[code]...

The returned datatable is empty, I have confirmed that result does have the XML assigned, and result.value is the string version of the XML file (200Westralia0{81C56183-31DA-45C2-90C3-81609F01B38B}Lounge10001{eac0109e-0090-a992-7fba-dc67fe29e6e7})Is anyone able to provide assistance in how I can read from the REST XML example above the name (ZoneName%) and the attribute value (Westralia and Lounge)?

View 1 Replies

WCF / ASMX :: Android Could Not Access REST Service?

Oct 26, 2010

[Code]....

this method i can access using asp.net but not by using a android.. i have checked for the headers etc.. the response is OK in android while debugging but the data is not inserted..

what is the equivalent of stringbuilder in android??

in android i use

StringEntity se = new StringEntity(json.toString());

//and post the data to my service...

post.setEntity(se);

what is the equivalent of stringentity in C# and what can i do for this prob?

View 2 Replies

WCF Rest Service Hosting On 2003 With POST / JSON

Mar 21, 2011

As I am getting Problem while hosting WCF Service on Win 2003 Server.As it is working fine in my local P

View 1 Replies

Patterns For A Data File Based WCF REST Web Service?

Mar 15, 2011

We have an existing, proprietary data processing application that runs on one of our servers and we wish to expose it as a web service for our clients to submit jobs remotely. In essence, the system takes a set of configuration parameters and one or more data files (the number of files depends on the particular configuration template, but the normal config is 2 files). The application then takes the input files, processes them, and outputs a single result data file (all files are delimited text / CSV or tab).

We want to now expose this process as a service. Based on our current setup and existing platforms, we are fairly confident that we want to go with WCF 4.0 as the framework and likely REST for the service format, though a SOAP implementation may be required at some point.

Although I am doing a lot of reading on SOA, WCF and REST, I am interested in other thoughts on how to model this service. In particular, the one-to-many relationship of job to required files for input. It seems pretty trivial to model a "job" in REST with the standard CRUD commands. However, the predefined "job type" parameter defines the number of files that must be included. A job type of "A" might call for two input files, while "B" requires 3 before the job can run.

Given that, what is best way to model the job? Do I include the multiple files in the initial creation of the job? Do I create a job and then have an "addFile" method where by I can then upload the necessary number of files?

The jobs will then have to run asynchronously because they can take time. Once complete, is it best to then just have a status field in the job object and require the client to regularly query the system for job status, or perhaps have the client provide a URL to "ping" when the job is complete?

View 1 Replies

WCF / ASMX :: How To Display Only Part Of A Page Using The REST Web Service

Oct 1, 2010

My code below

BtnClick
YahooSample();
public void YahooSample()
{
HttpWebRequest request = WebRequest.Create("http://developer.yahoo.com/yui/") as HttpWebRequest;

[Code]....

View 1 Replies

WCF / ASMX :: Post Arbitrary Data To An REST WCF Service?

Mar 30, 2010

How may I post arbitrary data to a REST WCF webservice? I mean, wihout use contracts.

Because my data is dynamic and I cannot have contracts, I want to get ride of the serialization overhead.

How should I declare my service and method?

View 1 Replies

Architecture :: Create REST Based Web Service Using Asmx?

Apr 12, 2010

Is it possible to create REST based web service using asmx?

View 1 Replies

Crystal Reports :: Create A JSON Rest Service

May 7, 2015

I was told to build a rest web service using asp.net so does the code below represent the same

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

[Code] ......

View 1 Replies

Crystal Reports :: Consume WCF Rest Service Using HttpClient

Mar 13, 2014

Why it is not working?

internal static int AddCatalog(string name, Guid key, string userName) {
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://localhost:25169/ScopraAdminRESTService.svc/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

[Code] ......

View 1 Replies

HttpHandler To Handle All Kinds Of URL's In Mono Apache/XSP In Order To Build A REST Service?

Apr 2, 2010

I want to develop my own REST service, so I've created an IHttpHandler that is configured with verb="*" and path="*", the the application in ~/MyRESTsrv/ will handle any derived URL.

This approach works good in IIS7 with "integrated mode" and apparently in IIS6 if you map all the extensions to "aspnet_isapi.dll".

Is this possible in Apache/XSP with Mono? Do I have to do something special or it will work out of the box?

View 1 Replies

How To Resolve WCF Rest MethodNotFound (405) Error When Appting To PUT Via WCF Rest Starter Kit HttpClient

Sep 2, 2010

I have looked at nearly every single WCF Rest PUT/POST issues on SO here and have still been unable to determine why I am unable to PUT or POST to my web service but am able to call a test GetTime method via GET. This particular service exchanges custom credential information (username, password and some other information) for a token. This token information is encrypted and added to the header of subsequent requests to other web services so that username/passwords don't have to be passed around everywhere. All web service calls are still treated as stateless, but require this auth header information rather username/passwords to access secured service operations.

[Code]....

I have also checked in IIS 7 the handler mappings for *.svc and checked that 'all verbs' are enabled.

View 1 Replies

C# - Deploying Precompiled WCF Rest - Error "service Not Defined"

Apr 2, 2010

I created an ASP.NET REST service (using WCF) and access it through one of my .aspx page. the problem is that when I publish (precomile) my code to the web server, I get an error :

"ThunServ not defined" in the Javascript console of my browser.

don't know what's causing it and how to solve it.

View 1 Replies

Consuming A WSE-enabled Web Service In A 2.0 Web Site?

Jan 25, 2011

I'm trying to consume a WSE enabled Web Service from an ASP.NET Web Site.I've installed WSE 3.0, used the config tool to add WSE info to my web.config and then done an Add Web Reference.I believe that the problem may be that this is a Web SITE, not a Web APPLICATION. As such, the proxy class is generated at runtime, perhaps not adding the WSE magic.I can access the proxy class from metadata, and it's of typeSystem.Web.Services.Protocols.SoapHttpClientProtocol, which as far as I can tell doesn't have any WSE functionality.I realize that this is all old technology, but I don't get to decide what the servers run :(

View 1 Replies

Call An Ajax - Enabled WCF Service With JQuery?

Jan 28, 2011

I have this Aja.svc in my root folder

[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Aja
{
[WebGet]
[OperationContract]
public string Hi()
{
return "hi world!";
}
}

and I'm trying to do this: $.get('Aja.svc?method=Hi', function(d) { alert(d.d); }); In firebug I see that the result is HTTP Error 404.17 - Not Found The requested content appears to be script and will not be served by the static file handler. I use .net 3.5, jquery 1.4.4

View 1 Replies

C# - How To Utilize A Rest API In 3.5

Nov 29, 2010

I have been given some basic documentation of the RazorGator REST API and need to incorporate it into an ASP.NET 3.5 site. I've created my class file to call the API which contains my WebRequest.Create ("URL TO API"). How do I then make the output available so that it can be consumed by other pages? That is, the tickets.aspx page needs to obtain the output results of this API call. What constructs should I use to make this available in tickets.aspx?

Edit
Here's the code I've written thus far:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Net;
using System.Text;
namespace SeatEater.Web.UI.search
{
public class RazorGatorService
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.razorgator.com/ticketservice/ticets.xml?blahblah") as HttpWebRequest ;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream, encode);
response.close();
readStream.close();
}
}

I receive the error message:

A field initializer cannot reference the nonstatic field, method, or property 'field'

in the second line of the above codeblock. I'm very new to using HttpWebRequest and HttpWebResponse. Can you advise me as to how to rectify the error message I'm receiving?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved