Solved

.NET WSDL Genericism Problem

Posted on 2011-09-21
3
365 Views
Last Modified: 2013-12-17
I have been asked to integrate a client's Magento shopping cart by pulling orders into our system using SOAP. We are talking to a new client with the same request. My problem is, unlike other web references like amazon etc, this will require a unique web reference for each client hosting the magento code, but the methods, objects and algorithms that will be used are all the same.

How do I create a single class that can handle these generically?

Example of what I DON'T want to have to do:
using Company1MagentoRef;
using Company2MagentoRef;


...

if(company == company1)
{
    Company1MagentoRef.MagentoService man = new  Company1MagentoRef.MagentoService();

    string sessionId = man.login(username,apiKey);
    MagentoOrderEntity [] moe = man.getOrders(sessionId);
    // Do a bunch of processing
    man.EndSession();
}
else if(company == company2)
{
    Company2MagentoRef.MagentoService man = new  Company2MagentoRef.MagentoService();

    string sessionId = man.login(username,apiKey);
    MagentoOrderEntity [] moe = man.getOrders(sessionId);
    // Do a bunch of processing
    man.EndSession();
}

... etc

Open in new window

0
Comment
Question by:EndersDev
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
gena17 earned 250 total points
ID: 36575287
I think you can set the URL of the service dynamically just before using it.
You just need to set URL Behavior property to Dynamic.
See here: http://msdn.microsoft.com/en-us/library/tydxdyw9.aspx
0
 
LVL 2

Author Comment

by:EndersDev
ID: 36576708


In .Net 4.0 the URL behavior is already dynamic, so it was as simple as setting the URL property to point to the WS. (omitting the  ?wsdl  portion, for anyone else wanting to do the same)

Thanks
0
 
LVL 2

Author Closing Comment

by:EndersDev
ID: 36576736
The solution gave enough that I knew what to research, but it could have been more direct (e.g.: "Set the URL property, and don't forget to drop the ?wsdl at the end of the URL if applicable")
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

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