Is it possible within ColdFusion 9 to make synchronous SOAP calls? The specific API I'm interested in is published by 开发者_如何学CeCircle, and they have an example using PHP here
http://developer.ecircle-ag.com/apiwiki/wiki/SynchronousSoapAPI#section-SynchronousSoapAPI-PHPSample
Can the same thing be achieved with ColdFusion?
A quick port from http://developer.ecircle-ag.com/apiwiki/wiki/SynchronousSoapAPI#section-SynchronousSoapAPI-PHPSample to CFScript
...
client = createObject('webservice','http://webservices.ecircle-ag.com/soap/ecm.wsdl');
...
// ask for the api version
result = client.getVersion();
// check if there was an error calling the API function?
// exception will be thrown I guess...
...
writeOutput("The Version Number is :<pre>#result.getVersionReturn#</pre>";
...
// logon
result = client.logon(FORM.realm, FORM.username, FORM.passwd);
// get session id
sessionid = result.logonReturn;
.....
// font forget to log out later !
reference: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-78b4.html
Calling webservices is synchronous.
Do you mean asynchronous calls? The rest of my answer is based on this assumption.
At this time, no. To support that you would need to specify a particular CFC / function to handle the web service response - when it responds - on a different thread. Maybe soon however, if CF support of closures arrives (and it is speculated to be coming).
ColdFusion has support for SOAP web services built in - lots of resources out there on the web.
You can also investigate using an event gateway for asynchronous processing, or indeed you could ask the SOAP provider to accept your request and then send the response in a separate request to another web service you define for them. That would give the illusion of an asynchronous call but in fact you are just firing a response off and then waiting for the response somewhere else. It's not ideal at all TBH as it means you have to match up requests and responses which can get messy.
Hope that helps.
精彩评论