BizTalk Utilities CV ,   Jobs ,   Code library
 
Go to the front page to continue learning about XML or select below:

Contents

ReBlogger Contents

Previous posts in WSCF/WCF

 
 
Page 7959 of 21350

Calling a WCF service from Infopath

Blogger : MSDN Blogs
All posts : All posts by MSDN Blogs
Category : WSCF/WCF
Blogged date : 2007 Dec 05

Recently I got into a scenario where I wanted to call a WCF service from within an Infopath Form service, Infopath does not supports configuration files so my service was not able to pick the Binding and Endpoint setting for the Service at the client side

To resolve I programmatically created a channel for the service to connect, works like a charm

EndpointAddress address = new EndpointAddress("http://localhost:12346/XXXXXXX\Abc.svc");

BasicHttpBinding binding = new BasicHttpBinding();

DocumentGen docgen = ChannelFactory<DocumentGen>.CreateChannel (binding,address);

GenerateRequestBody body = new GenerateRequestBody(PackageInstance);

GenerateRequest request = new GenerateRequest(body);

GenerateResponse response = docgen.Generate(request);

 

Basically the <MethodName>Request and <MethodName>Response classes are generated along with proxy when you add a service reference to your project, <MethodName>Request requires a <MethodName>RequestBody object to specify the parameter to be passed to the service.

 


Read comments or post a reply to : Calling a WCF service from Infopath
Page 7959 of 21350

Newest posts
 

    Email TopXML