views:

23

answers:

2

Hi all, I want to create a create a WCF Service which is invoked on the button click of MS Access Form. Please help me out.

Kind Regards,

Shahid Hazoor

A: 

You cannot consume a WCF directly with MS Access.

If you own the WCF service, you would have to change it to a web service using HTTP bindings.

If you don't own it, you will have to write your own web service that is basically a wrapper around the WCF.

Then you can consume it as a web service in MS Access.

Raj More
+3  A: 

You CAN consume WCF services through MS Access, but not via standard WCF mechanisms. You'll need to consume the service via GET requests, POST requests, or SOAP requests.

  1. One way to accomplish this for SOAP requests on the Access side is using the SOAP toolkit: http://msdn.microsoft.com/en-us/library/aa140260%28office.10%29.aspx

  2. Another way that would work for GET, POST or SOAP requests is using XMLHTTP (if you go the SOAP route, you'll need to make your own SOAP envelope in the XML): http://www.codemaker.co.uk/it/tips/ado_conn.htm (search for XMLHTTP)

On the WCF side you have a couple of choices:

  1. Host a WebHttpBinding service. This gives you options to expose GET and POST endpoints for your services. See http://www.windowsitpro.com/article/net-framework2/exposing-classic-http-endpoints-with-wcf-in-net-3-5.aspx.

  2. Host a BasicHttpBinding service that exposes a SOAP endpoint (this is the default WCF endpoint if you create a new service in Visual Studio). If you go this route, you probably want to set it to use legacy XML serialization and WSDL for compatibility if you go with option 1 on the access end (see http://msdn.microsoft.com/en-us/library/system.servicemodel.xmlserializerformatattribute.aspx).

One other thing to note: If you create a BasicHttpBinding WCF Service with XmlSerializerFormatAttribute, you are basically getting (from a data exchange standpoint) the same thing as if you were to write a legacy asmx service.

JeffN825
This is a really nice, complete answer, with lots of interesting stuff drawn together in one place. +1 -- I'd give +5 if I could.
David-W-Fenton