Solved

What is the Standard for Two - way WebService Communication between two services C# .NET

Posted on 2010-09-20
9
662 Views
Last Modified: 2013-11-26
Hava a quick Question,. but it is important - We Have two webservices accessing different DB's that both need to talk to one another.  We created a project that references both, and does the communication through a proxy class.  This is in turn, a circular reference.  My question is, what is the standard for handling cross webservice communication  ?  A seperate service that accesses both DB's ?

Thank you for your insight,

Tom
0
Comment
Question by:gsdevEE
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 35

Expert Comment

by:Miguel Oz
ID: 33721884
If you are using VS2008, use WCF callbacks:
http://idunno.org/archive/2008/05/29/wcf-callbacks-a-beginners-guide.aspx
http://www.devx.com/dotnet/Article/38814
http://msdn.microsoft.com/en-us/magazine/cc163537.aspx
Even though the examples are not web services, it is just a matter of hosting the WCF library on the web service and define the binding as "WsDualHttpBinding".

Note: Only .net web services/clients can use the callback mechanism. Web services by default do not support callbacks.
0
 
LVL 51

Expert Comment

by:Ted Bouskill
ID: 33722208
Why do you have all the extra moving parts and complexity?  Could you solve your problem without web services?  What problem is the web service solving that you can'd do any other way?
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 33724057
In my world there seem to be two architectures that get a lot of attention: SOAP and REST.  SOAP is complicated and difficult; REST is simple and easy to implement.  Here are links to a quick overview of those things.
http://en.wikipedia.org/wiki/SOAP
http://en.wikipedia.org/wiki/REST

In the RESTful way of web services, every request is atomic and complete (HTTP is a RESTful architecture) and there is no call-to-call dependency.  REST is stateless.  Examples of RESTful web services include the elegant and well-documented Yahoo Geocoder.  Though it is deprecated for unrelated reasons, it is one of the best examples of a successful web service ever written.
http://developer.yahoo.com/maps/rest/V1/geocode.html
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:gsdevEE
ID: 33725044
mas - I will look

ted billy - Architecture restrictions

Ray = is rest implementable by .Net applications/C# ?  Deprecated sounds like there may be some dirty little secrets
0
 

Author Comment

by:gsdevEE
ID: 33725051
Ray- do you know of any examples being used by .net I can look at for REST >?
0
 

Author Comment

by:gsdevEE
ID: 33725405
mas - is this available in 2.0 ???
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 33725417
The Yahoo Geocoder (linked above) is deprecated for unrelated reasons - they offer a new technology.  The DESIGN PATTERN is what we're after here, and it is a perfect example of a RESTful implementation.  There are no dirty secrets.

Yes, REST is implementable in almost any imaginable language.  I'm not a .NET guy, but maybe you can see through the PHP code here in my teaching example of a REST service.  In its simplest design, you send URL arguments (GET strings) and read the browser output stream.  The answers might be formatted with XML or JSON, or just presented as simple strings.
<?php // RAY_REST_get_last_name.php
error_reporting(E_ALL);



// DEMONSTRATE HOW A RESTFUL WEB SERVICE WORKS - INPUT FIRST NAME, OUTPUT LAST NAME
// CALLING EXAMPLE:
// file_get_contents('http://laprbass.com/RAY_REST_get_last_name.php?key=ABC&resp=XML&name=Ray');



// OUR DATA MODEL CONTAINS ALL THE ANSWERS - THIS COULD BE A DATA BASE - AS SIMPLE OR COMPLEX AS NEEDED
$dataModel
= array
( 'Brian'   => 'Portlock'
, 'Ray'     => 'Paseur'
, 'Richard' => 'Quadling'
, 'Dave'    => 'Baldwin'
)
;


// SHOULD RESPONSE BE PLAIN TEXT OR XML FORMAT
$alpha = '';
$omega = '';
if ( (isset($_GET["resp"])) && ($_GET["resp"] == 'XML') )
{
    $alpha = '<response>';
    $omega = '</response>';
}



// TEST THE API KEY - THE ASSUMPTION IS FAILURE
$key = FALSE;

// IF THE URL CONTAINS THE KEY
if (isset($_GET["key"])) $key = $_GET["key"];

// IF THE KEY FAILS TO MATCH OUR OUR REQUIRED 'ABC'
if ($key !== 'ABC') die($alpha . 'BOGUS API KEY' . $omega);



// LOOK UP THE LAST NAME - THE ASSUMPTION IS FAILURE
$name="?";

// IF THE URL CONTAINS THE FIRST NAME
if (isset($_GET["name"])) $name = $_GET["name"];

// IF THE URL NAME IS FOUND IN THE DATA MODEL
if (array_key_exists($name, $dataModel))
{
    // RETURNS THE LAST NAME FROM THE DATA MODEL
    die($alpha . "$dataModel[$name]" . $omega);
}

// RETURNS THE UNKNOWN NAME INDICATOR
else die($alpha . 'UNKNOWN' . $omega);

Open in new window

0
 
LVL 35

Accepted Solution

by:
Miguel Oz earned 500 total points
ID: 33730188
my comments are for v3.5.
In 2.0 you can not do it with web services unless you do remoting (WCF replaces remoting, the latter is now legacy technology). some comparisons:
http://wcfvsremoting.codeplex.com/
http://social.msdn.microsoft.com/forums/en-US/wcf/thread/5219ca92-df97-451d-a44c-cfa4a88c10ae/

Migration issues when upgrading from remoting to WCF:
http://msdn.microsoft.com/en-us/library/aa730857(VS.80).aspx
0
 
LVL 1

Expert Comment

by:bharathbkt
ID: 33732236
If use are uisng .Net 3.5, you can use Duplex Mode of MEP(Message Exchange Pattern) in WCF.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error on link 14 46
C# Single Form 8 42
Alert on Server memory 2 21
VB.Net/LINQ: ".Contains" condition not finding existing result in MSSQL 16 35
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question