public string ConnectionTest(string endpointAddress, string configurationName, bool listCerts) { var log = new StringBuilder(); try { if (listCerts) { ListCertificates(StoreLocation.LocalMachine, StoreName.My, log); ListCertificates(StoreLocation.LocalMachine, StoreName.Root, log); ListCertificates(StoreLocation.LocalMachine, StoreName.AuthRoot, log); ListCertificates(StoreLocation.LocalMachine, StoreName.CertificateAuthority, log); ListCertificates(StoreLocation.CurrentUser, StoreName.My, log); ListCertificates(StoreLocation.CurrentUser, StoreName.Root, log); ListCertificates(StoreLocation.CurrentUser, StoreName.AuthRoot, log); ListCertificates(StoreLocation.CurrentUser, StoreName.CertificateAuthority, log); } log.AppendLine("Calling '" + endpointAddress + "' with configuration '" + configurationName + "'"); GetServiceStatusResponse response = null; Service <GatewayServiceContract> .Use(configurationName, endpointAddress, client => { response = client.GetServiceStatus(new GetServiceStatusRequest()); }); log.AppendLine("Response: " + response.Version); } catch (Exception ex) { log.AppendFormat("Error: {0}\n{1}\n", ex.Message, ex.StackTrace); } return(log.ToString()); }
public static GetServiceStatusResponse Unmarshall(UnmarshallerContext context) { GetServiceStatusResponse getServiceStatusResponse = new GetServiceStatusResponse(); getServiceStatusResponse.HttpResponse = context.HttpResponse; getServiceStatusResponse.RequestId = context.StringValue("GetServiceStatus.RequestId"); getServiceStatusResponse.Status = context.IntegerValue("GetServiceStatus.Status"); getServiceStatusResponse.ServiceState = context.IntegerValue("GetServiceStatus.ServiceState"); getServiceStatusResponse.InstanceId = context.StringValue("GetServiceStatus.InstanceId"); getServiceStatusResponse.ChargeType = context.IntegerValue("GetServiceStatus.ChargeType"); getServiceStatusResponse.ChangingChargeType = context.StringValue("GetServiceStatus.ChangingChargeType"); getServiceStatusResponse.ChangingAfterTime = context.StringValue("GetServiceStatus.ChangingAfterTime"); return(getServiceStatusResponse); }
/// <summary> /// Gets the status of the service. /// Status is one of GREEN, RED representing: /// GREEN: This API section of the service is operating normally. /// RED: The service is disrupted. /// /// </summary> /// <param name="service">Instance of FBAInventoryServiceMWS service</param> /// <param name="request">GetServiceStatusRequest request</param> public static void InvokeGetServiceStatus(FBAInventoryServiceMWS service, GetServiceStatusRequest request) { try { GetServiceStatusResponse response = service.GetServiceStatus(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" GetServiceStatusResponse"); if (response.IsSetGetServiceStatusResult()) { Console.WriteLine(" GetServiceStatusResult"); GetServiceStatusResult getServiceStatusResult = response.GetServiceStatusResult; if (getServiceStatusResult.IsSetStatus()) { Console.WriteLine(" Status"); Console.WriteLine(" {0}", getServiceStatusResult.Status); } if (getServiceStatusResult.IsSetTimestamp()) { Console.WriteLine(" Timestamp"); Console.WriteLine(" {0}", getServiceStatusResult.Timestamp); } } if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } } catch (FBAInventoryServiceMWSException ex) { Console.WriteLine("Caught Exception: " + ex.Message); Console.WriteLine("Response Status Code: " + ex.StatusCode); Console.WriteLine("Error Code: " + ex.ErrorCode); Console.WriteLine("Error Type: " + ex.ErrorType); Console.WriteLine("Request ID: " + ex.RequestId); Console.WriteLine("XML: " + ex.XML); } }
public GetServiceStatusResponse InvokeGetServiceStatus(string sellerId, string mwsAuthToken, out APIResults results) { try { // Create a request. GetServiceStatusRequest request = new GetServiceStatusRequest(); request.SellerId = sellerId; request.MWSAuthToken = mwsAuthToken; GetServiceStatusResponse output = this.productClient.GetServiceStatus(request); results = new APIResults((IMWSResponse)output); return(output); } catch (MarketplaceWebServiceProductsException ex) { results = new APIResults(ex); throw ex; } }
/// <summary> /// FbaInbountShipment Service Check /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnGetServiceStatus_Click(object sender, RoutedEventArgs e) { string SellerId = CommonValue.strMerchantId; string MarketplaceId = CommonValue.strMarketplaceId; string AccessKeyId = CommonValue.strAccessKeyId; string SecretKeyId = CommonValue.strSecretKeyId; string ApplicationVersion = CommonValue.strApplicationVersion; string ApplicationName = CommonValue.strApplicationName; string MWSAuthToken = CommonValue.strMWSAuthToken; string strbuff = string.Empty; FBAInboundServiceMWSConfig config = new FBAInboundServiceMWSConfig(); config.ServiceURL = CommonValue.strServiceURL; FBAInboundServiceMWSClient client = new FBAInboundServiceMWSClient( AccessKeyId, SecretKeyId, ApplicationName, ApplicationVersion, config); GetServiceStatusRequest request = new GetServiceStatusRequest(); request.SellerId = SellerId; request.MWSAuthToken = MWSAuthToken; request.Marketplace = MarketplaceId; GetServiceStatusResponse response = client.GetServiceStatus(request); if (response.IsSetGetServiceStatusResult()) { strbuff = "正常終了:" + response.GetServiceStatusResult.Status; } else { strbuff = "異常終了:" + response.GetServiceStatusResult.Status; } txtGetServiceStatus.Text = strbuff; }
/// <summary> /// Returns the service status of a particular MWS API section. The operation /// takes no input. /// All API sections within the API are required to implement this operation. /// /// </summary> /// <param name="service">Instance of MarketplaceWebServiceProducts service</param> /// <param name="request">GetServiceStatusRequest request</param> public static void InvokeGetServiceStatus(MarketplaceWebServiceProducts service, GetServiceStatusRequest request) { try { GetServiceStatusResponse response = service.GetServiceStatus(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" GetServiceStatusResponse"); if (response.IsSetGetServiceStatusResult()) { Console.WriteLine(" GetServiceStatusResult"); GetServiceStatusResult getServiceStatusResult = response.GetServiceStatusResult; if (getServiceStatusResult.IsSetStatus()) { Console.WriteLine(" Status"); Console.WriteLine(" {0}", getServiceStatusResult.Status); } if (getServiceStatusResult.IsSetTimestamp()) { Console.WriteLine(" Timestamp"); Console.WriteLine(" {0}", getServiceStatusResult.Timestamp); } if (getServiceStatusResult.IsSetMessageId()) { Console.WriteLine(" MessageId"); Console.WriteLine(" {0}", getServiceStatusResult.MessageId); } if (getServiceStatusResult.IsSetMessages()) { Console.WriteLine(" Messages"); MessageList messages = getServiceStatusResult.Messages; List <Message> messageList = messages.Message; foreach (Message message in messageList) { Console.WriteLine(" Message"); if (message.IsSetLocale()) { Console.WriteLine(" Locale"); Console.WriteLine(" {0}", message.Locale); } if (message.IsSetText()) { Console.WriteLine(" Text"); Console.WriteLine(" {0}", message.Text); } } } } if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } Console.WriteLine(" ResponseHeaderMetadata"); Console.WriteLine(" RequestId"); Console.WriteLine(" " + response.ResponseHeaderMetadata.RequestId); Console.WriteLine(" ResponseContext"); Console.WriteLine(" " + response.ResponseHeaderMetadata.ResponseContext); Console.WriteLine(" Timestamp"); Console.WriteLine(" " + response.ResponseHeaderMetadata.Timestamp); Console.WriteLine(); } catch (MarketplaceWebServiceProductsException ex) { Console.WriteLine("Caught Exception: " + ex.Message); Console.WriteLine("Response Status Code: " + ex.StatusCode); Console.WriteLine("Error Code: " + ex.ErrorCode); Console.WriteLine("Error Type: " + ex.ErrorType); Console.WriteLine("Request ID: " + ex.RequestId); Console.WriteLine("XML: " + ex.XML); Console.WriteLine("ResponseHeaderMetadata: " + ex.ResponseHeaderMetadata); } }