Question

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!

Was it helpful?

Solution

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

OTHER TIPS

I found this question that solved my problem. Basically, I just needed to create a BasicHttpBinding object and populate its properties with the ones the SVC generator made in my app.config.

WCF Configuration without a config file

Actually I solved my problem. My application has many projects, and the config file was in the project calling the WebService, but it seems it has to be in the starting project...

Hm, if I'm understanding what you're asking correctly, I'm doing that. I just added the webservice from one of the correct endpoints to the project in VS, then before I call it in my actual code, I get the URL I want to connect to with this call from the hierarchical object store from Codeplex, then set the Url property. So:

MyService srv = new MyService();
srv.Url = SPContext.Current.Web.Properties["serviceurl"];

Its working like that fine. hth.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top