Get device or simulator information for SOAP web services

I have a little problem with Codenameone when calling the SOAP web service from the device. As you may know, SOAP web services have their own way of encoding HTTP requests. These coding rules also differ if you use SOAP 1.1 or 1.2.

When I run the simulator, it looks like v1.2, and this requires a certain way of specifying http headers for the service to work.

When you are on the device (here iPhone), it switches to SOAP 1.1 and, thus, the http headers should be encoded differently (soap action, type of content).

So the question is: in my code, how can I determine in which environment the simulator or the real device is running? And although at the same time, if we ever need a specific logic of this kind, based on the nature of the device, how can we do this check?

Thanks in advance for any tips.

+4
source share
1 answer

you can use

 Display.getInstance().getPlatformName() 

to return the name of the platform you are working on.

If it is running on the iPhone, it will return β€œios”. I did a quick test and saw that it also returns β€œios” in the emulator.

Hope this helps

0
source

All Articles