Salesforce Decode
Salesforcedecode
Back to questions
ApexIntermediateintegrationsoapapex

Design SOAP Apex web service for legacy ERP still on XML contracts

Real World Scenario

Legacy ERP cannot consume REST JSON. Salesforce must expose wsdl SOAP endpoint for order acknowledgment with bulk XML payload.

Expected Answer

• webservice keyword global methods with typed parameters • Bulkified webService static method accepting List<OrderRequest> • XML schema validation before DML mirroring REST validation rules • OAuth or certificate mutual auth for SOAP endpoint security • Governor limits same as synchronous Apex—design async for large payloads • Version wsdl with namespace when adding required fields • Test with WebServiceMockImpl for unit tests

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Main difference: use case and scale. webservice keyword global methods with typed parameters. Bulkified webService static method accepting List<OrderRequest>. Pick based on your integration pattern and team capability. SOAP persists in enterprise—wrap with same service layer as REST for business logic parity. Balance speed of delivery with maintainability.

Architect Perspective

SOAP persists in enterprise—wrap with same service layer as REST for business logic parity.