or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

arn-support.mdauthentication.mdclient-builders.mdendpoint-discovery.mdexception-handling.mdhttp-transport.mdindex.mdmetrics-monitoring.mdprotocols.mdregions-endpoints.mdretry-policies.mdutilities.mdwaiters.md

protocols.mddocs/

0

# Protocol Support & Marshalling

1

2

The AWS Java SDK Core provides comprehensive protocol support for AWS services, including JSON, CBOR, and REST protocols with automatic marshalling and unmarshalling capabilities.

3

4

## Core Protocol Framework

5

6

### Protocol Types

7

8

```java { .api }

9

// Protocol enumeration

10

enum Protocol {

11

HTTP("http", 80, false),

12

HTTPS("https", 443, true);

13

14

public String toString();

15

public int getDefaultPort();

16

public boolean isSecure();

17

}

18

19

// Protocol marshaller interface

20

interface ProtocolMarshaller {

21

<T> void marshall(T val, ProtocolRequestMarshaller<T> protocolRequestMarshaller);

22

}

23

24

// Protocol request marshaller interface

25

interface ProtocolRequestMarshaller<T> {

26

void marshall(T input, Request<T> request);

27

}

28

29

// Structured data object interface

30

interface StructuredPojo {

31

void marshall(ProtocolMarshaller protocolMarshaller);

32

}

33

```

34

35

### Marshalling Framework

36

37

```java { .api }

38

// Marshalling information for fields

39

class MarshallingInfo<T> {

40

public static <T> MarshallingInfo<T> builder(MarshallingType<T> marshallingType);

41

public MarshallingInfo<T> marshallLocation(MarshallLocation marshallLocation);

42

public MarshallingInfo<T> locationName(String locationName);

43

public MarshallingInfo<T> defaultValueSupplier(DefaultValueSupplier<T> defaultValueSupplier);

44

public MarshallingInfo<T> timestampFormat(String timestampFormat);

45

public MarshallingInfo<T> isBinary(boolean isBinary);

46

public MarshallingInfo<T> isExplicitPayloadMember(boolean isExplicitPayloadMember);

47

public MarshallingInfo<T> isGreedy(boolean isGreedy);

48

49

public MarshallingType<T> getMarshallingType();

50

public MarshallLocation getMarshallLocation();

51

public String getLocationName();

52

public DefaultValueSupplier<T> getDefaultValueSupplier();

53

public String getTimestampFormat();

54

public boolean isBinary();

55

public boolean isExplicitPayloadMember();

56

public boolean isGreedy();

57

}

58

59

// Marshalling type interface

60

interface MarshallingType<T> {

61

// Marker interface for type safety

62

}

63

64

// Marshalling locations

65

enum MarshallLocation {

66

PAYLOAD,

67

QUERY_PARAM,

68

HEADER,

69

PATH,

70

GREEDY_PATH,

71

STATUS_CODE

72

}

73

74

// Operation information

75

class OperationInfo {

76

public static OperationInfo create();

77

public OperationInfo requestUri(String requestUri);

78

public OperationInfo httpMethod(HttpMethodName httpMethod);

79

public OperationInfo operationIdentifier(String operationIdentifier);

80

public OperationInfo serviceId(String serviceId);

81

public OperationInfo hasExplicitPayloadMember(boolean hasExplicitPayloadMember);

82

public OperationInfo hasPayloadMembers(boolean hasPayloadMembers);

83

public OperationInfo addRequestHeader(String name, String value);

84

85

public String getRequestUri();

86

public HttpMethodName getHttpMethod();

87

public String getOperationIdentifier();

88

public String getServiceId();

89

public boolean hasExplicitPayloadMember();

90

public boolean hasPayloadMembers();

91

public Map<String, String> getAdditionalHeaders();

92

}

93

94

// Default value supplier interface

95

interface DefaultValueSupplier<T> {

96

T get();

97

}

98

```

99

100

## JSON Protocol Support

101

102

### JSON Client Configuration

103

104

