Calling external WCF services within orchard

Topics: Customizing Orchard
Dec 20, 2012 at 2:34 PM
Edited Dec 21, 2012 at 12:29 PM

I have a requirement to call data from an external WCF service in my Orchard module.

My services are running as a console application on my local machine with the address as:

net.tcp://<MY_LOCAL_IP_ADDRESS>/Wi/v1/General

 

And in here I have an interface called IWiGeneralService which contains an operation contract called:

 

[OperationContract]
List GetJobs(ServiceRequest request)

 

The methods will be called and passed with a ServiceRequest class containing authorization credentials such as UserLogon, Date, Guid, Username, Password.

I have a Module that stores the credentials for the services as Site wide settings. The credentials are the username, password, guid and services path. Similar to the (Magelia Webstore Module).

I have a widget on the homepage that shows a list of the people (the data that is returned from GetJobs).

The driver for this widget calls the service by injection passing in the settings for the part and the site settings.

List<Job> GetJobsByType(JobsByTypeWidgetPart part, SettingsPart settings);

What I need to do now is call my services from within my Orchard Module and return the data to the widgets model.

Has anyone got any pointers or example modules to follow in order to do this within an Orchard Module.

If the code example is not clear then I can clarify.

Developer
Dec 21, 2012 at 2:16 PM

Perhaps this helps: http://darkskycommerce.codeplex.com/SourceControl/changeset/view/02207789178e#Services/PayPal/PayPalClient.cs

I added a service reference to the PayPal SOAP service, then used the generated proxy classes. Works like a charm.

Jan 2, 2013 at 3:17 PM

Thanks for your help. However I'm not calling an API.

Specifically, what I'd like to do is to call a self hosted WCF service with the settings provided in the Orchard part record and return this from operation contracts/methods already written (previously for a windows app).

At the moment I am having difficulty with the infrastructure involved in doing this. I don't want to change the hosted services that have already been developed. Just simple to call the methods with a Request object and return the response within a Response object.