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


Similar Messages:

Iis - Error Message When Using REST Starter Kit?

Mar 24, 2010

I've written some code using the REST starter kit and it works fine on my development machine. However, when I upload it to our server the page gives me the following error message... CS1684: Warning as Error: Reference to type 'System.Runtime.Serialization.Json.DataContractJsonSerializer' claims it is defined in 'c:WINNTassemblyGAC_MSILSystem.ServiceModel.Web3.5.0.0__31bf3856ad364e35System.ServiceModel.Web.dll', but it could not be foundI've removed code line by line and it appears that the following line of code is triggering the error...HttpContent newOrganizationContent = HttpContentExtensions.CreateXmlSerializable(newOrganizationXml);Really haven't got a clue how to fix it. I assumed it might be because it needs a newer version of the framework to run, but looking in IIS it says it's running version 2.0.50727 which I think is the lates version because it says that even when we're using framework 3.5

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

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

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

Connecting Via REST API To Tomcat - 505 Error

Dec 7, 2010

Everything looks good but Wireshark shows 505 coming back (HTTP/1.1 505 HTTP Version Not Supported). Tomcat admin sites post that says .NET has a known bug where HTTP 1.1 is handled correctly:

[URL]

To me it seems like a Tomcat issue because I trust that if this was a Microsoft issue they would've released a patch by now, but regardless, he thinks that if I change to HTTP 1.0 the problem will resolve itself. I do not see any property in HttpClient or HttpClient.TransportSettings to control this.

Has anyone ran into this before or know how to set the HTTP version with the REST API?

View 1 Replies

WCF / ASMX :: Custom Basic Authentication With WCF REST / Getting Error "401 - Unauthorized"

Mar 30, 2010

I want to implement a custom authentication in my application using the basic authentication schema. I've configured it in the Web.config and enabled the basic authentication in the IIS, but when I try to open the service in the browser... appears a login dialog... what do I have to put ther? Besides, I want to control the authentication, I mean, I want to check whom is allowed in my custom list... where is it looking now?

When I use the WebRequest class, I'm getting a "401 - Unauthorized":

req = WebRequest.Create("http://localhost/RESTfulService/Service1.svc/Test");
req.Credentials = CredentialCache.DefaultNetworkCredentials;
WebResponse res = req.GetResponse();

What do I have to do for implement a custom basic authentication? (I cannot use membership providers).

I've set up in the Web.config:

[code]....

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

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

WCF / ASMX :: REST IIS 7 Bad Request 400

Sep 23, 2010

tried so many different things but havent got past this seemingly trivial problem. I created a WCF service application from visual studio 2010 WCF templates. it generated the IService.cs and Service1.svc files and generated the web.config

i created a website in IIS 7 on windows 2008, and pointed it to the app folder. when i go to [URL] via web browser, i get a message indicating service is running and suggests using svcutil etc etc., but when i go to [URL] the web browser says 400 bad request. this is without changing anything from what VS generated. the operation contract looks like

[Code]....

Update: forgot to mention i even tried decorating the operation with WebGet attribute with UriTemplate parameter, without luck.

View 4 Replies

MVC :: Consume Wcf 4.0 Rest Services?

Oct 5, 2010

how to consume wcf rest services in asp.net MVC? there is any standards are available? in my project SOA, so all the data came from wcf 4.0 rest services if there is any coding examples or resources to consume wcf services in MVC 2.0

View 2 Replies

C# - How To Build URL Of WCF REST Web Services

Oct 26, 2010

I am using the new .NET 4 WCF REST web services. In order to link resources, I'd like to put links in my responses. In ASP.NET I can generate URLs from my routing configuration (e.g. UrlHelper.Action(...))

With WCF REST web services I have an ASP.NET routing configuration plus Uri templates:

[WebGet(UriTemplate = "{id}")]
MyResult Index(string id) {...}

I want to store related URIs in my result objects. How can I construct URLs from my routing configuration + UriTemplates without hardcoding base URLs or other information?

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

Filling The Rest Of The Page With CSS?

Feb 22, 2010

I have three Divs on the page and they are absolute positioned. Lets call them leftDiv,middleDiv,rightDiv and middleDiv width is 900px which is okay but the left and right divs should fill the remaining the left and right parts respectively no matter what screen size is.

The reason why I use absolute positioning is because it is the only way to use height:100% to fill the page.

So how can I fill the remaining parts?

Of course these divs separate page into three pieces according to their names imply.

View 3 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

How To Turn The Rest Of The Word After The '@' Into A Hyperlink

Feb 24, 2011

I am parsing a tweet and need to search for any words that begin with '@'. I want to turn the rest of the word after the '@' into a hyperlink. I have a partial solution, but my problem is that the link which gets generated includes the '@' in the link text and the hyperlink, but I only want the text after the '@'.

Example:

"Username @SomeName blah blah blah blah"

I want to create the hyperlink text: http://twitter/SomeName

I have the following partial solution:


ASP Code:

body = Regex.Replace(body, "(@[^ ]*[a-zA-Z0-9])", "<a href="http://www.twitter.com/$1" target="_blank">$1</a>");

View 2 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 :: Writing A .NET REST Wrapper?

Oct 5, 2010

I am a REST web service newbie, does visual studio, .NET, or some other nifty microsoft tool provide any easy way to auto generate classes to consume a REST web service? With REST services is there even a service definition like there is with SOAP (WSDL) beyond the printed documentation? There is a new service that I'd like to consume but they only wrote wrappers for PHP, Pearl, Ruby, and Java and have more or less said you are on your own with .NET. I could write it myself but I'd like to cut corners and save time wherever possible.

View 1 Replies

MVC :: 2.0 Futures REST - Cross Domain - JSONP

May 5, 2010

I´m using mvc futures 2 with WebApiEnabled for XML and JSON support. But due to cross domain issues with jQuery $.ajax I´m lookin in to JSONP. Is there a simple way to extend futures rest function for JSONP or should I do something else.

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

ADO.NET :: WCF For Existing REST Webservice - Consume Like OData

Mar 11, 2011

I have an existing RESTful webservice that I consume (I did not create) from a 3rd party. I currently use WebRequest and WebResponse to create and read the request and response. I access the service by url with query string parameters to pass what type of data I am requesting. I get the results back in XML, then have to load it into a new XmlDocument, create a bunch of DataSets, XmlNodeReaders, DataTables, etc. It's really messy in my opinion.

What I am looking to accomplish is to take advantage of the Entity Framework Model, OData, and WCF. I have never create or used WCF yet. The webservice that I am accessing is some sort of service created from within Apache, it is not .Net. I don't know whether or not I can utilize the new .Net Framework 4.0 services to make the consumption of this service any better, easier, or cleaner.

View 5 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







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