Consuming Web Service from WCF

I have created a WCF service, now this WCF service has to call a Web Service. What I am doing is adding the service reference of web service in WCF and calling the method of the web service which I want to use.

Just an example shown below :

CalcWebReference.CalculatorSoapClient fct = 
    new CalcWebReference.CalculatorSoapClient();
int rq = fct.Add(q, r); 
return rq;

Now this method when I tried to call from the client it is giving following error

The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

Thanks i did what u told but now i am getting following error "Could not find default endpoint element that references contract 'CalcWebReference.CalculatorSoap' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element."

Now do i need to give some end points in the WCF service or in the web service to get the function from web service and if so then how do i give it.

Please help.


CalcWebReference.CalculatorSoapClient is reffering to the web service not WCF. Given below is the code written in WCF(sample code) which is calling the web service :-

CalcWebReference.CalculatorSoapClient fct = new CalcWebReference.CalculatorSoapClient();

            int rq = fct.Add(12, 10);

            return rq;

Am i not putting the syntax right or is there any additional thing that i need to do in this?


This is the generic WCF "something bad happened" error message. That won't really be much help.


  • make sure the web service you're calling works on its own - otherwise fix it!

  • enable the detailed error information, as described in the error message, by including the error details in your WCF service (do this in DEV environments only! Never in production...)

  • try to launch your WCF service inside Visual Studio and debug what's happening

In order to enable detailed error reporting, you need to add this section to your WCF service's configuration:

        <behavior name="DebugBehavior">
            <serviceDebug includeExceptionDetailInFaults="True" />

You might already have a service behavior configured - in that case, just add the <serviceDebug> tag to your service behavior.

If you don't have a service config yet - you'll also need to make sure your service actually uses that service config:

<service name="YourServiceNameHere" 

Make sure to have a behaviorConfiguration= attribute on your <service> tag, and make sure to reference that defined service behavior (by specifying its <behavior name="..." > property).

Once you've done that, your error should hopefully give you more information - you should definitely get an .InnerException on your exception that should point you in the right direction.

Need Your Help

Rails form_for with nested resources: “No route matches”

ruby-on-rails-3 routes form-for nested-resources

I have the following nested resources in my routes.rb file. The inner resource specifies a controller name.

when to prefer pessimistic model of transaction isolation over optimistic one?

sql-server database database-design transactions locking

Do I understand correctly that table/row lock hints are being used for pessimistic transaction (TX) isolation models of concurrency ONLY?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.