locked
Send Activity not receiving data and not returning data RRS feed

  • Question

  • I am invoking a WCF Service using Send Activity from a WF Service. The target WCF Service is getting called but the inputs and outputs are null. Have defined inputs and outputs of the target WCF Service as MessageContracts. For the input,  have set the IsWrapped to false and for the output have set IsWrapped to true.

    I dont receive any error either during WF Service execution or during the target WCF Service execution. From the Debug mode I have checked that : All the four activities Receive, Send, Receive Reply, Send Reply are executing without errors. Data received inside Send is null and data received from Recieve Reply is also null.

    Please help.

     

    Monday, November 22, 2010 3:27 PM

Answers

  • Tried Target WCF Service name + Result and it worked !

    For eg., if the target WCF Service name is ComputeSalary then the out parameter for ReceiveReply should be called ComputeSalaryResult !!

     

     

    • Marked as answer by Mindspring Thursday, November 25, 2010 8:35 AM
    Thursday, November 25, 2010 8:35 AM

All replies

  • Any ideas ?  Have attached code :

    Target WCF Service code :

     [ServiceContract]
      public interface IPayrollService
      {
        [OperationContract]
        ComputeSalaryResponse ComputeSalaryForEmp(ComputeSalaryRequest csr);
    
        [OperationContract]
        ApproveSalaryResponse ApproveSalaryCredit(ApproveSalaryRequest asr);
    
    
      }
    
    
      [MessageContract(IsWrapped = true)]
      public class ComputeSalaryResponse
      {
        public ComputeSalaryResponse()
        {
        }
        public ComputeSalaryResponse(double salary)
        {
          this.Salary= salary;
        }
        [MessageBodyMember(Name = "Salary", Namespace = "http://schemas.microsoft.com/2003/10/Serialization/", Order = 0)]
        public double Salary{ get; set; }
      }
    
      [MessageContract(IsWrapped = false)]
      public class ComputeSalaryRequest
      {
        public ComputeSalaryRequest()
        {
        }
        public ComputeSalaryRequest(string empid)
        {
          this.EmpId= empid;
        }
        [MessageBodyMember(Name = "EmpId", Namespace = "http://schemas.microsoft.com/2003/10/Serialization/", Order = 0)]
        public string EmpId { get; set; }
      }
    
    
    
      [MessageContract(IsWrapped = false)]
      public class ApproveSalaryResponse
      {
        public ApproveSalaryResponse()
        {
        }
        public ApproveSalaryResponse(string status)
        {
          this.ApprovalStatus = status;
        }
        [MessageBodyMember(Name = "ApprovalStatus", Namespace = "http://schemas.microsoft.com/2003/10/Serialization/", Order = 0)]
        public string ApprovalStatus{ get; set; }
      }
    
      [MessageContract(IsWrapped = false)]
      public class ApproveSalaryRequest
      {
        public ApproveSalaryRequest()
        {
        }
        
        [MessageBodyMember(Name = "EmpId", Namespace = "http://schemas.microsoft.com/2003/10/Serialization/", Order = 0)]
        public string EmpId { get; set; }
    
        [MessageBodyMember(Name = "Amount", Namespace = "http://schemas.microsoft.com/2003/10/Serialization/", Order = 1)]
        public string Amount { get; set; }
    
    
        [MessageBodyMember(Name = "ApprovalStatus", Namespace = "http://schemas.microsoft.com/2003/10/Serialization/", Order = 2)]
        public string ApprovalStatus{ get; set; }
      }
    
    <pre lang="x-xml"><WorkflowService mc:Ignorable="sap" ConfigurationName="PayrollProcess" sap:VirtualizedContainerService.HintSize="644,666" Name="PayrollProcess" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/servicemodel" xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:dp="clr-namespace:DeclarativeServiceLibrary1.PayrollServiceReference;assembly=DeclarativeServiceLibrary1" xmlns:dpa="clr-namespace:DeclarativeServiceLibrary1.PayrollServiceReference.Activities;assembly=DeclarativeServiceLibrary1" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:p="http://tempuri.org/" xmlns:p1="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:s4="clr-namespace:System;assembly=System.ServiceModel" xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:ssa="clr-namespace:System.ServiceModel.Activities;assembly=System.ServiceModel.Activities" xmlns:ssx="clr-namespace:System.ServiceModel.XamlIntegration;assembly=System.ServiceModel" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
     <p1:Flowchart sad:XamlDebuggerXmlReader.FileName="..\DeclarativeServiceLibrary1\PayrollProcess.xamlx" sap:VirtualizedContainerService.HintSize="614,636" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">
      <p1:Flowchart.Variables>
       <p1:Variable x:TypeArguments="CorrelationHandle" Name="__empidhandle" />
       <p1:Variable x:TypeArguments="x:Double" Name="glsalamount" />
       <p1:Variable x:TypeArguments="x:String" Name="glstatus" />
       <p1:Variable x:TypeArguments="dp:ComputeSalaryResponse" Default="[New ComputeSalaryResponse()]" Name="glcsresponse" />
       <p1:Variable x:TypeArguments="CorrelationHandle" Name="__handle1" />
      </p1:Flowchart.Variables>
      <sap:WorkflowViewStateService.ViewState>
       <scg3:Dictionary x:TypeArguments="x:String, x:Object">
        <x:Boolean x:Key="IsExpanded">False</x:Boolean>
        <av:Point x:Key="ShapeLocation">270,2.5</av:Point>
        <av:Size x:Key="ShapeSize">60,75</av:Size>
        <av:PointCollection x:Key="ConnectorLocation">300,77.5 300,104.5</av:PointCollection>
       </scg3:Dictionary>
      </sap:WorkflowViewStateService.ViewState>
      <p1:Flowchart.StartNode>
       <x:Reference>__ReferenceID9</x:Reference>
      </p1:Flowchart.StartNode>
      <p1:FlowStep x:Name="__ReferenceID9">
       <sap:WorkflowViewStateService.ViewState>
        <scg3:Dictionary x:TypeArguments="x:String, x:Object">
         <av:Point x:Key="ShapeLocation">200,104.5</av:Point>
         <av:Size x:Key="ShapeSize">200,51</av:Size>
         <av:PointCollection x:Key="ConnectorLocation">300,155.5 300,185.5 290,185.5 290,204.5</av:PointCollection>
        </scg3:Dictionary>
       </sap:WorkflowViewStateService.ViewState>
       <p1:Sequence DisplayName="ComputeSalarySequence" sap:VirtualizedContainerService.HintSize="277,705">
        <p1:Sequence.Variables>
         <p1:Variable x:TypeArguments="x:String" Name="empid" />
         <p1:Variable x:TypeArguments="dp:ComputeSalaryRequest" Default="[New ComputeSalaryRequest(empid)]" Name="csrequest" />
         <p1:Variable x:TypeArguments="dp:ComputeSalaryResponse" Default="[New ComputeSalaryResponse()]" Name="csresponse" />
         <p1:Variable x:TypeArguments="x:String" Name="variable1" />
        </p1:Sequence.Variables>
        <sap:WorkflowViewStateService.ViewState>
         <scg3:Dictionary x:TypeArguments="x:String, x:Object">
          <x:Boolean x:Key="IsExpanded">True</x:Boolean>
         </scg3:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
        <Receive x:Name="__ReferenceID1" CanCreateInstance="True" DisplayName="ComputeSalaryReceive" sap:VirtualizedContainerService.HintSize="255,90" OperationName="ComputeSalary" ServiceContractName="IPayrollService">
         <Receive.CorrelationInitializers>
          <QueryCorrelationInitializer CorrelationHandle="[__empidhandle]">
           <XPathMessageQuery x:Key="key1">
            <XPathMessageQuery.Namespaces>
             <ssx:XPathMessageContextMarkup>
              <x:String x:Key="xgSc">http://tempuri.org/</x:String>
             </ssx:XPathMessageContextMarkup>
            </XPathMessageQuery.Namespaces>sm:body()/xgSc:ComputeSalary/xgSc:empid1</XPathMessageQuery>
          </QueryCorrelationInitializer>
         </Receive.CorrelationInitializers>
         <ReceiveParametersContent>
          <p1:OutArgument x:TypeArguments="x:String" x:Key="empid1">[empid]</p1:OutArgument>
         </ReceiveParametersContent>
        </Receive>
        <Send x:Name="__ReferenceID0" Action="http://tempuri.org/IPayrollService/ComputeSalaryForEmp" DisplayName="ComputeSalarySend" EndpointConfigurationName="BasicHttpBinding_IPayrollService" sap:VirtualizedContainerService.HintSize="255,90" OperationName="ComputeSalaryForEmp" ServiceContractName="IPayrollService">
         <SendParametersContent>
          <p1:InArgument x:TypeArguments="x:String" x:Key="EmpId">[empid]</p1:InArgument>
         </SendParametersContent>
        </Send>
        <ReceiveReply Request="{x:Reference __ReferenceID0}" Action="" DisplayName="ReceiveReplyForSend" sap:VirtualizedContainerService.HintSize="255,90">
         <ReceiveMessageContent DeclaredMessageType="dp:ComputeSalaryResponse">
          <p1:OutArgument x:TypeArguments="dp:ComputeSalaryResponse">[glcsresponse]</p1:OutArgument>
         </ReceiveMessageContent>
        </ReceiveReply>
        <p1:WriteLine sap:VirtualizedContainerService.HintSize="255,61" Text="[glsalamount.ToString()]" />
        <SendReply Request="{x:Reference __ReferenceID1}" DisplayName="SendReplyToReceive" sap:VirtualizedContainerService.HintSize="255,90">
         <SendParametersContent>
          <p1:InArgument x:TypeArguments="x:Double" x:Key="amount">[glcsresponse.Salary]</p1:InArgument>
         </SendParametersContent>
        </SendReply>
       </p1:Sequence>
       <p1:FlowStep.Next>
        <p1:FlowStep x:Name="__ReferenceID6">
         <sap:WorkflowViewStateService.ViewState>
          <scg3:Dictionary x:TypeArguments="x:String, x:Object">
           <av:Point x:Key="ShapeLocation">190,204.5</av:Point>
           <av:Size x:Key="ShapeSize">200,51</av:Size>
           <av:PointCollection x:Key="ConnectorLocation">290,255.5 290,285.5 280,285.5 280,304.5</av:PointCollection>
          </scg3:Dictionary>
         </sap:WorkflowViewStateService.ViewState>
         <p1:If Condition="[glsalamount &gt; 10]" DisplayName="IsApprovalReqd" sap:VirtualizedContainerService.HintSize="200,51">
          <p1:If.Then>
           <p1:Sequence DisplayName="DirectorApprovalSequence" sap:VirtualizedContainerService.HintSize="308,604">
            <p1:Sequence.Variables>
             <p1:Variable x:TypeArguments="x:String" Name="empid" />
            </p1:Sequence.Variables>
            <sap:WorkflowViewStateService.ViewState>
             <scg3:Dictionary x:TypeArguments="x:String, x:Object">
              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
             </scg3:Dictionary>
            </sap:WorkflowViewStateService.ViewState>
            <Receive x:Name="__ReferenceID3" CorrelatesWith="[__empidhandle]" DisplayName="DirectorApprovalReceive" sap:VirtualizedContainerService.HintSize="255,90" OperationName="GetDirectorApproval" ServiceContractName="p:IPayrollService">
             <Receive.CorrelatesOn>
              <XPathMessageQuery x:Key="key1">
               <XPathMessageQuery.Namespaces>
                <ssx:XPathMessageContextMarkup>
                 <x:String x:Key="xgSc">http://tempuri.org/</x:String>
                </ssx:XPathMessageContextMarkup>
               </XPathMessageQuery.Namespaces>sm:body()/xgSc:GetDirectorApproval/xgSc:empid</XPathMessageQuery>
             </Receive.CorrelatesOn>
             <ReceiveParametersContent>
              <p1:OutArgument x:TypeArguments="x:String" x:Key="empid">[empid]</p1:OutArgument>
              <p1:OutArgument x:TypeArguments="x:Double" x:Key="salary" />
              <p1:OutArgument x:TypeArguments="x:String" x:Key="approval">[glstatus]</p1:OutArgument>
             </ReceiveParametersContent>
            </Receive>
            <Send x:Name="__ReferenceID2" DisplayName="ApproveSalarySend" sap:VirtualizedContainerService.HintSize="255,90" OperationName="ApproveSalaryCredit" ServiceContractName="BusinessServices.IPayrollService">
             <Send.Endpoint>
              <Endpoint AddressUri="http://localhost:34219/PayrollService.svc">
               <Endpoint.Binding>
                <BasicHttpBinding Name="basicHttpBinding" />
               </Endpoint.Binding>
              </Endpoint>
             </Send.Endpoint>
             <SendParametersContent>
              <p1:InArgument x:TypeArguments="x:String" x:Key="empid">[empid]</p1:InArgument>
              <p1:InArgument x:TypeArguments="x:Double" x:Key="salary">[glsalamount]</p1:InArgument>
              <p1:InArgument x:TypeArguments="x:String" x:Key="status">[glstatus]</p1:InArgument>
             </SendParametersContent>
            </Send>
            <ReceiveReply Request="{x:Reference __ReferenceID2}" DisplayName="ApproveSalaryReceiveReplyForSend" sap:VirtualizedContainerService.HintSize="255,90">
             <ReceiveParametersContent>
              <p1:OutArgument x:TypeArguments="x:String" x:Key="status">[glstatus]</p1:OutArgument>
             </ReceiveParametersContent>
            </ReceiveReply>
            <SendReply Request="{x:Reference __ReferenceID3}" DisplayName="ApproveSalarySendReplyToReceive" sap:VirtualizedContainerService.HintSize="255,90">
             <SendParametersContent>
              <p1:InArgument x:TypeArguments="x:String" x:Key="status">[glstatus]</p1:InArgument>
             </SendParametersContent>
            </SendReply>
           </p1:Sequence>
          </p1:If.Then>
         </p1:If>
         <p1:FlowStep.Next>
          <p1:FlowStep x:Name="__ReferenceID7">
           <sap:WorkflowViewStateService.ViewState>
            <scg3:Dictionary x:TypeArguments="x:String, x:Object">
             <av:Point x:Key="ShapeLocation">180,304.5</av:Point>
             <av:Size x:Key="ShapeSize">200,51</av:Size>
             <av:PointCollection x:Key="ConnectorLocation">280,355.5 280,385.5 275.5,385.5 275.5,399</av:PointCollection>
            </scg3:Dictionary>
           </sap:WorkflowViewStateService.ViewState>
           <p1:Sequence DisplayName="CreditSalarySequence" sap:VirtualizedContainerService.HintSize="200,51">
            <p1:Sequence.Variables>
             <p1:Variable x:TypeArguments="x:String" Name="empid" />
            </p1:Sequence.Variables>
            <sap:WorkflowViewStateService.ViewState>
             <scg3:Dictionary x:TypeArguments="x:String, x:Object">
              <x:Boolean x:Key="IsExpanded">True</x:Boolean>
             </scg3:Dictionary>
            </sap:WorkflowViewStateService.ViewState>
            <Receive x:Name="__ReferenceID5" CorrelatesWith="[__empidhandle]" DisplayName="CreditSalaryReceive" sap:VirtualizedContainerService.HintSize="255,90" OperationName="CreditSalary" ServiceContractName="p:IPaymentService">
             <Receive.CorrelatesOn>
              <XPathMessageQuery x:Key="key1">
               <XPathMessageQuery.Namespaces>
                <ssx:XPathMessageContextMarkup>
                 <x:String x:Key="xgSc">http://tempuri.org/</x:String>
                </ssx:XPathMessageContextMarkup>
               </XPathMessageQuery.Namespaces>sm:body()/xgSc:CreditSalary/xgSc:empid</XPathMessageQuery>
             </Receive.CorrelatesOn>
             <ReceiveParametersContent>
              <p1:OutArgument x:TypeArguments="x:String" x:Key="empid">[empid]</p1:OutArgument>
              <p1:OutArgument x:TypeArguments="x:Double" x:Key="salary">[glsalamount]</p1:OutArgument>
             </ReceiveParametersContent>
            </Receive>
            <Send x:Name="__ReferenceID4" DisplayName="BankCreditSend" sap:VirtualizedContainerService.HintSize="255,90" OperationName="BankCredit" ServiceContractName="BusinessServices.IPaymentService">
             <Send.Endpoint>
              <Endpoint AddressUri="http://localhost:34219/PaymentService.svc">
               <Endpoint.Binding>
                <BasicHttpBinding Name="basicHttpBinding" />
               </Endpoint.Binding>
              </Endpoint>
             </Send.Endpoint>
             <SendParametersContent>
              <p1:InArgument x:TypeArguments="x:Double" x:Key="amount">[glsalamount]</p1:InArgument>
              <p1:InArgument x:TypeArguments="x:String" x:Key="empid">[empid]</p1:InArgument>
             </SendParametersContent>
            </Send>
            <ReceiveReply Request="{x:Reference __ReferenceID4}" DisplayName="ReceiveReplyForSend" sap:VirtualizedContainerService.HintSize="255,90">
             <ReceiveParametersContent>
              <p1:OutArgument x:TypeArguments="x:String" x:Key="creditstatus">[glstatus]</p1:OutArgument>
             </ReceiveParametersContent>
            </ReceiveReply>
            <SendReply Request="{x:Reference __ReferenceID5}" DisplayName="SendReplyToReceive" sap:VirtualizedContainerService.HintSize="255,90">
             <SendParametersContent>
              <p1:InArgument x:TypeArguments="x:String" x:Key="creditstatus">[glstatus]</p1:InArgument>
             </SendParametersContent>
            </SendReply>
           </p1:Sequence>
           <p1:FlowStep.Next>
            <p1:FlowStep x:Name="__ReferenceID8">
             <sap:WorkflowViewStateService.ViewState>
              <scg3:Dictionary x:TypeArguments="x:String, x:Object">
               <av:Point x:Key="ShapeLocation">170,399</av:Point>
               <av:Size x:Key="ShapeSize">211,61</av:Size>
              </scg3:Dictionary>
             </sap:WorkflowViewStateService.ViewState>
             <p1:WriteLine sap:VirtualizedContainerService.HintSize="211,61" Text="[glstatus]" />
            </p1:FlowStep>
           </p1:FlowStep.Next>
          </p1:FlowStep>
         </p1:FlowStep.Next>
        </p1:FlowStep>
       </p1:FlowStep.Next>
      </p1:FlowStep>
      <x:Reference>__ReferenceID6</x:Reference>
      <x:Reference>__ReferenceID7</x:Reference>
      <x:Reference>__ReferenceID8</x:Reference>
     </p1:Flowchart>
    </WorkflowService>
    

     

     

    Workflow code :

     

     

    Wednesday, November 24, 2010 6:05 AM
  • Hi,

    We can call a WCF service by using Send activity, however it is relatively error prone and complex. I would prefer adding a service reference to the project. after rebuilding your workflow project. you will see a new activity in the toolbox and you can drag this activity to your worklfow and fill in "input" and "result" properties.

    Then you will be able to use this WCF service in your workflow.

    If you still get problem in this way, you may need WCF Test Client to make sure your wcf service is running correctly.

    Hope this helps
    Regards


    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support. My Blog:http://xhinker.com "Microsoft Windows Workflow Foundation 4.0 Cookbook"
    Thursday, November 25, 2010 3:30 AM
  • My service works fine if I use the service activity listed in the toolbox.
    However the same doesnt work when called using Send activity.

    Secondly, I tried implementing the inputs and outputs of the target service activity as simple parameters. The input works if I provide the exactly match the names of the inarguments of the Target WCF Service and the Send activity.

    However, I am confused about what name I should give for the Return value in the Receive Reply activity. I tried "Value" and also some other names. But it doesnt work. I think I need to use some specific name inorder for this to work .. Any clues ?

    Thanks

    Thursday, November 25, 2010 7:18 AM
  • Tried Target WCF Service name + Result and it worked !

    For eg., if the target WCF Service name is ComputeSalary then the out parameter for ReceiveReply should be called ComputeSalaryResult !!

     

     

    • Marked as answer by Mindspring Thursday, November 25, 2010 8:35 AM
    Thursday, November 25, 2010 8:35 AM
  • Thank you for posting the solution!
    Wednesday, May 14, 2014 7:53 AM