Cloverleaf 5.8 to a webservice

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Cloverleaf 5.8 to a webservice

  • Creator
    Topic
  • #52978
    Terry Peterson
    Participant

    I’m a newbie and trying to send a message from my cloverleaf 5.8 to a webservice…anybody have any experience with this?

Viewing 5 reply threads
  • Author
    Replies
    • #76144
      Daniel Lee
      Participant

      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.

    • #76145
      James Cobane
      Participant

      I think Terry is looking for how to make a web service call to a system, rather than connecting via WebSphere MQ.

      Jim Cobane

      Henry Ford Health

    • #76146
      Daniel Lee
      Participant

      Thanks Jim, WebSphere was on my brain since I’d been elbow deep into that.  I guess I was over axious to share what I’d learned with someone else.

    • #76147
      Jim Kosloskey
      Participant

      Dan,

      That is still useful to me.

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

    • #76148
      Terry Peterson
      Participant

      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}

      URl https://xxxxxx.xx.gov/HL7EngineAuthentication/Service.asmx?op=ExecuteHL7Message

      Header {Content-Type:application/x-www-form-urlencoded}

      Message Driven

    • #76149
      Scott Folley
      Participant

      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.

Viewing 5 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,293
Replies
34,435
Topic Tags
286
Empty Topic Tags
10