```java { .api }

105

// Metadata for JSON protocol clients

106

class JsonClientMetadata {

107

public JsonClientMetadata withProtocolVersion(String protocolVersion);

108

public JsonClientMetadata withSupportsCbor(boolean supportsCbor);

109

public JsonClientMetadata withSupportsIon(boolean supportsIon);

110

public JsonClientMetadata withContentType(String contentType);

111

112

public String getProtocolVersion();

113

public boolean isSupportsCbor();

114

public boolean isSupportsIon();

115

public String getContentType();

116

}

117

118

// Metadata for JSON operations

119

class JsonOperationMetadata {

120

public JsonOperationMetadata withPayloadJson(boolean payloadJson);

121

public JsonOperationMetadata withHasStreamingSuccessResponse(boolean hasStreamingSuccessResponse);

122

123

public boolean isPayloadJson();

124

public boolean hasStreamingSuccessResponse();

125

}

126

127

// Metadata for JSON error responses

128

class JsonErrorResponseMetadata {

129

public JsonErrorResponseMetadata withCustomErrorCodeFieldName(String customErrorCodeFieldName);

130

public JsonErrorResponseMetadata withErrorMessageFieldName(String errorMessageFieldName);

131

132

public String getCustomErrorCodeFieldName();

133

public String getErrorMessageFieldName();

134

}

135

136

// Metadata for JSON error shapes

137

class JsonErrorShapeMetadata {

138

public JsonErrorShapeMetadata withErrorCode(String errorCode);

139

public JsonErrorShapeMetadata withModeledClass(Class<? extends RuntimeException> modeledClass);

140

public JsonErrorShapeMetadata withHttpStatusCode(int httpStatusCode);

141

142

public String getErrorCode();

143

public Class<? extends RuntimeException> getModeledClass();

144

public int getHttpStatusCode();

145

}

146

```

147

148

### JSON Protocol Factory

149

150

```java { .api }

151

// Factory for JSON protocol handlers

152

class SdkJsonProtocolFactory {

153

public SdkJsonProtocolFactory(JsonClientMetadata metadata);

154

155

public <OrigRequest extends AmazonWebServiceRequest> ProtocolRequestMarshaller<OrigRequest>

156

createProtocolMarshaller(OperationInfo operationInfo);

157

158

public <ResponseType> HttpResponseHandler<ResponseType> createResponseHandler(

159

JsonOperationMetadata operationMetadata,

160

Unmarshaller<ResponseType, JsonUnmarshallerContext> responseUnmarshaller);

161

162

public HttpResponseHandler<SdkBaseException> createErrorResponseHandler(

163

JsonErrorResponseMetadata errorResponseMetadata,

164

List<JsonErrorUnmarshallerV2> errorUnmarshallers);

165

}

166

167

// Builder for JSON protocol marshallers

168

class JsonProtocolMarshallerBuilder<T> {

169

public static <T> JsonProtocolMarshallerBuilder<T> create();

170

public JsonProtocolMarshallerBuilder<T> marshaller(SdkJsonMarshallerFactory marshallerFactory);

171

public JsonProtocolMarshallerBuilder<T> jsonGenerator(SdkJsonGenerator jsonGenerator);

172

public JsonProtocolMarshallerBuilder<T> endpoint(URI endpoint);

173

public JsonProtocolMarshallerBuilder<T> operationInfo(OperationInfo operationInfo);

174

public JsonProtocolMarshallerBuilder<T> originalRequest(T originalRequest);

175

public ProtocolRequestMarshaller<T> build();

176

}

177

178

// Factory for JSON marshallers

179

class SdkJsonMarshallerFactory {

180

public SdkJsonMarshallerFactory(SdkStructuredJsonFactory jsonFactory);

181

182

public <T> StructuredJsonMarshaller<T> getMarshaller(MarshallLocation marshallLocation,

183

MarshallingType<T> marshallingType);

184

}

185

```

186

187

### JSON Generation

188

189

