In each case i post java code and my try on cocoa code(not working)
How to setup a proxy service?
{$IFDEF JAVA}
fDataService := new NewLibrary.DataService_Proxy(java.net.URI.&create(adapter_serverUrl));
//(fDataService.ProxyMessage as BinMessage).UseCompression := true;
(fDataService.ProxyClientChannel as HttpClientChannel).Timeout := 5000;
(fDataService.ProxyMessage as BinMessage).Envelopes.put('AES', aesEnvelope);
fDataService.ProxyClientChannel.ChannelCallback := new interface ClientChannel.IClientChannelCallback(
clientChannelNeedsLogin := method(anException: Exception)
begin
System.out.println("SessionNotFoundException was thrown");
exit true;
end,
requestFailWithException := method(anException: Exception)
begin
//Connected := False;
doMessageShow('DataService requestFailWithException ' + anException.Message, false);
System.out.println(anException.Message);
end
);
{$ELSE}
// ver si puedo usar directamente el adapter con cast
fDataService := new NewLibrary.DataService_Proxy(adapter_serverUrl);
{$ENDIF}
trying to get datatables in a call
var tableNames := new NSMutableArray<String>;
tableNames.addObject(nme_tipoactividad);
tableNames.addObject(nme_locaciones);
//tableNames.addObject(nme_bitacora_entidad);
var tables := DataAdapter.getDataTables(tableNames);
get this message
Error dispatching message: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
building a where condition
{$IFDEF JAVA}
var lCondition :BinaryExpression :=
new BinaryExpression(
new BinaryExpression(
new BinaryExpression(
new FieldExpression(fld_empresas_empresaglobalkey),
new ConstantExpression(fDataAccess.adapter_loginCompany),
BinaryOperator.Equal),
new BinaryExpression(
new FieldExpression(fld_personas_usuario),
new ConstantExpression(fDataAccess.adapter_loginName),
BinaryOperator.Equal),
BinaryOperator.And),
new BinaryExpression(
new FieldExpression(fld_hardware_device_serie_imei),
new ConstantExpression(fDataAccess.adapter_loginIMEI),
BinaryOperator.Equal),
BinaryOperator.And);
{$ENDIF}
Thanks for your help, but i dont undesrtand. Seems like the conenction is made in an insecure form. Is not related to remobejcts channel? I build an IOS client, using Delphi + DA, IOS 10 and never see that message, over the same server. Then i think some is misconfigurated on Fire? Sorry, i think i need a more deeper information here about how to configure my remobjects channel.
Best regards.
P.S. Please if can ask the other stuff?
Ih you are using Url like http://... (not https://...) then the connection is not secure by definition.
If in this case Delphi-built app doesnât warn you then ( IMHO ) this is actually a security flaw and a kind of violation of Apple requirements (ones that require all apps to use https for connections). Most probably Delphi app just have the override option enabled by default.
Apple require all communication to go via TSL1.2 or later. You must switch your server to use https:. As a workaround you can add this to your Info.plist file, but you may nit be able to submit the app to the store with that, in there future:
FWIW, the same would apply to a Delphi app, but itâd not be shocked to hear that Delphi just adds the above to your Plist automatically (which would be really, really bad, butâŚ)
But that means Delphi most likely did add that setting for you secretly. The mind boggles. But then, DataSnap also opens a pass-thru connection to your database to the client, and they call out âsecure multi-tierâ, so what do i expectâŚ
Did you lokk at the c:\Users\Public\Documents\RemObjects Samples\RemObjects SDK for Java folder?
âc:\Users\Public\Documents\RemObjects Samples\RemObjects SDK for Java\Oxygene\HTTP Chat\Program.pasâ
F.e. the file c:\Users\Public\Documents\RemObjects Samples\RemObjects SDK for Java\Oxygene\Mega Demo\UserInterface.pas:
method DemoWindow.initDemoProxy;
begin
var lProtocol: String := protocolBox.SelectedItem as String;
var lHost: String := hostField.Text as String;
var lPort: String := portSpinner.Text as String;
var lMessageType: String := '/';
if binaryRbtn.isSelected then
lMessageType := '/bin';
var lURI := new URI(lProtocol + '://' + lHost + ':' + lPort + lMessageType);
MegaDemoService := new MegaDemoService_Proxy(lURI);
if useCompession.isSelected then
(MegaDemoService.ProxyMessage as BinMessage).UseCompression := true
else
(MegaDemoService.ProxyMessage as BinMessage).UseCompression := false;
(MegaDemoService.ProxyClientChannel as HttpClientChannel).Timeout := 1000;
end;
Similar code in the MegaDemo Android sample:
var lURI := new URI("http://10.0.2.2:8099/bin");
fService := new MegaDemoService_Proxy(lURI);
(fService.ProxyMessage as BinMessage).UseCompression := true;
(fService.ProxyClientChannel as HttpClientChannel).Timeout := 1000;
There is a good reason why the syntax differs:
The code you write is compiled directly into platform-native code, without a massive overhead of some runtime library that hides platform-specific stuff.
From one side, it requires you to write more code, from other it gives beter performance more native apps. Also it allows to use platform-specific tutorials to do the things needed (f.e. you want ot use https with self-signed certificate on Android and just found some code on StackOverflow. You can oxidize that code and it will work fo you in your app)
I have to disagree. That forces to wrote all the code two or tree times to do the same. In any case, as i talk with marc, will be better if you offer a common wrapper and let the use to decide if use native code or the common wrappers, and not force to write a lot of code. is a manintenance nigthmare, despite the aditional time to get it working.
As i explained before, DA/.NET and DA/Cocoa were written LONG before there was Elements support for Java and Cocoa. They were design dot fit in well with each respective platform because there WAS no way to share code anyways (Android apps would have been in Java, Cocoa apps in Objective-C).
We ARE looking into a better approach in the future, but for now, thats what it is.