I’ve recently done this. Attached is a document I’ve put together to help me and other analysts set up WebSphere interfaces. Let me know if you have any questions.
Thanks anyway Dan…Thanks James…yes thats correct web service call to a system. Not sure how to configure the HTTP Client Protocol for doing a post….do I use httpQuery {MSGUSE DATA} or httpQueryCurl {MSGUSE DATA}
I am not going to pretend that I know how to configure the http client protocol for this (and since it is curl internally this may help you with that also) but I have done it with tclCurl in a proc:
Code:
set filename $args
package require TclCurl
package require base64
echo filename:$filename
set outputDir [ file dirname $filename ]
set url “http://10.180.10.130/pdf/pdf.php”
set typ “multipart/form-data”
set ch [ curl::init ]
$ch configure -verbose 1
$ch configure -post 1
$ch configure -timeout 60
$ch configure -url $url -httpheader [ list “Content-Type: $typ” ]
$ch configure -httppost [ list name “f” file “$filename” contenttype “text/plain” ]
$ch configure -httppost [ list name “submit” contents “Submit Query” ]
$ch configure -bodyvar xmlData
catch { $ch perform } returnCode
if { $returnCode == 28 } {
error “Connection timed out waiting for server”
}
#Format of error:Error: File invalid.
$ch cleanup
#echo “XMLDATA:$xmlData”
set returnData “”
if { $xmlData eq “” } {
error “The return value was blank”
}
regexp (.*) $xmlData wasteVar returnData
if { $returnData eq “” } {
error “Data returned was $xmlData and it is not in the right format”
} else {
regexp (.*) $returnData wasteVar newFilename
regexp (.*) $returnData wasteVar newPDFData
}
set startText [ string range $newFilename 0 4 ]
if { $startText eq “Error” } {
error “Webservice could not process file!”
} else {
set fullName [ file tail $newFilename ]
set extension [ file extension $fullName ]
set rootName [ file rootname $fullName ]
set outputFilename “$rootName$extension”
set decodedPDF [ base64::decode $newPDFData ]
set fh [ open $outputDir/$outputFilename w ]
fconfigure $fh -encoding binary
puts -nonewline $fh $decodedPDF
close $fh
}
What this code is doing is sending a PDF to a webservice that is then modifying the PDF and sending it back to me within an XML message. That is, obviously, not exactly what you are doing but it should give you a good basis to work from. If this doesn’t quite do it for you let me know and I have a few other samples that might help, it is really going to come down to tweaking those httppost arguments.
Author
Replies
Viewing 5 reply threads
The forum ‘Cloverleaf’ is closed to new topics and replies.