Deploying a SharePoint WebPart with its Web Service Reference

tekiegreg picture tekiegreg · Jan 14, 2009 · Viewed 9.8k times · Source

I'm trying to built a SharePoint Web Part that has as part of it a service reference to Another SharePoint server that I need to call from within vb code. However when I try to call the remote web service for the first time, I get the following in the log:


Could not find default endpoint element that references contract 'ListReference.ListsSoap' 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. at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName) at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName) at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address) at System.ServiceModel.ChannelFactory1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress) at System.ServiceModel.EndpointTrait1.CreateSimplexFactory() at System.ServiceModel.ClientBase1.CreateChannelFactoryRef(EndpointTrait1 endpointTrait) at System.ServiceModel.ClientBase1.InitializeChannelFactoryRef() at System.ServiceModel.ClientBase1..ctor() at VSeWSS.ChangeRequestWorkflow.ChangeRequest.SubmitForm(Object sender, EventArgs e)


What is the proper way to deploy a Web Part with a Service Reference, could I be doing something wrong? Thanks!

Answer

dcgartn picture dcgartn · Jan 15, 2009

You need to add the endpoint configuration into the web.config of the SharePoint site that is consuming the webservice.