PDA

View Full Version : HowTo: Tracing WebService Calls


GDP_Sabrina
11-13-2003, 10:53 PM
Hi,

drag'n drop the WebServicesClasses and dataBindingClasses (Windows->other panel->classes) onto the stage before.

Then:import mx.services.*;
//_global.__dataLogger=new mx.data.binding.Log();
myWebService = new WebService("http://www.flash-db.com/services/ws/companyInfo.wsdl");
var myPendingCallObj = myWebService.doCompanyInfo("any","any","macr");
myPendingCallObj.onResult = function(result){
// be patient; SOAP request and response are available with
// the onResult-method
trace("SOAP-Return: "+ result.symbol);
trace("_________________________________");
trace("SOAP-Request: "+ myPendingCallObj.request);
trace("_________________________________");
trace("SOAP-Reponse: "+ myPendingCallObj.response);
};Enjoy.

Ciao for now
sabrina

GDP_Sabrina
11-13-2003, 11:24 PM
Here is an extended version showing the WSDL after retrieving it from the server.
import mx.services.*;

// load WSDL into memory
myWebService = new WebService("http://www.flash-db.com/services/ws/companyInfo.wsdl");

//put "onLoad" method directly after WSDL retrieving
// parse WSDL
myWebService.onLoad = function(wsdlDocument) {
trace("WS-Call: "+ this.getCall("doCompanyInfo"));
trace("_________________________________");
trace("WSDL-Document: "+ wsdlDocument);
}

var myPendingCallObj:PendingCall = myWebService.doCompanyInfo("any","any","macr");
myPendingCallObj.onResult = function(result){
// be patient; SOAP request and response are available with
// the onResult-method
trace("SOAP-Return: "+ result.symbol);
trace("_________________________________");
trace("SOAP-Request: "+ this.request);
trace("_________________________________");
trace("SOAP-Reponse: "+ this.response);
trace("_________________________________");
trace("SOAP-Values: "+ this.myCall);
};
Ciao for now
Sabrina