We are currently working on the forum. For the short-term, all forum content will be in read-only format. We apologize for the interruption and look forward to collaborating with you shortly. All the best in your research!

Rule to execute script or call web service?

kevintehkevinteh Posts: 32
edited March 2014 in Developer Mailing List
Dear Openclinica community, This is my first post on this list. I’m a newbie with openclinica. I’ve read that there’s a rule that Emails somebody when an action happens (EmailAction). I am trying to figure out if other actions are allowed? For example to execute local scripts or to call a web service? Thank you in advance for all your help. Kevin Teh
Post edited by bbaumann on
Tagged:

Comments

  • GerbenRienkGerbenRienk Posts: 838 ✭✭✭
    Hi Kevin,
    There are no other options to be executed within OpenClinica. However if
    you're looking for execution of "commands" you could consider adding
    triggers to the database. These would look something like
    IF (TG_OP = 'INSERT' and item_id='I_SOME_OID') THEN etc.
    and the etc. could be execution of commands on the (postgresql-)server and
    these could include calling a web-service.
    In general I think it would be hard to execute anything on the
    client-machine and even if you were successfull in programming something,
    the IT-deptartments of your users will probably not appreciate it.
    What is it exactly you have in mind?
    Kind regards,
    Gerben Rienk
    > > Dear Openclinica community,
    > >
    > > This is my first post on this list. I'm a newbie with openclinica. I've
    > > read that there's a rule that Emails somebody when an action happens
    > > (EmailAction). I am trying to figure out if other actions are allowed? For
    > > example to execute local scripts or to call a web service?
    > >
    > > Thank you in advance for all your help.
    > >
    > > Kevin Teh
    > >
    > >
    > >
  • lindsay.stevenslindsay.stevens Posts: 404 ✭✭✭
    Hi Kevin,
    An option might be to extend the email rule feature by using the receipt of an email as the trigger for something else to happen, like call a webservice.
    For example, I found an msdn article [1] describing how to use VBA in Outlook 2002 to detect a received email, call a webservice for data, and reply with a message containing that data. I imagine you could use the same technique to call anything else on the receipient machine using the windows scripting host object model.
    I think Mirth Connect does this sort of thing too, if you need something cross platform.
    [1] http://msdn.microsoft.com/en-us/library/office/aa140326(v=office.10).aspx
    Best regards,
    Lindsay
    On 10 December 2013 22:55, Gerben Rienk wrote:
    Hi Kevin,
    There are no other options to be executed within OpenClinica. However if
    you're looking for execution of "commands" you could consider adding
    triggers to the database. These would look something like
    IF (TG_OP = 'INSERT' and item_id='I_SOME_OID') THEN etc.
    and the etc. could be execution of commands on the (postgresql-)server and
    these could include calling a web-service.
    In general I think it would be hard to execute anything on the
    client-machine and even if you were successfull in programming something,
    the IT-deptartments of your users will probably not appreciate it.
    What is it exactly you have in mind?
    Kind regards,
    Gerben Rienk
    > Dear Openclinica community,
    >
    > This is my first post on this list. I'm a newbie with openclinica. I've
    > read that there's a rule that Emails somebody when an action happens
    > (EmailAction). I am trying to figure out if other actions are allowed? For
    > example to execute local scripts or to call a web service?
    >
    > Thank you in advance for all your help.
    >
    > Kevin Teh
    >
    >
    >
  • kevintehkevinteh Posts: 32
    Lindsay

    So sorry for the ancient response..I've just seen your response..The old system made me browse through my openclinica emails so quick i missed my own discussion...I'm currrently pursuing using VS2008 c# to call the SOAP based webservice..Still struggling with the headers i'm sending to the java spring based openclinica. Possibly because i'm using XP and VS2008. I'm just curiously wondering if you've managed to connect to openclinica via visual studio? If yes can i cheekily ask how you managed to send the correct headers? Cheers..

    Kevin 
  • GerbenRienkGerbenRienk Posts: 838 ✭✭✭
    Hi Kevin,
    I use for example the following request to get a list of all studies:

    <soapenv:Header>
    <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <wsse:UsernameToken wsu:Id="UsernameToken-27777511" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsse:Username>grvisser</wsse:Username>
    </wsse:UsernameToken>
    </wsse:Security>
    </soapenv:Header>
    <soapenv:Body>
    <v1:listAllRequest>?</v1:listAllRequest>
    </soapenv:Body>
    </soapenv:Envelope>

    And are you already familiar with soapUI? A great tool to header in the correct format.
    Hope this helps,

    Gerben Rienk
  • lindsay.stevenslindsay.stevens Posts: 404 ✭✭✭
    Hi Gerben

    I am finally getting on the webservices bandwagon and came across what seems to be a strange bug in SoapUI (v.4.6.4) and I was wondering if you had seen something similar.

    When I try to use the listAll service using SoapUI, I always get an error response, as copied below. Googling that error message I find solutions involving updating the xalan/xerces libraries and so on.

    However if I submit the same request using your webservices client Access database, the response is as expected (by the way Kevin, if you're reading this, Gerben's wsclient is a good example of how to compose the requests, send them, and deal with the response using VBA).

    Likewise if I submit the same request using soapclient.com/SoapMsg the response is as expected.

    I inspected the request xml for bad encoding stuff but couldn't find anything. My only idea is maybe it has something to do with the webservices being on https and SoapUI not liking that?

    I wasn't going to use SoapUI as the main tool anyway (this is for a Drupal integration) but I thought I'd ask in case it has something to do with the request, or the way the request is composed.

    ***The error response***
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP-ENV:Header/>
       <SOAP-ENV:Body>
          <SOAP-ENV:Fault>
             <faultcode>SOAP-ENV:Server</faultcode>
             <faultstring xml:lang="en">Could not access envelope: Unable to create envelope from given source: ; nested exception is com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:</faultstring>
          </SOAP-ENV:Fault>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    ***The error response***

    Best regards,
    Lindsay
  • lindsay.stevenslindsay.stevens Posts: 404 ✭✭✭
    Here is the anonymised request by the way

    destination: https://{myocinstance-ws}/ws/study/v1/studyWsdl.wsdl

    ***request***
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                      xmlns:v1="http://openclinica.org/ws/study/v1"
                      xmlns:bean="http://openclinica.org/ws/beans">
        <soapenv:Header>
            <wsse:Security soapenv:mustUnderstand="1"
                           xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                <wsse:UsernameToken wsu:Id="UsernameToken-27777511"
                                    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                    <wsse:Username>***soapuser***</wsse:Username>
                    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">***sha1pwd***</wsse:Password>
                </wsse:UsernameToken>
            </wsse:Security>
        </soapenv:Header>
        <soapenv:Body>
            <v1:getMetadataRequest>
                <v1:studyMetadata>
                    <bean:identifier>***uniqueprotocolid***</bean:identifier>
                </v1:studyMetadata>
            </v1:getMetadataRequest>
        </soapenv:Body>
    </soapenv:Envelope>
    ***request***
  • GerbenRienkGerbenRienk Posts: 838 ✭✭✭
    Hi Lindsay,
    I tried http and https and got the same results:
    both listAll and getMetadata work in soapUI 4.6.4 on http, but not on https.
    I guess you're right: it must be a soapUI bug.
    Kind regards,

    Gerben Rienk
  • jacob.rousseaujacob.rousseau Posts: 22 ✭✭
    Hi everybody,

    we've also run into this problem using SOAP-UI 5.0 communicating with OC3.1.4.1 over HTTPS. In the logs the following text is also present:
    'The markup in the document preceding the root element must be well-formed.'. This looks like an issue (with the UTF-BOM) which the Spring-WS framework had. OpenClinica uses a very old version of Spring-WS (1.5.6). It would be nice if OpenClinica upgraded to the current released version of Spring-WS (2.2.0). I'll try to dig into this today.
    regards, Jacob
This discussion has been closed.