07 May, 2008 12:13
Accessing WCF Service from infopath Data Source
Posted by mimo under [ Workflow ][ (0) Comment ] | [ (0) Trackbacks ]
I have been constructing a workflow based service engine using WCF and WF with the intention of using infopath forms to route data through the engine.
Fortunately, the company that supplies our Project Services Automation system BSTGlobal has built just such an engine they call BSTFX. This tool is a set of service contracts and objects coupled with a management console and WCF hosting system that takes quite a bit of the work out of building a stable service oriented workflow.
One of the tricky bits though has been figuring out how to get Infopath to talk to a WCF service.
Hosting:
The easiest/most obvious way of getting infopath to talk to a WCF service is to host one in IIS - then it basically follows the same pattern as any other web service.
However, in the case of Matrix - we are using a WCF service host in place of IIS, so the approach of getting Infopath to recognize the service requires more configuration.
Endpoint Configuration:
In order to get Infopath to pick up the WCF service, it is necessary to setup a basic WCF endpoint, and set the config to return WSDL information when queried.
MSDN Forum post on WCF and infopath
Reading Service Response From Infopath:
I found that Infopath does not seem to be able to read and display the results from a query to my WCF services. This could be perhaps because we chose originally to return the responses as a general XML message/payload. In order to make use of the data returned from the service, it is necessary to manually map the drop-down lists to the response data.
I will have to go back and investigate to see if there is an easier way to to this, as the approach I used resulted in more work on the developer side, and does not leverage the built-in data connectors since all the datamapping from service to infopath controls must be done in managed code.
This post contains information on how to do this:
Programatically Populating Infopath Drop Down Lists
Other Useful Links - Setting up WSDL enabled WCF Service:
WCF Binding Suite Comparison:WCF Security Patterns and Practices:
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IContent">
<security mode="TransportCredentialOnly" >
<transport clientCredentialType="Windows"/>
</security>
</binding>
<binding name="BasicHttpBinding_IContentMT">
<security mode="TransportCredentialOnly" >
<transport clientCredentialType="Windows"/>
</security>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="WSHttpBinding_IContent">
<security mode="Transport">
<transport clientCredentialType="Ntlm"/>
</security>
</binding>
<binding name="WSHttpBinding_IContentMT">
<security mode="Transport">
<transport clientCredentialType="Ntlm"/>
</security>
</binding>
</wsHttpBinding>
</bindings>




