namespace delete ::address namespace init ::address namespace schema address "urn:com:semitasker:twist:ws:address:v.1" type simple address::testId xsd::unsignedByte type stringRestrict address::companyName {maxLength 80} type stringRestrict address::addressLineOne {maxLength 80} type stringRestrict address::addressLineTwo {maxLength 80} type stringRestrict address::city {maxLength 80} type enum address::stateCode [lsort {AL CA WA TX MA MS LA NM AZ}] type pattern address::zipPlusFour {[0-9]{5}(-[0-9]{4})?} element sequence address::fromAddress { {addressId!address::testId {minOccurs 1 maxOccurs 1}} {fromCompany!address::companyName {minOccurs 1 maxOccurs 1}} {fromAddress1!address::addressLineOne {minOccurs 1 maxOccurs 1}} {fromAddress2!address::addressLineTwo {minOccurs 0 maxOccurs 1}} {fromCity!address::city {minOccurs 1 maxOccurs 1}} {fromState!address::stateCode {minOccurs 1 maxOccurs 1}} {fromZip!address::zipPlusFour {minOccurs 1 maxOccurs 1}} } element sequence address::toAddress { {addressId!address::testId {minOccurs 1 maxOccurs 1}} {toCompany!address::companyName {minOccurs 1 maxOccurs 1}} {toAddress1!address::addressLineOne {minOccurs 1 maxOccurs 1}} {toAddress2!address::addressLineTwo {minOccurs 0 maxOccurs 1}} {toCity!address::city {minOccurs 1 maxOccurs 1}} {toState!address::stateCode {minOccurs 1 maxOccurs 1}} {toZip!address::zipPlusFour {minOccurs 1 maxOccurs 1}} } element sequence address::fromToEnvelope { {envelopeId!address::testId } {fromAddr!elements::address::fromAddress {form List}} {toAddr!elements::address::toAddress {form List}} } proc address::sendMail { {From!elements::address::fromToEnvelope } } { return $From } returns { fromToEnvelope } proc address::sendMail2 { {envelopeId!address::testId {minOccurs 1 default 125}} {fromAddress!elements::address::fromAddress {form Element minOccurs 1 default {{1} {x} {y} {z} {a} {WA} {98198}}}} {toAddress!elements::address::toAddress {form List minOccurs 1 default {{2} {a} {b} {c} {x} {WA} {98198-5115}}}} } { log Notice "$envelopeId='$envelopeId', fromAddress='$fromAddress', toAddress='$toAddress'" return [list $envelopeId $fromAddress $toAddress] } returns { {envelopeId!address::testId } {fromAddrress!elements::address::fromAddress {form List}} {toAddrress!elements::address::toAddress {form List}} } proc address::EchoAddress { fromAddress } { set vars [info vars] set result [list] ns_log Notice "vars='[info vars]'" foreach var $vars { lappend result [set $var] } return $result } returns { fromAddress } namespace finalize ::address return ::address