A Java utility library for interacting with the Electronic Submission of Medical Documentation (esMD) Wiser API. This utility provides comprehensive functionality for uploading, downloading, and managing Wiser requests and responses through the esMD system.
- File Upload: Upload Wiser requests to esMD with presigned URL support
- File Download: Download Wiser responses from esMD with automatic extraction
- Authentication: OAuth-based authentication with multiple scopes
- Notifications: Send pickup and status notifications to esMD
- Security: Comprehensive input validation and security utilities
- Configuration: YAML-based configuration management
- Logging: Structured logging with sensitive data masking
- Java 11 or higher
- Maven 3.6+
- Access to esMD API (dev, val, uat, or prod environments)
- Valid credentials for esMD authentication
git clone <repository-url>
cd esmd-wiser-utilitymvn clean compilemvn testmvn clean packageThe application uses a YAML configuration file (src/main/resources/api-properties.yml) for all settings:
api:
environment:
dev: https://dev.cpiapigateway.cms.gov/api/esmd/v1
val: https://val.cpiapigateway.cms.gov/api/esmd/v1
uat: https://val.cpiapigateway.cms.gov/api/esmd/ext/v1
prod: https://cpiapigateway.cms.gov/api/esmd/ext/v1userinfo:
mailboxid: WSDEV101
clientid: your-client-id
clientsecret: your-client-secretapi:
file-download:
local-path: c:\\esmd\\wiser\\downloads
file-upload:
local-path: c:\\esmd\\wiser\\upload
partsize: 200857600import gov.cms.esmd.rc.impl.UploadImpl;
public class Example {
public static void main(String[] args) throws Exception {
UploadImpl uploadImpl = new UploadImpl();
StatusDetail result = uploadImpl.uploadWiserRequestsToesMD("dev");
System.out.println("Upload Status: " + result.getStatus());
}
}import gov.cms.esmd.rc.impl.DownloadImpl;
import java.util.List;
public class Example {
public static void main(String[] args) throws Exception {
DownloadImpl downloadImpl = new DownloadImpl();
List<StatusDetail> results = downloadImpl.downloadWiserRequestsFromesMD("dev");
for (StatusDetail result : results) {
System.out.println("Download Status: " + result.getStatus());
System.out.println("File: " + result.getEsMDTransactionID());
}
}
}import gov.cms.esmd.rc.impl.NotificationsImpl;
public class Example {
public static void main(String[] args) throws Exception {
NotificationsImpl notifications = new NotificationsImpl();
// Create pickup notification
String notificationJson = notifications.createPickupNotification(
"PICKUP_CONFIRMATION_WISER_MAC",
"WSDEV101",
"ZKW0007260517EC",
"ES9999.D.L1.EZKW0007260517EC.ESMD2.D071425.T2219020.zip"
);
// Send notification
NotificationResponse response = notifications.sendNotificationToESMD(
"dev", notificationJson, "PICKUP"
);
}
}Handles uploading Wiser requests to esMD.
Methods:
uploadWiserRequestsToesMD(String environment)- Upload files from local directory
Handles downloading Wiser responses from esMD.
Methods:
downloadWiserRequestsFromesMD(String environment)- Download and extract files
Handles sending notifications to esMD.
Methods:
sendNotificationToESMD(String environment, String jsonMessage, String notificationType)- Send notificationcreatePickupNotification(String notificationType, String senderRoutingID, String esMDTransactionId, String filename)- Create pickup notification JSON
Manages YAML configuration loading and validation.
Provides input validation and sanitization utilities.
Handles file operations and directory management.
Provides JSON serialization/deserialization using Gson.
- Input Validation: Comprehensive validation using regex patterns
- Data Sanitization: Automatic sanitization of user inputs
- Sensitive Data Masking: Automatic masking of sensitive information in logs
- Path Traversal Prevention: Protection against directory traversal attacks
- Size Limits: Enforced limits on file sizes and JSON payloads
- Update Dependencies: Regularly update all dependencies, especially SnakeYAML
- Secure Configuration: Store sensitive credentials in secure locations
- Network Security: Use HTTPS for all API communications
- Input Validation: Always validate user inputs before processing
- Error Handling: Never expose sensitive information in error messages
# Run all tests
mvn test
# Run specific test class
mvn test -Dtest=ErrorMessageTest
# Run with coverage
mvn test jacoco:report- Unit Tests: Located in
src/test/java - Test Coverage: Comprehensive coverage of core functionality
- Mocking: Uses Mockito for API client testing
- Assertions: Uses AssertJ for fluent assertions
esmd-wiser-utility/
βββ src/
β βββ main/
β β βββ java/
β β β βββ gov/cms/esmd/
β β β βββ auth/ # Authentication classes
β β β βββ bean/ # Data transfer objects
β β β β βββ adminerror/ # Admin error beans
β β β β βββ auth/ # Authentication beans
β β β β βββ parejectjson/ # PA reject JSON beans
β β β β βββ rcmetadata/ # RC metadata beans
β β β β βββ response/ # Response beans
β β β βββ notifications/ # Notification implementations
β β β βββ rc/ # RC (Request/Response) classes
β β β β βββ api/client/ # API client implementations
β β β β βββ impl/ # Implementation classes
β β β βββ utility/ # Utility classes
β β βββ resources/
β β βββ api-properties.yml # Configuration file
β β βββ logback.xml # Logging configuration
β βββ test/
β βββ java/ # Test classes
βββ pom.xml # Maven configuration
βββ SECURITY_IMPROVEMENTS.md # Security documentation
βββ README.md # This file
- SnakeYAML 2.2 - YAML configuration parsing
- Gson 2.10.1 - JSON processing
- Apache HttpClient 4.5.13 - HTTP client
- Commons Lang3 3.14.0 - String utilities
- Commons IO 2.16.1 - File utilities
- Logback 1.2.6 - Logging framework
- JUnit 5.10.0 - Testing framework
- Mockito 5.5.0 - Mocking framework
- AssertJ 3.24.2 - Fluent assertions
- SnakeYAML Security Vulnerability: Update to version 2.4+ immediately
- HTTP Client Version: Consider updating Apache HttpClient to latest version
- Logback Version: Update to latest version for security patches
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
This project is licensed under the terms specified in the project documentation.
For support and questions:
- Check the test cases for usage examples
- Ensure all dependencies are up to date
- v1.0-SNAPSHOT: Initial release with core functionality
- Upload/Download capabilities
- Authentication system
- Notification support
- Security utilities
- Comprehensive testing
Note: This utility is designed for use with the CMS esMD system. Ensure you have proper authorization and credentials before using in production environments.