SOAP Web Services
Consume SOAP web services with BoxLang's fluent SOAP client
🚀 Quick Start
// Create SOAP client from WSDL
ws = soap( "http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL" );
// Invoke operations using invoke() method
countries = ws.invoke( "ListOfContinentsByName" );
dump( countries );
// Pass arguments as struct
countryInfo = ws.invoke( "CountryISOCode", { sCountryName: "United States" } );
dump( countryInfo );📋 Key Features
📋 Table of Contents
🎯 The soap() BIF
soap() BIFBasic Syntax
Parameters
Parameter
Type
Required
Description
Return Value
🔧 Configuration Methods
timeout( seconds )
timeout( seconds )withBasicAuth( username, password )
withBasicAuth( username, password )header( name, value )
header( name, value )soapVersion( version )
soapVersion( version )Chaining Configuration
🎬 Invoking SOAP Operations
Syntax
Parameters
Parameter
Type
Required
Description
🌍 Real-World Examples
Example 1: Country Information Service
Example 2: Weather Service
Example 3: Payment Gateway
Example 4: CRM Integration
Example 5: Shipping Service
📊 Client Information Methods
getOperationNames()
getOperationNames()hasOperation( operationName )
hasOperation( operationName )getOperationInfo( operationName )
getOperationInfo( operationName )getStatistics()
getStatistics()toStruct()
toStruct()🔄 Automatic Type Conversion
XML Schema Types to BoxLang
XML Schema Type
BoxLang Type
Example
Intelligent Casting
Complex Type Conversion
Array Conversion
Response Unwrapping
🔍 WSDL Discovery
Example: Inspecting a Service
⚠️ Error Handling
SOAP Fault Structure
💡 Best Practices
🔧 Advanced Usage
Programmatic Operation Discovery
Building a SOAP Service Wrapper
Handling Multiple Services
📚 SOAP vs REST
Use SOAP When:
Use REST (http() BIF) When:
🎯 Summary
Last updated
Was this helpful?
