Take the 2-minute tour ×

I am trying to consume an existing web-service from another company and have troubles to find a solution to use the same web-service from different location.

An existing web-service is available at the address http://url.to.A/webservice/ and I am able to generate a C++ proxy class for this service using sproxy.exe from the ATL tools.

Using that class, I can consume the web-service without any problem.

Now I need to consume the same web-service but from another URL (let's say http://url.to.B/webservice/) and the previously created proxy class is not working. The SendRequest method inside one of method proxy always returns an erroneous HRESULT code. Generating a new proxy specifically for this second service gives a working solution BTW.

When I say that the services are the same I mean that they expose exactly the same methods so that their respective wsdl definition files differ only by the service URL.

I've tried to change the URL property of the generated proxy class instance but it doesn't help.

Given that I am tied to use unmanaged C++ for the consuming part and that I would like to be able to specify the service endpoint at runtime, is there a viable solution to my problem?

Thanks for your help.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

It finally turned out that it's not possible, using sproxy.exe, to generate a class that can be dynamically assigned to a webservice endpoint.

share|improve this answer

Generate a separate proxy class for each server/service.

Then do a diff on the generated code. That should let you know what the differences are.

share|improve this answer
Thanks. The differences are only related to the URL of the service which is hard-coded at different places of the class, but in const members of some ATL structs... –  Yannick Blondeau Nov 9 '12 at 9:03
Then the difference would be in the server. Perhaps a permissions problem. Can you access the server using a browser? –  Steve Wellens Nov 9 '12 at 13:31
Yes, "unfortunately" I'm able to access both URLs through a browser... Thanks for the hint BTW. –  Yannick Blondeau Nov 9 '12 at 15:45
Not sure if you got me right but I've indeed only one app. And it's working with both proxies. But I'm wondering if it can work with only one proxy, as in the end the web-service location should be configurable... Thanks for the help. –  Yannick Blondeau Nov 9 '12 at 16:15

Your Answer


