Solved

WSDLs with same definition

Posted on 2011-02-25
2
490 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

803 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