Alex,
In flex, it goes through the first case in if statement, not the second
one : (The flex version send body method is attached)
The parameters variable comes as string to the method. Current sendBody
assumes that the "parameters" is always XML. But if we check if it is as
string than the enters the first case. (emulation of sendBody is attached)
if (parameters is String && xmlEncode == null)
{
paramsToSend = parameters as String;
} else {
paramsToSend = parameters.toXMLString();
}
Thanks,
Serkan
16.03.2019 09:40 tarihinde Alex Harui yazdı:
Hi Serkan,
That doesn’t make sense to me. Is the same code (before your proposed
changes) in the Flex version of AbstractOperation? If so, then how
does parameters.toXMLString() not throw an exception in Flex?
-Alex
*From: *Serkan Taş <serkan....@likyateknoloji.com>
*Reply-To: *"users@royale.apache.org" <users@royale.apache.org>
*Date: *Friday, March 15, 2019 at 11:28 PM
*To: *"users@royale.apache.org" <users@royale.apache.org>
*Subject: *Re: Work on Emulation
Hi Alex,
I checked the flow in debug and can say that there is no conversion
for XML, it is just string and I guess we have to check it and than
use it as string.
If change the AbstractOperation.sendBody as below :
if (ctype == CONTENT_TYPE_XML)
{
if (parameters is String && xmlEncode == null)
{
paramsToSend = parameters as String;
} else {
paramsToSend = parameters.toXMLString();
}
then in js debug :
cid:part1.DBF1439D.1E2291C8@likyateknoloji.com
can see that is passes.
Thanks,
Serkan
15.03.2019 06:55 tarihinde Alex Harui yazdı:
If the Flex version works and in the Flex version a string is
being passed into authAndCall yet in Operation it is XML, we need
to understand where Flex code or the Flash runtime converted the
string back to XML. So you might need to check again more
carefully at the Flex version.
Then we will know where we might want to put similar conversion code.
Thanks,
-Alex
*From: *Serkan Taş <serkan....@likyateknoloji.com>
<mailto:serkan....@likyateknoloji.com>
*Reply-To: *"users@royale.apache.org"
<mailto:users@royale.apache.org> <users@royale.apache.org>
<mailto:users@royale.apache.org>
*Date: *Thursday, March 14, 2019 at 1:55 PM
*To: *"users@royale.apache.org" <mailto:users@royale.apache.org>
<users@royale.apache.org> <mailto:users@royale.apache.org>
*Subject: *Re: Work on Emulation
Alex, I already debugged the flex code and then sent the code pieces.
Although autheandcall method has parameter as string, the method
loginresulthandler create and xml and passes the xml string as
parameter.
Ant the flex version works as expected.
Tomorrow I will send you the orginal flex debug results of
abstractoperation.sendbody method call.
Note: I ll take care of event casting issue later.
Thanx
Serkan
Android için Outlook
<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Faka.ms%2Fghei36&data=02%7C01%7Caharui%40adobe.com%7C2551ebc4ca5843a0b61508d6a9d888e3%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636883144810310442&sdata=FHyKbvy2JBZTNfrnWTMoCMRFxtqG6%2BYU9weVIXJxeAQ%3D&reserved=0>'u
edinin
On Thu, Mar 14, 2019 at 11:46 PM +0300, "Alex Harui"
<aha...@adobe.com <mailto:aha...@adobe.com>> wrote:
Hi Serkan,
In the code you posted, it looks like “authAndCall” has a
“parameter” that is a String. It is not obvious to me how
parameter could be XML. I suggest that debug into that first
before changing any emulation code.
Also, you may have to pay close attention to code like
XML(event.target.data).result. That converts
event.target.data to XML (I hope), but what you get from the
“result” property may not be XML or XMLList as it might be in
Flash so there might need to be another cast or coercion.
Again, debugging into it and comparing against the Flash
version may help.
HTH,
-Alex
public function sendBody(parameters:Object):AsyncToken
{
var filter:SerializationFilter =
getSerializationFilter();
var paramsToSend:Object;
var token:AsyncToken;
var fault:Fault;
var faultEvent:FaultEvent;
var msg:String;
//concurrency check
if (Concurrency.SINGLE == concurrency &&
activeCalls.hasActiveCalls())
{
token = new AsyncToken(null);
var m:String = resourceManager.getString(
"rpc", "pendingCallExists");
fault = new Fault("ConcurrencyError", m);
faultEvent = FaultEvent.createEvent(fault,
token);
new AsyncDispatcher(dispatchRpcEvent,
[faultEvent], 10);
return token;
}
var ctype:String = contentType;
var urlToUse:String = url;
if (urlToUse && urlToUse != '')
{
urlToUse = URLUtil.getFullURL(rootURL,
urlToUse);
}
if (filter != null)
{
// TODO: does this need to run on the array
version of the parameters
ctype = filter.getRequestContentType(this,
parameters, ctype);
urlToUse = filter.serializeURL(this,
parameters, urlToUse);
parameters = filter.serializeBody(this,
parameters);
}
if (ctype == CONTENT_TYPE_XML)
{
paramsToSend = parameters.toXMLString();
/*if (parameters is String && xmlEncode == null)
{
paramsToSend = parameters as String;
}
else if (!(parameters is XMLNode) &&
!(parameters is XML))
{
if (xmlEncode != null)
{
var funcEncoded:Object = xmlEncode(parameters);
if (null == funcEncoded)
{
token = new AsyncToken(null);
msg = resourceManager.getString(
"rpc", "xmlEncodeReturnNull");
fault = new Fault(ERROR_ENCODING, msg);
faultEvent = FaultEvent.createEvent(fault,
token);
new AsyncDispatcher(dispatchRpcEvent,
[faultEvent], 10);
return token;
}
else if (!(funcEncoded is XMLNode))
{
token = new AsyncToken(null);
msg = resourceManager.getString(
"rpc", "xmlEncodeReturnNoXMLNode");
fault = new Fault(ERROR_ENCODING, msg);
faultEvent = FaultEvent.createEvent(fault,
token);
new AsyncDispatcher(dispatchRpcEvent,
[faultEvent], 10);
return token;
}
else
{
paramsToSend = XMLNode(funcEncoded).toString();
}
}
else
{
var encoder:SimpleXMLEncoder = new
SimpleXMLEncoder(null);
var xmlDoc:XMLDocument = new XMLDocument();
//right now there is a wasted <encoded> wrapper
tag
//call.appendChild(encoder.encodeValue(parameters));
var childNodes:Array =
encoder.encodeValue(parameters, new QName(null, "encoded"), new XMLNode(1,
"top")).childNodes.concat();
for (var i:int = 0; i < childNodes.length; ++i)
xmlDoc.appendChild(childNodes[i]);
paramsToSend = xmlDoc.toString();
}
}
else
{
paramsToSend = XML(parameters).toXMLString();
}*/
}
else if (ctype == CONTENT_TYPE_FORM)
{
paramsToSend = {};
var val:Object;
if (typeof(parameters) == "object")
{
//get all dynamic and all concrete
properties from the parameters object
var classinfo:Object =
ObjectUtil.getClassInfo(parameters);
for each (var p:* in
classinfo.properties)
{
val = parameters[p];
if (val != null)
{
if (val is Array)
paramsToSend[p]
= val;
else
paramsToSend[p]
= val.toString();
}
}
}
else
{
paramsToSend = parameters;
}
}
else
{
paramsToSend = parameters;
}
var message:HTTPRequestMessage = new
HTTPRequestMessage();
if (useProxy)
{
if (urlToUse && urlToUse != '')
{
message.url = urlToUse;
}
if (NetworkMonitor.isMonitoring())
{
//trace(" HTTPService: Recording
Headers (useProxy = true)");
message.recordHeaders = true;
}
}
else
{
if (!urlToUse)
{
token = new AsyncToken(null);
msg = resourceManager.getString("rpc",
"urlNotSpecified");
fault = new Fault(ERROR_URL_REQUIRED,
msg);
faultEvent =
FaultEvent.createEvent(fault, token);
new AsyncDispatcher(dispatchRpcEvent,
[faultEvent], 10);
return token;
}
if (!useProxy)
{
var dcs:ChannelSet =
getDirectChannelSet();
if (dcs != asyncRequest.channelSet)
asyncRequest.channelSet = dcs;
}
if (NetworkMonitor.isMonitoring())
{
//trace(" HTTPService: Recording
Headers (useProxy = false)");
message.recordHeaders = true;
}
message.url = urlToUse;
}
message.contentType = ctype;
message.method = method.toUpperCase();
if (ctype == CONTENT_TYPE_XML && message.method ==
HTTPRequestMessage.GET_METHOD)
message.method = HTTPRequestMessage.POST_METHOD;
message.body = paramsToSend;
message.httpHeaders = getHeaders();
return invoke(message);
}
public function sendBody(parameters:Object):AsyncToken
{
var filter:SerializationFilter = getSerializationFilter();
var paramsToSend:Object;
var token:AsyncToken;
var fault:Fault;
var faultEvent:FaultEvent;
var msg:String;
//concurrency check
if (Concurrency.SINGLE == concurrency && activeCalls.hasActiveCalls())
{
token = new AsyncToken(null);
var m:String = resourceManager.getString(
"rpc", "pendingCallExists");
fault = new Fault("ConcurrencyError", m);
faultEvent = FaultEvent.createEvent(fault, token);
new AsyncDispatcher(dispatchRpcEvent, [faultEvent], 10);
return token;
}
var ctype:String = contentType;
var urlToUse:String = url;
if (urlToUse && urlToUse != '')
{
urlToUse = URLUtil.getFullURL(rootURL, urlToUse);
}
if (filter != null)
{
// TODO: does this need to run on the array version of the
parameters
ctype = filter.getRequestContentType(this, parameters, ctype);
urlToUse = filter.serializeURL(this, parameters, urlToUse);
parameters = filter.serializeBody(this, parameters);
}
if (ctype == CONTENT_TYPE_XML)
{
if (parameters is String && xmlEncode == null)
{
paramsToSend = parameters as String;
}
else if (!(parameters is XMLNode) && !(parameters is XML))
{
if (xmlEncode != null)
{
var funcEncoded:Object = xmlEncode(parameters);
if (null == funcEncoded)
{
token = new AsyncToken(null);
msg = resourceManager.getString(
"rpc", "xmlEncodeReturnNull");
fault = new Fault(ERROR_ENCODING, msg);
faultEvent = FaultEvent.createEvent(fault, token);
new AsyncDispatcher(dispatchRpcEvent, [faultEvent], 10);
return token;
}
else if (!(funcEncoded is XMLNode))
{
token = new AsyncToken(null);
msg = resourceManager.getString(
"rpc", "xmlEncodeReturnNoXMLNode");
fault = new Fault(ERROR_ENCODING, msg);
faultEvent = FaultEvent.createEvent(fault, token);
new AsyncDispatcher(dispatchRpcEvent, [faultEvent], 10);
return token;
}
else
{
paramsToSend = XMLNode(funcEncoded).toString();
}
}
else
{
var encoder:SimpleXMLEncoder = new SimpleXMLEncoder(null);
var xmlDoc:XMLDocument = new XMLDocument();
//right now there is a wasted <encoded> wrapper tag
//call.appendChild(encoder.encodeValue(parameters));
var childNodes:Array = encoder.encodeValue(parameters, new
QName(null, "encoded"), new XMLNode(1, "top")).childNodes.concat();
for (var i:int = 0; i < childNodes.length; ++i)
xmlDoc.appendChild(childNodes[i]);
paramsToSend = xmlDoc.toString();
}
}
else
{
paramsToSend = XML(parameters).toXMLString();
}
}
else if (ctype == CONTENT_TYPE_FORM)
{
paramsToSend = {};
var val:Object;
if (typeof(parameters) == "object")
{
//get all dynamic and all concrete properties from the
parameters object
var classinfo:Object = ObjectUtil.getClassInfo(parameters);
for each (var p:* in classinfo.properties)
{
val = parameters[p];
if (val != null)
{
if (val is Array)
paramsToSend[p] = val;
else
paramsToSend[p] = val.toString();
}
}
}
else
{
paramsToSend = parameters;
}
}
else
{
paramsToSend = parameters;
}
var message:HTTPRequestMessage = new HTTPRequestMessage();
if (useProxy)
{
if (urlToUse && urlToUse != '')
{
message.url = urlToUse;
}
if (NetworkMonitor.isMonitoring())
{
//trace(" HTTPService: Recording Headers (useProxy = true)");
message.recordHeaders = true;
}
}
else
{
if (!urlToUse)
{
token = new AsyncToken(null);
msg = resourceManager.getString("rpc", "urlNotSpecified");
fault = new Fault(ERROR_URL_REQUIRED, msg);
faultEvent = FaultEvent.createEvent(fault, token);
new AsyncDispatcher(dispatchRpcEvent, [faultEvent], 10);
return token;
}
if (!useProxy)
{
var dcs:ChannelSet = getDirectChannelSet();
if (dcs != asyncRequest.channelSet)
asyncRequest.channelSet = dcs;
}
if (NetworkMonitor.isMonitoring())
{
//trace(" HTTPService: Recording Headers (useProxy = false)");
message.recordHeaders = true;
}
message.url = urlToUse;
}
message.contentType = ctype;
message.method = method.toUpperCase();
if (ctype == CONTENT_TYPE_XML && message.method ==
HTTPRequestMessage.GET_METHOD)
message.method = HTTPRequestMessage.POST_METHOD;
message.body = paramsToSend;
message.httpHeaders = getHeaders();
return invoke(message);
}