Hi everybody,
I want to make a sideband soap call, and I have it working up to the point where I am crafting the content to be sent to a web server. The data size is variable, so I am looking for a good way to insert the variable data and calculate the Content-Length for this POST.
Any tricks you can point me to ?
TIA
Hello,
Here you can find a peace of irule codesource :
if {[catch {connect -timeout 1000 -idle 30 -status conn_status VS_SOAP_CALL} conn_id] == 0 && $conn_id ne ""}{
log local0. "Connect returns: $conn_id and conn status: $conn_status"
} else {
log local0. "Connection could not be established to sideband_virtual_server"
}
set appid 1
set key [HTTP::header value MyID]
set content [subst -nocommands -nobackslashes [ifile get soap_body]]
set length [string length $content]
set data "POST /WebServices/service.asmx HTTP/1.1\r\nContent-Type: text/xml; charset=utf-8\r\nContent-Length: $length\r\nSOAPAction: http://mysoapaction/soap\r\n\r\n$content"
set send_bytes [send -timeout 1000 -status send_status $conn_id $data]
log local0. "Sent $send_bytes with status $send_status"
set recv_data [recv -timeout 1000 $conn_id]
log local0. "([string length $recv_data]): $recv_data"
My SOAP Body is imported within an ifile. Within the SOAP body, I inserted $appid and $key where needed.
By doing the following command
set content [subst -nocommands -nobackslashes [ifile get soap_body]]
$appid and $key will be automatically replaced by the variable values within the content variable
and finally, I calculated the length with the following command
set length [string length $content]
and now you just have to build your entire request before sending
Thanks for the reply Yann, I didnt’ want to hit the OS - so I was able to substitute the variables in using Mark Seecof’s HTTP Super SIDEBAND Requestor!
With this HTTP client - I can just pass in the variables and methods I need to. Much thanks to Mark for his post.
The HTTP Super SIDEBAND Requestor has been updated (a lot) and now handles 100-Continue as well.