locked
Trying to modify the HPC sample code/examples a bit, need some help... RRS feed

  • Question

  • Hi, 

    Sample code: 

                   using (BrokerClient<IService1> client = new BrokerClient<IService1>(session, binding))
                    {
                        Console.Write("Sending {0} requests...", numRequests);
                        for (int i = 0; i < numRequests; i++)
                        {
                            // EchoRequest are created as you add Service Reference
                            // EchoService to the project
                            EchoRequest request = new EchoRequest("hello world!");
                            client.SendRequest<EchoRequest>(request, i);
                        }

    Now, MY service uses simple strings for argument and result.. So, silly me, I thought I just needed to do this: 

                    using (BrokerClient<IHPCRuntimeLibrary> client = new BrokerClient<IHPCRuntimeLibrary>(session, binding))
                    {

                        String jobRequest = "Testing job request" ;
                        client.SendRequest<String>(jobRequest); 

    But I get an argument exception on this call. There's no message, no explanation, just an argument exception... 

    Can anyone offer any ideas ? 

    The service is very simple: 

        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
        [System.ServiceModel.ServiceContractAttribute(ConfigurationName = "IHPCRuntimeLibrary")]
        public interface IHPCRuntimeLibrary
        {

            [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHPCRuntimeLibrary/ExecuteJobRequest", ReplyAction = "http://tempuri.org/IHPCRuntimeLibrary/ExecuteJobRequestResponse")]
            string ExecuteJobRequest(string request);
        }

    Thanks

    Damian



    • Edited by DamianRK Monday, April 6, 2015 11:07 PM
    Monday, April 6, 2015 11:06 PM

Answers

  • Hi DamianRK,

    The BrokerClient.SendRequest<TMessage>(TMessage request) only accept WCF message contract type as the TMessage, even the service only needs a String as input, a WCF SOAP message and the message contract accordingly are still required to communicate with the WCF service. It is quite easy though to generate the message contract from the service with VS.

    Best,

    Yutong

    • Marked as answer by DamianRK Thursday, April 9, 2015 1:52 PM
    Thursday, April 9, 2015 2:27 AM

All replies

  • Hi DamianRK,

    The BrokerClient.SendRequest<TMessage>(TMessage request) only accept WCF message contract type as the TMessage, even the service only needs a String as input, a WCF SOAP message and the message contract accordingly are still required to communicate with the WCF service. It is quite easy though to generate the message contract from the service with VS.

    Best,

    Yutong

    • Marked as answer by DamianRK Thursday, April 9, 2015 1:52 PM
    Thursday, April 9, 2015 2:27 AM
  • Ok, thanks, I'll look into that :)

    Damian

    Thursday, April 9, 2015 1:52 PM