Solved

WSDLs with same definition

Posted on 2011-02-25
2
487 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
2 Comments
 
LVL 6

Accepted Solution

by:
ksrsrinivasan earned 250 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 250 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Allow space in this pattern 2 47
Help with solving error related to resources file 4 35
Not showing page correctly 3 29
Error in JQuery 5 37
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 …
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now