```java { .api }

190

// JSON generator for SDK

191

interface SdkJsonGenerator extends StructuredJsonGenerator {

192

byte[] getBytes();

193

String getContentType();

194

}

195

196

// Structured JSON generator interface

197

interface StructuredJsonGenerator {

198

StructuredJsonGenerator writeStartArray();

199

StructuredJsonGenerator writeEndArray();

200

StructuredJsonGenerator writeStartObject();

201

StructuredJsonGenerator writeEndObject();

202

StructuredJsonGenerator writeFieldName(String fieldName);

203

StructuredJsonGenerator writeValue(String val);

204

StructuredJsonGenerator writeValue(boolean bool);

205

StructuredJsonGenerator writeValue(int val);

206

StructuredJsonGenerator writeValue(long val);

207

StructuredJsonGenerator writeValue(double val);

208

StructuredJsonGenerator writeValue(float val);

209

StructuredJsonGenerator writeValue(BigDecimal val);

210

StructuredJsonGenerator writeValue(BigInteger val);

211

StructuredJsonGenerator writeValue(Date val);

212

StructuredJsonGenerator writeValue(ByteBuffer bytes);

213

StructuredJsonGenerator writeNull();

214

StructuredJsonGenerator flush();

215

StructuredJsonGenerator close();

216

}

217

218

// Structured JSON marshaller interface

219

interface StructuredJsonMarshaller<T> {

220

void marshall(T val, StructuredJsonGenerator generator);

221

}

222

223

// Structured JSON factory interface

224

interface SdkStructuredJsonFactory {

225

StructuredJsonGenerator createWriter();

226

}

227

228

// Plain JSON factory implementation

229

class SdkStructuredPlainJsonFactory implements SdkStructuredJsonFactory {

230

public StructuredJsonGenerator createWriter();

231

}

232

233

// JSON content representation

234

class JsonContent {

235

public JsonContent(byte[] rawContent, String contentType);

236

public byte[] getRawContent();

237

public String getContentType();

238

}

239

```

240

241

## RPC v2 CBOR Protocol Support

242

243

### CBOR Client Configuration

244

245

```java { .api }

246

// Metadata for RPC v2 CBOR clients

247

class RpcV2CborClientMetadata {

248

public RpcV2CborClientMetadata withProtocolVersion(String protocolVersion);

249

public RpcV2CborClientMetadata withServiceId(String serviceId);

250

251

public String getProtocolVersion();

252

public String getServiceId();

253

}

254

255

// Metadata for RPC v2 CBOR operations

256

class RpcV2CborOperationMetadata {

257

public RpcV2CborOperationMetadata withHasStreamingSuccessResponse(boolean hasStreamingSuccessResponse);

258

259

public boolean hasStreamingSuccessResponse();

260

}

261

262

// Metadata for RPC v2 CBOR error responses

263

class RpcV2CborErrorResponseMetadata {

264

public RpcV2CborErrorResponseMetadata withCustomErrorCodeFieldName(String customErrorCodeFieldName);

265

public RpcV2CborErrorResponseMetadata withErrorMessageFieldName(String errorMessageFieldName);

266

267

public String getCustomErrorCodeFieldName();

268

public String getErrorMessageFieldName();

269

}

270

271

// Metadata for RPC v2 CBOR error shapes

272

class RpcV2CborErrorShapeMetadata {

273

public RpcV2CborErrorShapeMetadata withErrorCode(String errorCode);

274

public RpcV2CborErrorShapeMetadata withModeledClass(Class<? extends RuntimeException> modeledClass);

275

public RpcV2CborErrorShapeMetadata withHttpStatusCode(int httpStatusCode);

276

277

public String getErrorCode();

278

public Class<? extends RuntimeException> getModeledClass();

279

public int getHttpStatusCode();

280

}

281

```

282

283

### CBOR Protocol Factory

284

285

```java { .api }

286

// Factory for RPC v2 CBOR protocol

287

class SdkRpcV2CborProtocolFactory {

288

public SdkRpcV2CborProtocolFactory(RpcV2CborClientMetadata metadata);

289

290

public <OrigRequest extends AmazonWebServiceRequest> ProtocolRequestMarshaller<OrigRequest>

291

createProtocolMarshaller(OperationInfo operationInfo);

292

293

public <ResponseType> HttpResponseHandler<ResponseType> createResponseHandler(

294

RpcV2CborOperationMetadata operationMetadata,

295

Unmarshaller<ResponseType, JsonUnmarshallerContext> responseUnmarshaller);

296

297

public HttpResponseHandler<SdkBaseException> createErrorResponseHandler(

298

RpcV2CborErrorResponseMetadata errorResponseMetadata,

299

List<JsonErrorUnmarshallerV2> errorUnmarshallers);

300

}

301

302

// Builder for RPC v2 CBOR protocol marshallers

303

class RpcV2CborProtocolMarshallerBuilder<T> {

304

public static <T> RpcV2CborProtocolMarshallerBuilder<T> create();

305

public RpcV2CborProtocolMarshallerBuilder<T> endpoint(URI endpoint);

306

public RpcV2CborProtocolMarshallerBuilder<T> operationInfo(OperationInfo operationInfo);

307

public RpcV2CborProtocolMarshallerBuilder<T> originalRequest(T originalRequest);

308

public ProtocolRequestMarshaller<T> build();

309

}

310

```

