Tuesday, May 18, 2010

SPD (WCF connection) - Cannot find any matching endpoint

When adding a WCF connection to SPD 2010, you will hit "Cannot find any matching endpoint configuration" error, if you did not know the service endpoint URL (see figure 2).

Figure 1: Cannot find any matching endpoint.

Figure 2: WCF connection properties

If you look into the SharePoint ULS logs, you will see a corresponding error message "Could not initialize the endpoint components".

If you are connecting to ASMX based web service, the "Service Endpoint URL" is the ASMX service url. For example, if the ASMX service is hosted at http://myserver/service.asmx then the values for "Service Metadata URL" and "Service Endpoint URL" are as follows -

Service Metadata URL - http://myserver/service.asmx?wsdl
Service Endpoint URL - http://myserver/service.asmx

If you are connecting to WCF service, these values can get interesting. Now with WCF service, the service may not expose metadata endpoint, can expose WSDL endpoint or can expose MEX endpoint.

a) Metadata endpoint not exposed

When the metadata endpoint is not exposed by the WCF service, SPD (BCS) cannot consume that WCF service.

b) Metadata endpoint exposed as WSDL

When the WCF service exposes metadata as WSDL, its "Service Endpoint URL" can be determined by looking in the WSDL. Simply load the WSDL in the web browser ( http://myserver/service.svc?wsdl) and search for soap12:address in the WSDL. Typically it will appear in the end of the WSDL (see figure 3).

<wsdl:service name="Service">
<wsdl:port name="WSHttpBinding_IService" binding="tns:WSHttpBinding_Service">
<soap12:address location="http://myserver/Service.svc" /> 
<Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">

Figure 3: Service Endpoint URL in WSDL

There can be more than one soap address in the WSDL, if the service exposes different bindings for these addresses. Depending on your requirement you can choose one of the service address.

c) Metadata endpoint exposed as MEX

When the metadata is exposed as MEX, you will need to read the endpoint addresses using svcutil.exe (http://msdn.microsoft.com/en-us/library/aa347733.aspx). When you execute svcutil.exe against the MEX endpoint, it will generate a config file. In the config file, search for "client" tag (it appears at the end of config file). Look at the addresses for the endpoint.

  <endpoint address="http://myserver/service.svc/basicHttpBinding"
                binding="basicHttpBinding" bindingConfiguration="MyService"
                contract="IServiceInterface" name="ConsoleService" />
Figure 4: Service Endpoint URL through MEX endpoint

The addresses mentioned in the config file are the "Service Endpoint URL" that SPD will understand.


Amr Ellafy said...

You saved my day man ! thanks a million

vishy said...

It works. Thanks a lot.

Carolee said...

You absolutely rock. Thank you!

Anonymous said...


Anonymous said...

Thanks it worked

Anonymous said...

Your the man!!!!!!!!!!!!!!! You made me sleep better tonight lol

ologunoba said...

Thanks a bunch, just saved me hours of troubleshooting

Daniel Lee said...

I am developing the service locally. Obviously, my laptop will not be its final destination, but for troubleshooting it's all local. To see more info please visit http://essayswriters.org/dissertation/

Abul Haseeb Raja said...

Thanks man