Exemplo n.º 1
0
        static void Main(string[] args)
        {
            try
            {
                // Create shared access signature token credentials for authentication.
                channelFactory = new ChannelFactory <MyServicePortReference.MyServicePortContractChannel>(new BasicHttpRelayBinding(),
                                                                                                          "https://dwgpoctest.servicebus.windows.net/dwgpocrelay");
                channelFactory.Endpoint.Behaviors.Add(new TransportClientEndpointBehavior
                {
                    TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider(
                        "RootManageSharedAccessKey", "9NYyNAXFAjCG0zugYxtzTVqyymdEFEECdANkamXSKoQ=")
                });


                MyServicePortContractChannel channel = channelFactory.CreateChannel();
                MyServiceFindRequestRequest  request = new MyServiceFindRequestRequest();
                request.CallContext         = new CallContext();
                request.CallContext.Company = "snl";
                request._args           = new FindRequestArgs();
                request._args.RequestId = "REQ-000142";

                MyServiceFindRequestResponse response = channel.FindRequest(request);
                Console.WriteLine("{0} requests found", response.response.Count());
            }
            catch (Exception e)
            {
                Console.WriteLine("Find failed: {0}\n{1}", e.Message, e.StackTrace);
            }
            Console.ReadLine();
        }
Exemplo n.º 2
0
        public MyServiceFindRequestResponse FindRequest(MyServiceFindRequestRequest request)
        {
            MyServicePortServiceReference.MeterReadingRequest[] response = null;
            try
            {
                using (MyServicePortServiceReference.MyServiceClient client = new MyServicePortServiceReference.MyServiceClient())
                {
                    MyServicePortServiceReference.CallContext     context = request.CallContext;
                    MyServicePortServiceReference.FindRequestArgs args    = request._args;
                    string languageID = request._languageID;
                    response = client.FindRequest(context, args, languageID);
                }
            }
            catch
            {
            }
            MyServiceFindRequestResponse result = new MyServiceFindRequestResponse();

            if (null != response)
            {
                result.response = response;
            }
            return(result);
        }