311

312

### CBOR Generation

313

314

```java { .api }

315

// CBOR generator for RPC v2

316

interface SdkRpcV2CborGenerator extends StructuredRpcV2CborGenerator {

317

byte[] getBytes();

318

String getContentType();

319

}

320

321

// Structured CBOR generator interface

322

interface StructuredRpcV2CborGenerator {

323

StructuredRpcV2CborGenerator writeStartArray();

324

StructuredRpcV2CborGenerator writeEndArray();

325

StructuredRpcV2CborGenerator writeStartObject();

326

StructuredRpcV2CborGenerator writeEndObject();

327

StructuredRpcV2CborGenerator writeFieldName(String fieldName);

328

StructuredRpcV2CborGenerator writeValue(String val);

329

StructuredRpcV2CborGenerator writeValue(boolean bool);

330

StructuredRpcV2CborGenerator writeValue(int val);

331

StructuredRpcV2CborGenerator writeValue(long val);

332

StructuredRpcV2CborGenerator writeValue(double val);

333

StructuredRpcV2CborGenerator writeValue(float val);

334

StructuredRpcV2CborGenerator writeValue(BigDecimal val);

335

StructuredRpcV2CborGenerator writeValue(BigInteger val);

336

StructuredRpcV2CborGenerator writeValue(Date val);

337

StructuredRpcV2CborGenerator writeValue(ByteBuffer bytes);

338

StructuredRpcV2CborGenerator writeNull();

339

StructuredRpcV2CborGenerator flush();

340

StructuredRpcV2CborGenerator close();

341

}

342

343

// Structured RPC v2 CBOR marshaller interface

344

interface StructuredRpcV2CborMarshaller<T> {

345

void marshall(T val, StructuredRpcV2CborGenerator generator);

346

}

347

348

// Structured CBOR factory interface

349

interface SdkStructuredRpcV2CborFactory {

350

StructuredRpcV2CborGenerator createWriter();

351

}

352

353

// CBOR factory implementation

354

class SdkStructuredCborFactory implements SdkStructuredRpcV2CborFactory {

355

public StructuredRpcV2CborGenerator createWriter();

356

}

357

```

358

359

## Usage Examples

360

361

### Basic JSON Protocol Configuration

362

363

```java

364

import com.amazonaws.protocol.*;

365

import com.amazonaws.protocol.json.*;

366

367

// Create JSON client metadata

368

JsonClientMetadata jsonMetadata = new JsonClientMetadata()

369

.withProtocolVersion("1.1")

370

.withContentType("application/x-amz-json-1.1")

371

.withSupportsCbor(false);

372

373

// Create JSON protocol factory

374

SdkJsonProtocolFactory protocolFactory = new SdkJsonProtocolFactory(jsonMetadata);

375

376

// Create operation info

377

OperationInfo operationInfo = OperationInfo.create()

378

.requestUri("/")

379

.httpMethod(HttpMethodName.POST)

380

.serviceId("MyService")

381

.operationIdentifier("MyOperation");

382

383

// Create protocol marshaller

384

ProtocolRequestMarshaller<MyRequest> marshaller =

385

protocolFactory.createProtocolMarshaller(operationInfo);

386

```

387

388

### Custom Marshalling Configuration

389

390

```java

391

import com.amazonaws.protocol.*;

392

393

// Define marshalling information for a field

394

MarshallingInfo<String> stringField = MarshallingInfo.<String>builder(MarshallingType.STRING)

395

.marshallLocation(MarshallLocation.PAYLOAD)

396

.locationName("fieldName")

397

.build();

398

399

MarshallingInfo<Integer> headerField = MarshallingInfo.<Integer>builder(MarshallingType.INTEGER)

400

.marshallLocation(MarshallLocation.HEADER)

401

.locationName("X-Custom-Header")

402

.build();

403

404

MarshallingInfo<String> pathField = MarshallingInfo.<String>builder(MarshallingType.STRING)

405

.marshallLocation(MarshallLocation.PATH)

406

.locationName("resourceId")

407

.isGreedy(false)

408

.build();

409

410

MarshallingInfo<Date> timestampField = MarshallingInfo.<Date>builder(MarshallingType.DATE)

411

.marshallLocation(MarshallLocation.PAYLOAD)

412

.locationName("timestamp")

413

.timestampFormat("iso8601")

414

.build();

415

```

