@robinpath/soap
0.1.1Node.jsPublicSOAP web service client, XML-RPC support, WSDL parsing, and envelope building
SOAP
SOAP web service client, XML-RPC support, WSDL parsing, and envelope building
Package: @robinpath/soap | Category: Web | Type: Utility
Authentication
No authentication required. All functions are available immediately.
Use Cases
Use the soap module when you need to:
- Call a SOAP web service -- Use
soap.callto perform this operation - Build SOAP XML envelope -- Use
soap.buildEnvelopeto perform this operation - Parse SOAP XML response -- Use
soap.parseEnvelopeto perform this operation - Call XML-RPC service -- Use
soap.xmlRpcto perform this operation - Build XML-RPC request -- Use
soap.buildXmlRpcto perform this operation
Quick Reference
| Function | Description | Returns |
|---|---|---|
call | Call a SOAP web service | {status, ok, fault, result, raw} |
buildEnvelope | Build SOAP XML envelope | SOAP XML |
parseEnvelope | Parse SOAP XML response | {fault, result} |
xmlRpc | Call XML-RPC service | {status, ok, fault, params, raw} |
buildXmlRpc | Build XML-RPC request | XML-RPC XML |
parseXmlRpc | Parse XML-RPC response | {fault, params} |
wsdl | Fetch and parse WSDL | {services, operations, bindings, raw} |
fault | Create SOAP fault XML | Fault XML |
getFault | Extract fault from SOAP XML | {code, message, detail} or null |
Functions
call
Call a SOAP web service
Module: soap | Returns: object -- {status, ok, fault, result, raw}
soap.call "http://example.com/ws" "GetUser" {"id": 1} {"namespace": "http://example.com"}
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Service URL |
method | string | Yes | Method name |
params | object | No | Parameters |
options | object | No | {namespace, soapAction, headers, timeout} |
buildEnvelope
Build SOAP XML envelope
Module: soap | Returns: string -- SOAP XML
soap.buildEnvelope "GetUser" {"id": 1}
| Parameter | Type | Required | Description |
|---|---|---|---|
method | string | Yes | Method name |
params | object | No | Parameters |
namespace | string | No | XML namespace |
parseEnvelope
Parse SOAP XML response
Module: soap | Returns: object -- {fault, result}
soap.parseEnvelope $xml
| Parameter | Type | Required | Description |
|---|---|---|---|
xml | string | Yes | SOAP XML |
xmlRpc
Call XML-RPC service
Module: soap | Returns: object -- {status, ok, fault, params, raw}
soap.xmlRpc "http://example.com/rpc" "system.listMethods" []
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Service URL |
method | string | Yes | Method name |
params | array | No | Parameters array |
options | object | No | {headers, timeout} |
buildXmlRpc
Build XML-RPC request
Module: soap | Returns: string -- XML-RPC XML
soap.buildXmlRpc "getUser" [1, "admin"]
| Parameter | Type | Required | Description |
|---|---|---|---|
method | string | Yes | Method name |
params | array | No | Parameters |
parseXmlRpc
Parse XML-RPC response
Module: soap | Returns: object -- {fault, params}
soap.parseXmlRpc $xml
| Parameter | Type | Required | Description |
|---|---|---|---|
xml | string | Yes | XML-RPC XML |
wsdl
Fetch and parse WSDL
Module: soap | Returns: object -- {services, operations, bindings, raw}
soap.wsdl "http://example.com/ws?wsdl"
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | WSDL URL |
options | object | No | {timeout} |
fault
Create SOAP fault XML
Module: soap | Returns: string -- Fault XML
soap.fault "Client" "Invalid request"
| Parameter | Type | Required | Description |
|---|---|---|---|
code | string | Yes | Fault code |
message | string | Yes | Fault message |
detail | string | No | Detail |
getFault
Extract fault from SOAP XML
Module: soap | Returns: object -- {code, message, detail} or null
soap.getFault $xml
| Parameter | Type | Required | Description |
|---|---|---|---|
xml | string | Yes | SOAP XML |
Error Handling
All functions throw on failure. Common errors:
| Error | Cause |
|---|---|
| (standard errors) | Check function parameters and authentication |
@desc "Call and validate result"
do
set $result as soap.call "http://example.com/ws" "GetUser" {"id": 1} {"namespace": "http://example.com"}
if $result != null
print "Success"
else
print "No result"
end
enddo
Recipes
1. List and iterate Fault
Retrieve all items and loop through them.
@desc "Get fault and iterate results"
do
set $result as soap.getFault $xml
each $item in $result
print $item
end
enddo
2. Multi-step SOAP workflow
Chain multiple soap operations together.
@desc "Call, build envelope, and more"
do
set $r_call as soap.call "http://example.com/ws" "GetUser" {"id": 1} {"namespace": "http://example.com"}
set $r_buildEnvelope as soap.buildEnvelope "GetUser" {"id": 1}
set $r_parseEnvelope as soap.parseEnvelope $xml
print "All operations complete"
enddo
3. Safe call with validation
Check results before proceeding.
@desc "Call and validate result"
do
set $result as soap.call "http://example.com/ws" "GetUser" {"id": 1} {"namespace": "http://example.com"}
if $result != null
print "Success: " + $result
else
print "Operation returned no data"
end
enddo
Related Modules
- json -- JSON module for complementary functionality
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.1 | latest | 1 months ago |
Related Modules
ftp
JS@robinpathv0.1.3
FTP and SFTP file transfer operations
http
JS@robinpathv0.1.3
HTTP server for RobinPath scripts. Register routes with static responses (JSON, HTML, files), enable CORS, serve static directories. No callbacks needed.
form
JS@robinpathv0.2.1
Declarative form builder for RobinPath scripts � define fields inline, generate schemas, validate submissions
api
JS@robinpathv0.1.2
HTTP client for making requests to external APIs with profiles, auth, download/upload, and auto-JSON parsing
$ robinpath add @robinpath/soap
