- Open your ColdFusion9/stubs/ folder.
- Make a call to the webservice using createObject:
someWs = createObject("webservice", "http://addressToWsdlFile/?wsdl"); - Inspect the stubs folder and find the subfolder which is newly created, open it.
- There should be a whole subfolder structure which contains eventually some .class files. Copy the root (normaly this is something like a top level domain: com or net or such)
- Paste the folder structure to folder which is noted as a class path folder, or make a new folder and put this in the ColdFusion administrator (Server Settings > Java and JVM > ColdFusion Class Path) or in your server.cfc class path settings
- Restart ColdFusion (do not forget this!)
- Now you can create one of the objects needed in the webservice using:
someObject = createObject("java", "com.test.testapp.testObj);
(the dot notated path is corresponding with the copied folder structure to the class files) - The objects should have all the getters and setters. (Use writeDump() (or cfdump) to see all the properties of the classes). So use someObject.setSomeValue("xxx"); to populate.
- Call the method with the generated object:
result = someWs.someMethod(someObject); - Done!
Friday, November 2, 2012
Initiating web service objects using class files
If you want to call a webservice which uses more complex arguments then it's easier (or even best practice) to use class files in stead of recreating the objects by yourself. Here is how:
Labels:
Coldfusion,
soap,
web service
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment