0

Im consuming some webservice from a third-party product. So ive add righ-clicking on service reference and generating the code on the web.config file.

But the problem is, foreach company i consume the service, they have one endpoint address (and they have more then 30 companies). So, its insane to add one reference foreach company (to execute the same method in these webservices).

So, i would like to know if it is possible and how can i do a WebServiceHelper class, with some GetWebService(url) method wich allows me send just the url of the webservice and create my service model.

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_ITestService" receiveTimeout="10:00:00"
      sendTimeout="10:00:00" maxReceivedMessageSize="2147483647" transferMode="Buffered"
      useDefaultWebProxy="true" />       
  </basicHttpBinding>
</bindings>
<client>      
  <endpoint address="http://xxxx.xxx"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestService"
    contract="Test.TESTSOAP" name="BasicHttpBinding_ITestService" />
</client>

3
  • 1
    If you create your own proxy you could just pass in the URL, however I doubt each of those 30 companies uses the exact same interface. If they do, just use your own proxy. Commented Mar 21, 2014 at 18:36
  • @LordTakkera ,yes they use the same interface, its a limitation of the thid-party product, they must create one webservice foreach company, and they have the same methods. I never create it, do you have some good link of creating a proxy? Commented Mar 21, 2014 at 19:26
  • @LordTakkera, for example, if i reference a service using the scvutil auto generated code, it creates the contract=Company01.GENERALCONTRACT, Company02.GENERALCONTRACT, but it is the same 'root' contract always. I need to create a interface with the same GENERALCONTRACT members? Commented Mar 21, 2014 at 19:30

1 Answer 1

1

We should be able to create a c# file from WSDL, same way as SVCUTIL does and then use reflection to create a proxy at run time.

Please follow through this article and download the source code provided.

DynamicProxyFactory

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.