public Request<RespondActivityTaskFailedRequest> marshall(
      RespondActivityTaskFailedRequest respondActivityTaskFailedRequest) {

    if (respondActivityTaskFailedRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<RespondActivityTaskFailedRequest> request =
        new DefaultRequest<RespondActivityTaskFailedRequest>(
            respondActivityTaskFailedRequest, "AmazonSimpleWorkflow");
    request.addHeader("X-Amz-Target", "SimpleWorkflowService.RespondActivityTaskFailed");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

    try {
      final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator();

      jsonGenerator.writeStartObject();

      if (respondActivityTaskFailedRequest.getTaskToken() != null) {
        jsonGenerator
            .writeFieldName("taskToken")
            .writeValue(respondActivityTaskFailedRequest.getTaskToken());
      }
      if (respondActivityTaskFailedRequest.getReason() != null) {
        jsonGenerator
            .writeFieldName("reason")
            .writeValue(respondActivityTaskFailedRequest.getReason());
      }
      if (respondActivityTaskFailedRequest.getDetails() != null) {
        jsonGenerator
            .writeFieldName("details")
            .writeValue(respondActivityTaskFailedRequest.getDetails());
      }

      jsonGenerator.writeEndObject();

      byte[] content = jsonGenerator.getBytes();
      request.setContent(new ByteArrayInputStream(content));
      request.addHeader("Content-Length", Integer.toString(content.length));
      request.addHeader("Content-Type", protocolFactory.getContentType());
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  public Request<RegisterActivityTypeRequest> marshall(
      RegisterActivityTypeRequest registerActivityTypeRequest) {

    if (registerActivityTypeRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<RegisterActivityTypeRequest> request =
        new DefaultRequest<RegisterActivityTypeRequest>(
            registerActivityTypeRequest, "AmazonSimpleWorkflow");
    request.addHeader("X-Amz-Target", "SimpleWorkflowService.RegisterActivityType");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

    try {
      final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator();

      jsonGenerator.writeStartObject();

      if (registerActivityTypeRequest.getDomain() != null) {
        jsonGenerator.writeFieldName("domain").writeValue(registerActivityTypeRequest.getDomain());
      }
      if (registerActivityTypeRequest.getName() != null) {
        jsonGenerator.writeFieldName("name").writeValue(registerActivityTypeRequest.getName());
      }
      if (registerActivityTypeRequest.getVersion() != null) {
        jsonGenerator
            .writeFieldName("version")
            .writeValue(registerActivityTypeRequest.getVersion());
      }
      if (registerActivityTypeRequest.getDescription() != null) {
        jsonGenerator
            .writeFieldName("description")
            .writeValue(registerActivityTypeRequest.getDescription());
      }
      if (registerActivityTypeRequest.getDefaultTaskStartToCloseTimeout() != null) {
        jsonGenerator
            .writeFieldName("defaultTaskStartToCloseTimeout")
            .writeValue(registerActivityTypeRequest.getDefaultTaskStartToCloseTimeout());
      }
      if (registerActivityTypeRequest.getDefaultTaskHeartbeatTimeout() != null) {
        jsonGenerator
            .writeFieldName("defaultTaskHeartbeatTimeout")
            .writeValue(registerActivityTypeRequest.getDefaultTaskHeartbeatTimeout());
      }
      if (registerActivityTypeRequest.getDefaultTaskList() != null) {
        jsonGenerator.writeFieldName("defaultTaskList");
        TaskListJsonMarshaller.getInstance()
            .marshall(registerActivityTypeRequest.getDefaultTaskList(), jsonGenerator);
      }
      if (registerActivityTypeRequest.getDefaultTaskPriority() != null) {
        jsonGenerator
            .writeFieldName("defaultTaskPriority")
            .writeValue(registerActivityTypeRequest.getDefaultTaskPriority());
      }
      if (registerActivityTypeRequest.getDefaultTaskScheduleToStartTimeout() != null) {
        jsonGenerator
            .writeFieldName("defaultTaskScheduleToStartTimeout")
            .writeValue(registerActivityTypeRequest.getDefaultTaskScheduleToStartTimeout());
      }
      if (registerActivityTypeRequest.getDefaultTaskScheduleToCloseTimeout() != null) {
        jsonGenerator
            .writeFieldName("defaultTaskScheduleToCloseTimeout")
            .writeValue(registerActivityTypeRequest.getDefaultTaskScheduleToCloseTimeout());
      }

      jsonGenerator.writeEndObject();

      byte[] content = jsonGenerator.getBytes();
      request.setContent(new ByteArrayInputStream(content));
      request.addHeader("Content-Length", Integer.toString(content.length));
      request.addHeader("Content-Type", protocolFactory.getContentType());
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }