Service oriented

Written on 8 April 2016, 05:19pm

Tagged with: ,

Web Service: exposing functionality/information from one system to another system. “A web service differs from a web site in that a web service provides information consumable by software rather than humans.

WSDL (Web Services Description Language) is an XML document describing a web service.

SOAP (Simple Object Access Protocol) is an XML-based protocol that allows the exchange of information between applications over another protocol (HTTP).

API (Application Programming Interface) represents set of rules, a contract between 2 software programs.

REST (Representational State Transfer) is a set of design principles for network communication. Constraints for the network:
– client-server
– stateless
– unique representation of resources (URI)
– manipulation of resources through representations (not by commands, for instance)

https://codewords.recurse.com/issues/five/what-restful-actually-means

Coldfusion: cfinvoke timeout

Written on 19 March 2012, 03:57pm

Tagged with: , ,

Consider the following scenario: you make a cfinvoke to a remote web service, that takes a long time to execute. In the same, you want to be in control of your script, and present a timeout error message. The natural thing to do in this case is to use cfsetting requestTimeout.
Or, you can use the cfinvoke’s timeout attribute, as in the example below.

I created a ColdFusion component, to be used a web service: sleeping.cfc. This component has only one method – sleepit – that simulates a long process. In our case, it sleeps for 5 seconds.
The client – call_sleeping.cfm – is using the cfinvoke tag to call the sleepit() method, but it will only wait for 2 seconds (timeout=2). The error received after 2 seconds will be:

Could not perform web service invocation “sleepit”.

The code below. (more…)

Refresh ColdFusion web services

Written on 16 March 2012, 03:44pm

Tagged with: , ,

ColdFusion caches the WSDL. In order to flush this cache, you have the following options:

  1. ColdFusion administrator
  2. Programatically:
    In ColdFusion 8, you have two options:

    1. Cfinvoke’s refreshWSDL attribute:
      <cfinvoke webservice="#wsdl#" method="method"
              returnvariable="rv" refreshWSDL="yes">
              <cfinvokeargument name="arg" value="1"/>
      </cfinvoke>
            
    2. Cfobject’s arguments structure
      <cfscript>
            wsargs = structnew();
            wsargs.refreshwsdl="yes";
            somevar = createobject("webservice",
      "http://[server]/[webserviceurl]",wsargs);
            ...
      </cfscript>

    In ColdFusion 7, however, you can use the following solution:

    <cfset wsAddress = "http://your.web/service/url.cfc?wsdl">
    <!--- CF7 --->
    <cfset createObject("java", "coldfusion.server.ServiceFactory").
    XmlRpcService.refreshWebService(wsAddress) /> 
    

Read more

  1. CF8 Hidden Gem: Refreshing Web Service WSDL and CF proxy/stub with new RefreshWSDL option
  2. CF8 Hidden Gem: New ArgStruct argument for createObject with web services
  3. Flushing a cached web service (see also first comment)
  4. Refreshing Cached ColdFusion Webservices Through the Back Door (ignore the Comic Sans typeface)