?
Solved

WSDLs with same definition

Posted on 2011-02-25
2
Medium Priority
?
498 Views
Last Modified: 2012-05-11
Hello,

We are using the PayPal Pro service and they have two different WSDLs, one for testing (sandbox) and one for production (live).  They are located at two different urls but have the exact same definition, as of now at least.

 We are using C# 4.0 and consuming them as a Service Reference in our back-end class library.  Then our web application makes as normal to the back-end in order to process payment.

Our issue is how to handle switching between definitions and endpoint locations?  We would like to be able to set some web.config app key value to determine if its should use the Test (sandbox) WSDL or the live WSDL but not sure how to do this.

It seems that we should be able to handle the endpoint as a config value and grab that when we build a request.  So I guess are main issue is understanding how to use the definitions themselves.  We want to just use one instance of a payment class and method(s) to make the calls but when we "import" both namespaces, there is ambiguity because they are same definition.  As such:

using PayPalSvc;
using PayPalSvcSandbox;

Doesn't really make sense to do it this way anyways.  So if we can't import both namespaces for the two different WSDLs it seems are choices are one of the following:

1. Create separate classes/methods and detect in the calling method which one to call.  Our issue here is we don't want redundant classes/methods.

2. Or just use one of the definitions since they are the same and call different endpoints.  Our issue here is there must be a reason there are separate WSDL locations.

Neither of these sound like a great solution.  Anybody have any ideas?  This can't be that unusual of a scenario where an external company has different WSDL definition locations for different environments.  

Thanks.
0
Comment
Question by:kruegerste
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
ksrsrinivasan earned 1000 total points
ID: 34985752
You are in the right direction. Just add one service reference to the PayPal live URL.. and when making the actual call, decide on whether to use the Live/Test URL from your configuration.. a sample code would look like
var binding = new BasicHttpBinding();
var remoteAddress = new EndpointAddress("<your test/live URL>");
var client = new <PayPayClient>(binding, remoteAddress);

Open in new window

0
 
LVL 23

Assisted Solution

by:Siva Prasanna Kumar
Siva Prasanna Kumar earned 1000 total points
ID: 34985760
The WSDLs in testing environment and live are same which make sense, depending on where you want to send the request to all you need to do is set/configure the endpoint to the exact target environment.

The advantage of the above approach is first you build you web app and test it thoroughly and when moving to production all you need to do is change the endpoint of your service client to the production web service endpoint.

Please check the below links about configuring the endpoints.

http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/1b909664-2578-48f7-8e4b-31531637ba77/

http://bytes.com/topic/net/answers/696769-change-wcf-client-endpoint-address
0

Featured Post

Python: Series & Data Frames With Pandas

Learn the basics of Python’s pandas library of series & data frames and how we can use these tools for data manipulation.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

765 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