0

Our third party API provides two different web services but have identical methods, models. Nevertheless they only differ on URIs (Web Service Path, Action Path [Operation Contract].

So I have decided to:

  1. Generate the code from their wsdl using VS.

  2. Edit the namespacing to use the same and to be "Common" and not use the service reference instead i use the Reference.cs edited code.

  3. Create a new proxy that will handle the correct URI of the service to use (wrapped the Reference.cs inside of it).

Now, I having an issue with the "Method1", because they have different Action Name. Having an exception of:

"Server did not recognize the value of HTTP Header SOAPAction: http://www.api.com/service/Method1"

I just notice that it the correct action name is: http://www.api.com/service1/Method1

The question now is, is there any configuration or behavior that i can use to correct the action name for each method for each service?

Or as long as they keep on adding contracts for each implementation of the API, i should also keep on adding the contracts for each, and just use the ChannelFactory for this?

Please help, thanks.

Peyton Crow
  • 872
  • 4
  • 9

1 Answers1

1

I ended up directly using the ChannelFactory when faced with the same problem

In my implementation, I had a base interface that had all the common methods to the 2 APIs. Then I had 2 seperate intefaces - one for each 3-rd party API version - that inherits from the base interface and adds methods and [OperationContract] attributes that varied between the two implementations.

When instantianting ChannelFactory<> I used one of the child interfaces. Helped to keep the consumer code clean and maintainable

viki
  • 1,178
  • 1
  • 17
  • 22
Naraen
  • 3,240
  • 2
  • 22
  • 20
  • Thanks for that, it really clears out that ChannelFactory is the right one for here. When you say you used one of the child interfaces, does it mean below? `interface Base` `interface Api1 : Base` `interface Api2 : Base` `ChannelFactory` ` Is this correct? I just wonder because i end up using the seperate contracts when creating instance of the ChannelFactor. – Peyton Crow Apr 19 '11 at 01:30