Consume Web Service on Client Script

Is it possible, and if so how, to consume a web service from a client operation MBPM form button?

The connection is defined within the solution, or an associated library, but I am not sure how to consume it client side.  (I suspect client side cannot consume the information in the solution/server side, but I may be wrong.)

 

The service itself it outside our MBPM environment.  I have been able to consume the service on the server side for its processing using the connections.  However, I'd like/need to call another component of the service client side.  (In this case it downloads a bytestream which I use to create a file (when server side) ... which in turn would display to the user, if the user has access to said file.)

 

In theory, I could dump the file server side, but then I'd have to (a) create the destination directory as a web site, which I'd rather not do, then (b) open the file client side as we do via a out dated process in our v7 enviroment.

Tagged:

Comments

  • It depends on your web service.

     

    If you are using WCF you will have to annotate your services interface with a WebInvoke property which will allow you to call it from a POST such as $jQuery.post({ }) or using pure js and creating an XMLHttpRequest using .open.

     

    You also have to add an endpoint to your app.config in the service with a restBehaviour attribute.

     

    Once that is setup make your request as you would any web service client side while pointing the { url: newEndpoint }.

     

    If you are using Web API or any other form of a RESTful interface you can skip the additional steps and just make the clientside call mentioned above like you would from any other client application.

     

    You will have to capture the JSON/XML into some object then pass them through Metastorm's clientside functions.

    As far as step-by-step instructions, I haven't done this in Metastorm so you'll have to explore that yourself.

     

    ...aaron