示例#1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            // Assume that you named your "Connected Service" com.example.foo

            getRateRequestRequest requestObj = new getRateRequestRequest();

            // Fill in your request object
            DateTime timestamp = DateTime.Now.AddMinutes(10);

            requestObj.RequestedShipment = new docTypeRef_RequestedShipmentType2();
            requestObj.RequestedShipment.ShipTimestamp = $"{timestamp:s} GMT{timestamp:zzz}";
            // etc.

            // Set up the authentication using the function you provided
            var glowsAuthData = PrepareGlowsAuth("expressRateBook");

            // foo.<object name>Client is automatically created, this is the generated
            //   proxy class for communicating with the intended web service
            gblExpressRateBookClient client = new gblExpressRateBookClient(new CustomBinding(glowsAuthData.Item2)
                                                                           , glowsAuthData.Item1);

            client.ClientCredentials.UserName.UserName = glowsAuthData.Item3;
            client.ClientCredentials.UserName.Password = glowsAuthData.Item4;

            // Use the client to send the request object and populate the response object
            // foo.<object name>Response is automatically generated when VS generates
            //   the code for "Connected Service". It also makes it the return type
            //   for foo.barClient.barResponse(foo.bar);
            getRateRequestResponse responseObj = client.getRateRequest(requestObj);
        }
示例#2
0
        public static object send()
        {
            var clientRequest = new gblExpressRateBookClient();

            var requestedShipment = getRequestedShipment();
            var response          = clientRequest.getRateRequest(null, requestedShipment);

            return(response);
        }