I am following along with some example code from Object-Oriented Actionscript for Flash 8 (pg 465). Example code that works:
Code:
import mx.services.WebService;
import mx.services.PendingCall;
var WS_URL:String = "http://weblogs.macromedia.com/mxna/webservices/mxna2.cfc?wsdl";
var mxna_ws:WebService = new WebService(this.WS_URL);
var categories_pc:PendingCall = this.mxna_ws.getCategories();
this.categories_pc.onResult = function(result_obj:Object):Void {
trace(result_obj);
}
But when I try to use the code above to create and call a Java WebService, the call fails with Error opening URL.
Code:
import mx.services.WebService;
import mx.services.PendingCall;
var WS_URL:String = "http://www.calcxml.com/services/RetirementWS?wsdl";
var ret09Params:String = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><calcxmlRequest xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://www.calcxml.com/schema/calcxmlRequest.xsd\" username=\"guest\" password=\"guest\" responseType=\"both\" version=\"1.1\"><xyChart><chartTitle>Chart Title</chartTitle><threeD>1</threeD><barColor>6D9D6D</barColor><barColor>CD3B3B</barColor><barColor>8C93A5</barColor><chartWidth>400</chartWidth><chartHeight>300</chartHeight></xyChart><dataTable><cssClassName>simpletable</cssClassName></dataTable><calcInput includeInResponse=\"true\"><det03><loanAmount>5000</loanAmount><interestRate>0.05</interestRate><termMonths>60</termMonths><amortization>1</amortization></det03></calcInput></calcxmlRequest>";
var calcXML_ws:WebService = new WebService(this.WS_URL);
var ret09_pc:PendingCall = this.calcXML_ws.ret09(ret09Params);
this.ret09_pc.onResult = function(result_obj:Object):Void {
trace(result_obj);
}
One thing that I've noticed with all other webservice examples, is that the wsdl URL ends with file.ext?wsdl, for cfc?wsdl and aspx?wsdl web service calls. Could it be that Java Web Services and actionscript don't play nice together?
When running the fla file that contains the 2nd example code above, I get the exact error:
Error opening URL "http://www.calcxml.com/services/RetirementWS"
Please note that the error contains a URL similar to the URL passed as the parameter for the wsdl URL, minus the ?wsdl.
Thanks in advance for help.
keywords webservice "web service" "java webservice" "java web service" jsp