Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8051375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:17:18+00:00 2026-06-05T07:17:18+00:00

If I have a workflow hosted (WF4 + WCF) and running in IIS implementing

  • 0

If I have a workflow hosted (WF4 + WCF) and running in IIS implementing the following interface:

[ServiceContract]
public interface IMessageService
{   
     [OperationContract]
     string SendMessage(string message);
}

(Using RecieveActivity and SendReply from System.ServiceModel.Activities)

And invoke it like this:

    var channel = new ChannelFactory<IMessageService>().CreateChannel(<init params>);
    string answer = channel.SendMessage("Testmessage");

Then answer is always null. If I consume the workflow through the WcfTestClient I can see there is an returned xml object.

How can I make the workflow return a string to populate answer?

(I’d like to avoid the “Add a ServiceReference and return a lot of xml-approach”)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:17:22+00:00Added an answer on June 5, 2026 at 7:17 am

    You need a [return] attribute to specify how to find the result.

    In the SendReplyToReceive you can choose between sending back a Message or Parameters. In my experience, you need to choose Parameters but only send back one. Assuming you give the return parameter the name “result” then you need this attribute on your interface contract:

    [return: MessageParameter(Name = "result")]
    

    Here is a full example of one of mine;

    namespace NewOrbit.ExVerifier.Model.Workflow.Case
    {
        using System;
        using System.ServiceModel;
    
        using NewOrbit.ExVerifier.Model.Workflow;
    
        [ServiceContract(Namespace = "urn://exverifier.neworbit.co.uk/")]
        public interface ICaseWorkflow
        {
            [OperationContract(Action = "urn://exverifier.neworbit.co.uk/NewOrbit.ExVerifier.Model.Workflow.Case.ICaseWorkflow/Start",
                ReplyAction = "urn://exverifier.neworbit.co.uk/NewOrbit.ExVerifier.Model.Workflow.Case.ICaseWorkflow/StartReply")]
            [return: MessageParameter(Name = "result")]
            WorkflowInstanceIdentifier Start(int caseID);
    
            [OperationContract(Action = "urn://exverifier.neworbit.co.uk/NewOrbit.ExVerifier.Model.Workflow.Case.ICaseWorkflow/ApplicationStateChanged",
                ReplyAction = "urn://exverifier.neworbit.co.uk/NewOrbit.ExVerifier.Model.Workflow.Case.ICaseWorkflow/ApplicationStateChangedReply")]
            [return: MessageParameter(Name = "result")]
            bool ApplicationStateChanged(Guid instanceID, int applicationID);
    
            [OperationContract(Action = "urn://exverifier.neworbit.co.uk/NewOrbit.ExVerifier.Model.Workflow.Case.ICaseWorkflow/Cancel",
                ReplyAction = "urn://exverifier.neworbit.co.uk/NewOrbit.ExVerifier.Model.Workflow.Case.ICaseWorkflow/CancelReply")]
            [return: MessageParameter(Name = "result")]
            bool Cancel(Guid instanceID);
        }
    }
    

    Incidentally, in your example I am not sure how you are getting away with not specifying the OperationContract but great that you are – they are a real pain because the format you have to specify them in is different in the contract and in the workflow.

    Also, just in case you don’t know and it can cause some really subtle bugs: The parameters you pass in are recognised by name, so it is imprtant that the name you specify for inbound parameters in your interface is the same as in your workflow. Obvious when you think about it but can catch you out.
    Oh, and avoid method names that are too long as they will break as well with misleading error messages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a sequential workflow, which is hosted in IIS as a Workflow Service.
I have hosted a state machine Worklow as a WCF service..And the workflow is
I have my workflow hosted in a WorkflowServiceApplication running on IIS5 (production environment will
I have a wcf service that is hosted in IIS. This service launches some
I have a state machine workflow hosted in SharePoint with a delay activity in
We have a .Net 3.5 Workflow hosted as a service that sometimes stops unexpectedly.
I have a workflow running on an item in a list. The workflow has
I have created a workflow, and Im running it via WorkflowInstance.Run(). This workflow has
I have following workflow div on the page is used on users operation request
I uses Dreamweaver, and I have a domain hosted on a public hosting company.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.