Solved

WSDLs with same definition

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

743 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

11 Experts available now in Live!

Get 1:1 Help Now