The following operations are supported. For a formal definition,
please review the
Service Description.
Web Service Links
Namespace Children of ::wsdb::bindings::mywebserviceSoapBind
Namespace Code for ::wsdb::bindings::mywebserviceSoapBind
namespace eval ::wsdb::bindings::mywebserviceSoapBind {
variable handleRequest ::wsdb::bindings::mywebserviceSoapBind::HandleRequest
variable portTypeName mywebservicePortType
variable portTypeNamespace ::mywebservice
variable soapActionArray
set soapActionArray(https://highfivediet.com/mywebservice/helloWorldOperation) helloWorldOperation
set soapActionArray(https://home.highfivediet.com/mywebservice/testitOperation) testitOperation
set soapActionArray(https://highfivediet.com/mywebservice/EchoSymbolOperation) EchoSymbolOperation
set soapActionArray(https://www.highfivediet.com.www.highfivediet.com/mywebservice/TestDecimalValueOperation) TestDecimalValueOperation
set soapActionArray(https://www.xn--xnx.io/mywebservice/helloWorldOperation) helloWorldOperation
set soapActionArray(https://www.xn--xnx.io/mywebservice/EchoSymbolOperation) EchoSymbolOperation
set soapActionArray(https://a.ns.highfivediet.com/mywebservice/TestDecimalValueOperation) TestDecimalValueOperation
set soapActionArray(https://www.highfivediet.com.www.highfivediet.com/mywebservice/EchoCodeOperation) EchoCodeOperation
set soapActionArray(https://www.xn--xnx.io/mywebservice/EchoByteOperation) EchoByteOperation
set soapActionArray(https://www.highfivediet.com.www.highfivediet.com/mywebservice/helloOperation) helloOperation
set soapActionArray(https://www.xn--xnx.io/mywebservice/helloOperation) helloOperation
set soapActionArray(https://home.highfivediet.com/mywebservice/testStringOperation) testStringOperation
set soapActionArray(https://a.ns.highfivediet.com/mywebservice/EchoCodeOperation) EchoCodeOperation
set soapActionArray(https://home.highfivediet.com/mywebservice/MultiplyNumbersOperation) MultiplyNumbersOperation
set soapActionArray(https://highfivediet.com/mywebservice/MultiplyNumbersOperation) MultiplyNumbersOperation
set soapActionArray(https://a.ns.highfivediet.com/mywebservice/testStringOperation) testStringOperation
set soapActionArray(https://highfivediet.com/mywebservice/AddNumbersOperation) AddNumbersOperation
set soapActionArray(https://www.highfivediet.com.www.highfivediet.com/mywebservice/MultiplyNumbersOperation) MultiplyNumbersOperation
set soapActionArray(https://www.xn--xnx.io/mywebservice/AddNumbersOperation) AddNumbersOperation
set soapActionArray(https://highfivediet.com/mywebservice/EchoOperation) EchoOperation
set soapActionArray(https://a.ns.highfivediet.com/mywebservice/helloOperation) helloOperation
set soapActionArray(https://highfivediet.com/mywebservice/helloOperation) helloOperation
set soapActionArray(https://www.highfivediet.com.www.highfivediet.com/mywebservice/helloWorldOperation) helloWorldOperation
set soapActionArray(https://www.xn--xnx.io/mywebservice/TestDecimalValueOperation) TestDecimalValueOperation
set soapActionArray(https://www.highfivediet.com.www.highfivediet.com/mywebservice/EchoSymbolOperation) EchoSymbolOperation
set soapActionArray(https://home.highfivediet.com/mywebservice/EchoByteOperation) EchoByteOperation
set soapActionArray(https://www.xn--xnx.io/mywebservice/EchoCodeOperation) EchoCodeOperation
set soapActionArray(https://a.ns.highfivediet.com/mywebservice/EchoOperation) EchoOperation
set soapActionArray(https://www.xn--xnx.io/mywebservice/MultiplyNumbersOperation) MultiplyNumbersOperation
set soapActionArray(https://highfivediet.com/mywebservice/testStringOperation) testStringOperation
set soapActionArray(https://www.xn--xnx.io/mywebservice/testStringOperation) testStringOperation
set soapActionArray(https://a.ns.highfivediet.com/mywebservice/testitOperation) testitOperation
set soapActionArray(https://highfivediet.com/mywebservice/EchoByteOperation) EchoByteOperation
set soapActionArray(https://home.highfivediet.com/mywebservice/helloOperation) helloOperation
set soapActionArray(https://home.highfivediet.com/mywebservice/helloWorldOperation) helloWorldOperation
set soapActionArray(https://home.highfivediet.com/mywebservice/EchoSymbolOperation) EchoSymbolOperation
set soapActionArray(https://www.highfivediet.com.www.highfivediet.com/mywebservice/AddNumbersOperation) AddNumbersOperation
set soapActionArray(https://home.highfivediet.com/mywebservice/EchoOperation) EchoOperation
set soapActionArray(https://a.ns.highfivediet.com/mywebservice/helloWorldOperation) helloWorldOperation
set soapActionArray(https://a.ns.highfivediet.com/mywebservice/MultiplyNumbersOperation) MultiplyNumbersOperation
set soapActionArray(https://a.ns.highfivediet.com/mywebservice/EchoSymbolOperation) EchoSymbolOperation
set soapActionArray(https://home.highfivediet.com/mywebservice/TestDecimalValueOperation) TestDecimalValueOperation
set soapActionArray(https://www.highfivediet.com.www.highfivediet.com/mywebservice/EchoByteOperation) EchoByteOperation
set soapActionArray(https://www.highfivediet.com.www.highfivediet.com/mywebservice/testitOperation) testitOperation
set soapActionArray(https://a.ns.highfivediet.com/mywebservice/EchoByteOperation) EchoByteOperation
set soapActionArray(https://home.highfivediet.com/mywebservice/EchoCodeOperation) EchoCodeOperation
set soapActionArray(https://www.xn--xnx.io/mywebservice/EchoOperation) EchoOperation
set soapActionArray(https://highfivediet.com/mywebservice/TestDecimalValueOperation) TestDecimalValueOperation
set soapActionArray(https://home.highfivediet.com/mywebservice/AddNumbersOperation) AddNumbersOperation
set soapActionArray(https://highfivediet.com/mywebservice/testitOperation) testitOperation
set soapActionArray(https://www.xn--xnx.io/mywebservice/testitOperation) testitOperation
set soapActionArray(https://www.highfivediet.com.www.highfivediet.com/mywebservice/EchoOperation) EchoOperation
set soapActionArray(https://www.highfivediet.com.www.highfivediet.com/mywebservice/testStringOperation) testStringOperation
set soapActionArray(https://highfivediet.com/mywebservice/EchoCodeOperation) EchoCodeOperation
set soapActionArray(https://a.ns.highfivediet.com/mywebservice/AddNumbersOperation) AddNumbersOperation
variable soapActionMap {https://highfivediet.com/mywebservice/testitOperation testitOperation https://highfivediet.com/mywebservice/EchoSymbolOperation EchoSymbolOperation https://highfivediet.com/mywebservice/EchoCodeOperation EchoCodeOperation https://highfivediet.com/mywebservice/EchoOperation EchoOperation https://highfivediet.com/mywebservice/AddNumbersOperation AddNumbersOperation https://highfivediet.com/mywebservice/MultiplyNumbersOperation MultiplyNumbersOperation https://highfivediet.com/mywebservice/helloOperation helloOperation https://highfivediet.com/mywebservice/helloWorldOperation helloWorldOperation https://highfivediet.com/mywebservice/EchoByteOperation EchoByteOperation https://highfivediet.com/mywebservice/TestDecimalValueOperation TestDecimalValueOperation https://highfivediet.com/mywebservice/testStringOperation testStringOperation}
}
Procedures in ::wsdb::bindings::mywebserviceSoapBind
proc ::wsdb::bindings::mywebserviceSoapBind::HandleRequest {
requestID
} {
variable soapActionArray
variable portTypeName
variable portTypeNamespace
while {1} {
# Response Code Default: Client Error
set code 400
log Debug "HandleRequest Running............."
# 1. Figure out what operation is being performed
set requestNamespace ::request::$requestID
# SOAP Envelope reference
set soapEnvelope "${requestNamespace}::response::Envelope"
# Get requestArgs
foreach {serverName service port binding address} [set ${requestNamespace}::requestArgs] { }
# Get requestHeaders
array set requestHeaders [set ${requestNamespace}::requestHeaders]
# Does SOAPAction Header exist?
if {[info exists requestHeaders(SOAPAction)]} {
set SOAPAction [string trim $requestHeaders(SOAPAction) "\"'"]
if {[info exists soapActionArray($SOAPAction)]} {
set operation $soapActionArray($SOAPAction)
} else {
set operation "SOAPAction Header doesn't correspond to Operation"
log Error "SOAPAction='$SOAPAction' not found in '[array get soapActionArray]'"
log Error "HandleRequest SOAPAction = '$SOAPAction' $operation"
# Should return an error here
set soapFault [::wsdl::bindings::soap::createFault ${requestNamespace}::response]
::wsdl::bindings::soap::appendFaultDetails $soapFault Client "SOAPAction '$SOAPAction' Not Associated with an Operation"
break
}
} else {
set operation "No SOAPAction Header Found..."
set soapFault [::wsdl::bindings::soap::createFault ${requestNamespace}::response]
::wsdl::bindings::soap::appendFaultDetails $soapFault Client "SOAPAction header is missing, no way to identify operation."
break
}
log Debug "HandleRequest operation = $operation"
# Actual tcl namespace of operation
set operationNamespace "::wsdb::operations::${portTypeNamespace}::${operation}"
log Debug "HandleRequest operationNamespace = $operationNamespace"
log Debug "HandleRequest vars in ns: [info vars ${operationNamespace}::*]"
# Do some XML Stuff:
set requestFilename [set ${requestNamespace}::postFilename]
set requestFD [open $requestFilename r]
set requestXML [read $requestFD]
close $requestFD
# to dom doc
dom parse $requestXML requestDoc
$requestDoc documentElement requestRoot
# Info on document:
######### ENVELOPE ###########
foreach nodeInfo {nodeName namespaceURI prefix localName childNodes} {
set envelope($nodeInfo) [$requestRoot $nodeInfo]
log Debug "domNode $nodeInfo (Envelope) = '$envelope($nodeInfo)'"
}
# Check that the namespaceURI is correct
if {"$envelope(namespaceURI)" ne "http://schemas.xmlsoap.org/soap/envelope/"} {
# Need to return error
log Error "HandleRequest: VersionMismatch on SOAP Envelope id:$requestID"
set soapFault [::wsdl::bindings::soap::createFault ${requestNamespace}::response]
::wsdl::bindings::soap::appendFaultDetails $soapFault VersionMismatch {
SOAP Envelope Version Mismatch:
Correct SOAP Version is http://schemas.xmlsoap.org/soap/envelope/}
break
}
# Check Element localname is Envelope
if {"$envelope(localName)" ne "Envelope"} {
# Need to return error
log Error "HandleRequest documentElement not SOAP Envelope for $requestID"
set soapFault [::wsdl::bindings::soap::createFault ${requestNamespace}::response]
::wsdl::bindings::soap::appendFaultDetails $soapFault Client {Root element was not Envelope}
break
}
########### BODY ############
# Check Envelope children
set envelope(childCount) [llength $envelope(childNodes)]
if {"$envelope(childCount)" > 2
|| "$envelope(childCount)" < 1
} {
# Error
log Error "HandleRequest SOAP Envelope $envelope(childCount) children"
set soapFault [::wsdl::bindings::soap::createFault ${requestNamespace}::response]
::wsdl::bindings::soap::appendFaultDetails $soapFault Client "Incorrect number of children
in SOAP Envelope: $envelope(childCount) children"
break
}
# GET body and discard headers
if {"$envelope(childCount)" == 2 } {
# Handle Header//Just skip headers for now
set BodyNode [lindex $envelope(childNodes) 1]
}
if {"$envelope(childCount)" == 1 } {
set BodyNode [lindex $envelope(childNodes) 0]
}
foreach nodeInfo {nodeName namespaceURI prefix localName childNodes} {
set body($nodeInfo) [$BodyNode $nodeInfo]
log Debug "domNode (Body) $nodeInfo = '$body($nodeInfo)'"
}
########### BODY CONTENT ##########
set body(childCount) [llength $body(childNodes)]
if {"$body(childCount)" != 1} {
# Error
log Error "HandleRequest SOAP Body incorrect Child Node Count"
set soapFault [::wsdl::bindings::soap::createFault ${requestNamespace}::response]
::wsdl::bindings::soap::appendFaultDetails $soapFault Client "Incorrect number of children
in SOAP Body: $body(childCount) children"
break
}
set DocumentNode [lindex $body(childNodes) 0]
foreach nodeInfo {nodeName namespaceURI prefix localName} {
set document($nodeInfo) [$DocumentNode $nodeInfo]
log Debug "domNode $nodeInfo (Document) = '$document($nodeInfo)'"
}
# Convert to internal format:
set instanceNS "${requestNamespace}::input"
::xml::instance::newXMLNS $instanceNS [$DocumentNode asList] "1"
set XMLdocumentElementList [namespace children $instanceNS]
if {[llength $XMLdocumentElementList] != 1} {
# Need to return error here
set soapFault [::wsdl::bindings::soap::createFault ${requestNamespace}::response]
::wsdl::bindings::soap::appendFaultDetails $soapFault Client "Incorrect number of children
in documentElement: [llength $XMLdocumentElementList] children, should be 1"
break
} else {
set XMLdocumentElement [lindex $XMLdocumentElementList 0]
}
log Debug "HandleRequest request children: [namespace children $instanceNS]"
log Debug "HandleRequest XML = [::xml::instance::toXMLNS $XMLdocumentElement]"
# tDom doc is gone:
# This may not be necessary:
rename $requestDoc ""
# Check document has correct targetNamespace for service
set targetNamespace [set ::wsdb::servers::${serverName}::targetNamespace]
if {![::xml::instance::checkXMLNS $XMLdocumentElement $targetNamespace]} {
log Error "HandleRequest incorrect request namespace "
set soapFault [::wsdl::bindings::soap::createFault ${requestNamespace}::response]
::wsdl::bindings::soap::appendFaultDetails $soapFault Client "Incorrect targetNamespace
for WSDL service, should be $targetNamespace"
break
} else {
log Debug "HandleRequest correct request namespace '$targetNamespace'"
}
# Check document type is valid
# Document is input message, so we need to find that signature
set inputMessageType [::wsdl::operations::getInputMessageType $portTypeNamespace $operation]
if {"$inputMessageType" eq ""} {
# Return Error Here...
log Error "HandleRequest inputMessageType Not found for $portTypeNamespace $operation"
set soapFault [::wsdl::bindings::soap::createFault ${requestNamespace}::response]
::wsdl::bindings::soap::appendFaultDetails $soapFault Client "inputMessageType Not found for $portTypeNamespace $operation"
break
}
log Debug "HandleRequest: validating messageType '${inputMessageType}'"
log Debug "HandleRequest: validating with '::wsdb::elements::${portTypeNamespace}::${inputMessageType}::validate'"
if {![ValidateInputMessage $operation $XMLdocumentElement]} {
log Error "HandleRequest input document invalid"
# Return Error for fault...How?
set soapFault [::wsdl::bindings::soap::createFault ${requestNamespace}::response]
::wsdl::bindings::soap::appendFaultDetails $soapFault Client "Invalid Document" "[::xml::instance::printErrors $XMLdocumentElement 5]"
break
}
log Debug "HandleRequest: invoking '[set ::wsdb::operations::${portTypeNamespace}::${operation}::invoke]'"
# Document is valid...Invoke command
set responseMessage [InvokeOperation $operation $XMLdocumentElement ${requestNamespace}::output]
# Set default namespace on message
::xml::element::setAttribute "$responseMessage" "xmlns" "$targetNamespace"
# Create response document
set soapBody [::wsdl::bindings::soap::createBody ${requestNamespace}::response ]
# append a reference to responseMessage to SOAP Body
::xml::element::appendRef $soapBody $responseMessage
set code 200
break
}
# Going to return a list {status content-type headersList document}
return [list $code "text/xml" {} [::xml::document::print ${requestNamespace}::response]]
}
proc ::wsdb::bindings::mywebserviceSoapBind::InvokeOperation {
operation
documentElement
outputReference
} {
variable portTypeNamespace
return [[set ::wsdb::operations::${portTypeNamespace}::${operation}::invoke] $documentElement $outputReference]
}
proc ::wsdb::bindings::mywebserviceSoapBind::log {
level
args
} {
variable Method
switch -exact -- $Method {
"puts" {
puts stderr "$level TWS:[join $args " "]"
}
"ns" {
ns_log $level "TWS:[join $args " "]"
}
}
}
proc ::wsdb::bindings::mywebserviceSoapBind::ValidateInputMessage {
operation
documentElement
} {
variable portTypeNamespace
set inputMessageType [::wsdl::operations::getInputMessageType $portTypeNamespace $operation]
return [[set ::wsdb::elements::${portTypeNamespace}::${inputMessageType}::validate] $documentElement]
}