416

417

### Structured Pojo Implementation

418

419

```java

420

import com.amazonaws.protocol.*;

421

422

public class MyRequestPojo implements StructuredPojo {

423

private String name;

424

private Integer count;

425

private Date timestamp;

426

427

// Constructors and getters/setters...

428

429

@Override

430

public void marshall(ProtocolMarshaller protocolMarshaller) {

431

protocolMarshaller.marshall(name, NAME_BINDING);

432

protocolMarshaller.marshall(count, COUNT_BINDING);

433

protocolMarshaller.marshall(timestamp, TIMESTAMP_BINDING);

434

}

435

436

private static final MarshallingInfo<String> NAME_BINDING =

437

MarshallingInfo.<String>builder(MarshallingType.STRING)

438

.marshallLocation(MarshallLocation.PAYLOAD)

439

.locationName("Name")

440

.build();

441

442

private static final MarshallingInfo<Integer> COUNT_BINDING =

443

MarshallingInfo.<Integer>builder(MarshallingType.INTEGER)

444

.marshallLocation(MarshallLocation.PAYLOAD)

445

.locationName("Count")

446

.build();

447

448

private static final MarshallingInfo<Date> TIMESTAMP_BINDING =

449

MarshallingInfo.<Date>builder(MarshallingType.DATE)

450

.marshallLocation(MarshallLocation.PAYLOAD)

451

.locationName("Timestamp")

452

.timestampFormat("unixTimestamp")

453

.build();

454

}

455

```

456

457

### RPC v2 CBOR Protocol Configuration

458

459

```java

460

import com.amazonaws.protocol.rpcv2cbor.*;

461

462

// Create CBOR client metadata

463

RpcV2CborClientMetadata cborMetadata = new RpcV2CborClientMetadata()

464

.withProtocolVersion("2.0")

465

.withServiceId("MyService");

466

467

// Create CBOR protocol factory

468

SdkRpcV2CborProtocolFactory cborFactory = new SdkRpcV2CborProtocolFactory(cborMetadata);

469

470

// Create operation metadata

471

RpcV2CborOperationMetadata operationMetadata = new RpcV2CborOperationMetadata()

472

.withHasStreamingSuccessResponse(false);

473

474

// Create protocol marshaller

475

ProtocolRequestMarshaller<MyRequest> cborMarshaller =

476

cborFactory.createProtocolMarshaller(operationInfo);

477

```

478

479

### Custom JSON Generator Usage

480

481

```java

482

import com.amazonaws.protocol.json.*;

483

484

// Create JSON factory

485

SdkStructuredJsonFactory jsonFactory = new SdkStructuredPlainJsonFactory();

486

487

// Create JSON generator

488

StructuredJsonGenerator generator = jsonFactory.createWriter();

489

490

// Generate JSON content

491

generator.writeStartObject()

492

.writeFieldName("name").writeValue("example")

493

.writeFieldName("count").writeValue(42)

494

.writeFieldName("active").writeValue(true)

495

.writeFieldName("items")

496

.writeStartArray()

497

.writeValue("item1")

498

.writeValue("item2")

499

.writeEndArray()

500

.writeEndObject();

501

502

// Get bytes if using SdkJsonGenerator

503

if (generator instanceof SdkJsonGenerator) {

504

SdkJsonGenerator sdkGenerator = (SdkJsonGenerator) generator;

505

byte[] jsonBytes = sdkGenerator.getBytes();

506

String contentType = sdkGenerator.getContentType();

507

}

508

```

509

510

### Error Response Handling

511

512

```java

513

import com.amazonaws.protocol.json.*;

514

import java.util.*;

515

516

// Create error shape metadata

517

List<JsonErrorShapeMetadata> errorShapes = Arrays.asList(

518

new JsonErrorShapeMetadata()

519

.withErrorCode("InvalidRequest")

520

.withModeledClass(InvalidRequestException.class)

521

.withHttpStatusCode(400),

522

new JsonErrorShapeMetadata()

523

.withErrorCode("ResourceNotFound")

524

.withModeledClass(ResourceNotFoundException.class)

525

.withHttpStatusCode(404)

526

);

527

528

// Create error response metadata

529

JsonErrorResponseMetadata errorMetadata = new JsonErrorResponseMetadata()

530

.withCustomErrorCodeFieldName("__type")

531

.withErrorMessageFieldName("message");

532

533

// Create error unmarshallers

534

List<JsonErrorUnmarshallerV2> errorUnmarshallers = new ArrayList<>();

535

for (JsonErrorShapeMetadata errorShape : errorShapes) {

536

errorUnmarshallers.add(new JsonErrorUnmarshallerV2(

537

errorShape.getModeledClass(),

538

errorShape.getErrorCode()

539

));

540

}

541

542

// Create error response handler

543

HttpResponseHandler<SdkBaseException> errorHandler =

544

protocolFactory.createErrorResponseHandler(errorMetadata, errorUnmarshallers);

545

```

