73726

Running SOAP and RESTful on the same URL

Question:

Say we have a website that responds to a host header "kebab-shop.intra.net"

Is is possible to have both SOAP and RESTful in this URL?

That is, both of these are handled within the deployed code.

<ul><li>kebab-shop.intra.net/takeaway.asmx</li> <li>kebab-shop.intra.net/kebab/get/...</li> </ul>

I've been told this can't be done, without much explanation. <a href="https://stackoverflow.com/questions/1326963/restful-and-soap/1328569#1328569" rel="nofollow">Like this answer</a>. This could be, I'm a database monkey, but I'd like some thoughts on what options I do or don't have please.

Thoughts so far

<ul><li>Separate host headers eg add kebab-shop-rest.intra.net</li> <li>Separate web sites</li> </ul>

Ideally, I'd like to have one web site, one <strike>URL</strike> domain name, one host header. Zero chance?

This is IIS 6 with .net 4. And we have some <em>large corporate</em> limitations that mean we are limited to a zip file to drop into the relevant folder used by the web site. This is intended to allow our clients to migrate without incurring the <em>large corporate</em> support, infrastructure and deployment overhead. The co-existence will only be for a month or three.

Edit: I'm asking because I'm not web developer. If my terms are wrong, this is why...

So... I want both SOAP and REST on kebab-shop.intra.net on IIS 6 without complexity.

Answer1:

<blockquote>

That is, both of these are handled within the deployed code.

* kebab-shop.intra.net/takeaway.asmx * kebab-shop.intra.net/kebab/get/... </blockquote>

Yes, that should definitely be possible. If you have a single WCF service, you could easily expose two separate endpoints for the same service - one using e.g. basicHttpBinding (roughly equivalent to ASMX), and another with webHttpBinding (REST).

The complete URL's must be different - but the first part can be the same, I believe.

If you're hosting in IIS6, you need one virtual directory and that will partly dictate your SOAP endpoint - it will have to be something like:

http://kebab-shop.intra.net/YourVirtDir/takeaway.svc

(or: http://kebab-shop.intra.net/YourVirtDir/takeaway.asmx if you insist on using an ASP.NET legacy webservice).

and the REST endpoint can live inside the same virtual directory and define URI templates, e.g. you could have something like:

http://kebab-shop.intra.net/YourVirtDir/TakeKebab/gbn

or similar URL's.

<strong>However:</strong> checking this out myself I found that you cannot have both service endpoints "live" off the same base address - one of them has to have another "relative address" associated with it.

So either you add e.g. "SOAP" to your SOAP endpoint

http://kebab-shop.intra.net/YourVirtDir/takeaway.svc/SOAP/GetKebab http://kebab-shop.intra.net/YourVirtDir/TakeKebab/gbn

or you add something to your REST service

http://kebab-shop.intra.net/YourVirtDir/takeaway.svc/GetKebab http://kebab-shop.intra.net/YourVirtDir/REST/TakeKebab/gbn

Answer2:

I don't see a reason why you can't. Typìcally your SOAP endpoints will be one specific URLs per service, whereas for resources exposed via REST you will have one URL per resource (following 'URL patterns').

Example URLs for SOAP:

http://kebab-shop.intra.net/soap/service1 http://kebab-shop.intra.net/soap/service2

Example URL patterns for REST:

http://kebab-shop.intra.net/rest/{resourcetype}/{id}/ e.g.: http://kebab-shop.intra.net/rest/monkeys/32/

etc...

Recommend

  • does WCF's NetTCPBinding supports Socks Proxy?
  • display selected value of the drop down in jsp page
  • .NET Obfuscation [SmartAssembly]
  • ASP.Net Routing in asp.net web-forms
  • C Language: Why does malloc() return a pointer, and not the value?
  • AWS S3 implementation for serving private files
  • Using LINQ with IBM i
  • Errno::ECONNREFUSED No connection could be made because
  • possible limitation of implode function in PHP
  • segue from landscape only to portrait only
  • CoreData basics – to-many relationship array data
  • Eloquent Relationship on Partial Match
  • Client side validation mvc dropdown
  • Pre-populated SQLite Database not reading properly in Android Studio
  • Deploying a CodeRush plugin from the Community Site
  • XMLBeans Duplicate Class and Class Not Found Errors
  • Why must we declare a variable name when adding a method to a struct in Golang?
  • How to override value that appears in a dropdown in the rails_admin gem
  • Python ImageIO Gif Set Delay Between Frames
  • jwtBearer bearer token with rc-1 update to ASP.Net 5
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • pillow imaging ImportError
  • How to add git credentials to the build so it would be able to be used within a shell code?
  • Should I or shouldn't I use the CachingConnectionFactory with hornetq 2.4.1
  • Textfile Structure (tables)
  • Email verification using google app script and google forms
  • Change Inet root folder for iis 7
  • Paperclip, set path outside of rails root folder
  • All Classes Conforming to Protocol Inherit Default Implementation
  • What is Eclipse's Declaration View used for?
  • req.body is undefined - nodejs
  • Websockets service method fails during R startup
  • WOWZA + RTMP + HTML5 Playback?
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Proper folder structure for lots of source files
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How do you join a server to an Active Directory (domain)?
  • coudnt use logback because of log4j
  • Append folder name and increment by 1 using batch script