546

547

### Default Value Suppliers

548

549

```java

550

import com.amazonaws.protocol.*;

551

552

// String default value supplier

553

DefaultValueSupplier<String> stringDefault = () -> "defaultValue";

554

555

// Integer default value supplier

556

DefaultValueSupplier<Integer> intDefault = () -> 100;

557

558

// List default value supplier

559

DefaultValueSupplier<List<String>> listDefault = () -> Arrays.asList("default1", "default2");

560

561

// Use in marshalling info

562

MarshallingInfo<String> fieldWithDefault = MarshallingInfo.<String>builder(MarshallingType.STRING)

563

.marshallLocation(MarshallLocation.PAYLOAD)

564

.locationName("fieldName")

565

.defaultValueSupplier(stringDefault)

566

.build();

567

```

568

569

## Advanced Protocol Features

570

571

### Binary Data Handling

572

573

```java

574

import com.amazonaws.protocol.*;

575

import java.nio.ByteBuffer;

576

577

// Binary field configuration

578

MarshallingInfo<ByteBuffer> binaryField = MarshallingInfo.<ByteBuffer>builder(MarshallingType.BYTE_BUFFER)

579

.marshallLocation(MarshallLocation.PAYLOAD)

580

.locationName("binaryData")

581

.isBinary(true)

582

.build();

583

584

// Streaming binary payload

585

MarshallingInfo<InputStream> streamField = MarshallingInfo.<InputStream>builder(MarshallingType.STREAM)

586

.marshallLocation(MarshallLocation.PAYLOAD)

587

.isExplicitPayloadMember(true)

588

.build();

589

```

590

591

### Timestamp Formats

592

593

```java

594

import com.amazonaws.protocol.*;

595

596

// ISO 8601 timestamp

597

MarshallingInfo<Date> iso8601Field = MarshallingInfo.<Date>builder(MarshallingType.DATE)

598

.marshallLocation(MarshallLocation.PAYLOAD)

599

.locationName("createdAt")

600

.timestampFormat("iso8601")

601

.build();

602

603

// Unix timestamp

604

MarshallingInfo<Date> unixField = MarshallingInfo.<Date>builder(MarshallingType.DATE)

605

.marshallLocation(MarshallLocation.PAYLOAD)

606

.locationName("modifiedAt")

607

.timestampFormat("unixTimestamp")

608

.build();

609

610

// RFC 822 timestamp (for headers)

611

MarshallingInfo<Date> rfc822Field = MarshallingInfo.<Date>builder(MarshallingType.DATE)

612

.marshallLocation(MarshallLocation.HEADER)

613

.locationName("Last-Modified")

614

.timestampFormat("rfc822")

615

.build();

616

```

617

618

## Best Practices

619

620

1. **Protocol Selection**: Choose the appropriate protocol (JSON vs CBOR) based on service requirements and payload size considerations.

621

622

2. **Marshalling Efficiency**: Use specific marshalling types and locations to minimize serialization overhead.

623

624

3. **Error Handling**: Implement comprehensive error shape metadata to properly handle service-specific exceptions.

625

626

4. **Binary Data**: Use appropriate marshalling types for binary data to avoid unnecessary encoding/decoding.

627

628

5. **Timestamp Handling**: Use correct timestamp formats based on the target location (payload vs headers).

629

630

6. **Default Values**: Implement default value suppliers for optional fields to ensure consistent behavior.

631

632

7. **Memory Management**: Properly close generators and handle streaming content to prevent memory leaks.

633

634

8. **Content Types**: Ensure correct content type configuration for different protocol versions and formats.

635

636

The protocol support system provides comprehensive marshalling and unmarshalling capabilities for all AWS service protocols, enabling seamless data serialization and deserialization across different formats and transport mechanisms.