How to call a .NET web service from Blackberry Simulator? - web-services

I have to call a .NET web service (http://192.168.1.14/CG/authentication.asmx) from the Blackberry Simulator. Already i have done it in Android with KSOAP2, but i have no idea about how to do this in Blackberry. Can i use KSOAP2 in Blackberry? If i can please give some code snippets. Also please tell if you know any other ways to do this.

I've not used KSOAP2 before but I know that you can use it for Blackberry.
To call web services I use the Sun Java Wireless Toolkit (WTK) to generate stubs from your webservice's WSDL file, which should probably be http://192.168.1.14/ CG/authentication.asmx?wsdl for you.
You can then import the files that the WTK generates into your project to call your web methods using something along the lines of:
//Generated stub file
Service1Soap_Stub stub = new Service1Soap_Stub();
//Web service method
result = stub.methodName(param1, param2);

Alternatively you can use SAX and the standard J2ME libs.
The following link is a good tutorial on how to accomplish this:
http://www.simplified-tech.com/website/webapp.nsf/webpages/ArticlesBBWebServices

You can look at WSClient++ which generates code that is free from reflection and ideal for mobile platforms.

Related

React native Wifi list

Is there a way to scan and all get Wifi list using react native for Android and iOS. I have seen a few libraries but mostly for android and even those doesnt work properly. Any suggestions?
If I need to write Native Modules can you point me to right direction. Never wrote a native module for React Native before.
https://www.npmjs.com/package/react-native-wifi-reborn
Has method loadWifiList() gives Promise<Array<WifiEntry>>
Also you want to forcefully rescan :
method reScanAndLoadWifiList() gives Promise<Array<string>>
react-native-wifi:
https://github.com/blackdeve/react-native-wifi
You can read docs about Native Modules under Guide section. Here are quick links
Native Modules - Android
Native Modules - iOS
Here is react-native-create-library, it will help you to create a React Native library with a single command.
Another blog on Medium about How to use Native Modules in React Native + Android - Hybrid Apps.
You can use react-native-wifi-reborn (https://github.com/JuanSeBestia/react-native-wifi-reborn) but there is no way to create a wifi list in iOS.
An explanation of a Apple Support https://developer.apple.com/forums/thread/39204

HttpListener class in c++?

I have found in this link how can we open a port to communicate with it with few tests (sensing messages) and seeing if it received well those ones sent.
http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx
I would like to open an URL
http://localhost:8080 (a port)
to test.
But it seems that it's only working on C#.
Do you have any idea if it's working on C++?
For a portable library, you could use cpp-netlib.
The link that you mentioned is for .NET Framework. Then you can use only with C# (or Dot Net languages)
You have this option for Microsoft projects:
https://github.com/Microsoft/cpprestsdk
Reference: https://blogs.msdn.microsoft.com/christophep/2017/07/01/write-your-own-rest-web-server-using-c-using-cpp-rest-sdk-casablanca/

Want to use native C libraries in a web application, what are my options?

I have many legacy C libraries used for numerical analysis and scientific computing (e.g. simulation) that I want to use in a web application I am building (so far I have only been using Javascript to make a user interface). What options do I have in doing this on the client side and/or the server side? I heard about using native client with chrome, but I dislike that the client has to turn on the native client flag to do this.
On Server Side:
To begin with CGI (Common Gateway Interface) is the most basic method to be able to use native C libraries in a web application - wherein you delegate an executable (say written in C) to generate the sever side web content.
But CGI is very primitive and inefficient. Each command can result in creation of a new Process on the server. Thus here are other viable alternates:
Apache Modules let you run third party software within the web server itself.
FastCGI - Single Process handles more than one user request.
SCGI - Simple CGI
Refer: http://en.wikipedia.org/wiki/Common_Gateway_Interface#Alternatives
On Client Side:
Good News & Bad News:
You can use PNaCl (Portable Native Client) in chrome. It will be turned on by default.
BUT the first public release is expected in late 2013.Look for PNaCl
You can't do much on the client side - there's no way you can expect the client to have these libraries, and no safe way to download and run them.
The simplest way is to write your server side any way you want, and access them through a web interface. Many languages customarily used for server side scripting can access native C libraries, or you can even write ordinary C applications and run them as scripting agents.
In the "really exotic" category, it is possible to run what starts as C code in the client
if you embed it in a sufficiently protected environment. For example, see the description
of how sqlite (a C database application) was made into a 100% pure java application by
embedding a mips simulator written in java.
http://blog.benad.me/2008/1/22/nestedvm-compile-almost-anything-to-java.html
Looked at Wt yet? Its pretty neat.
Also you have options to code in cgi(ugly).
Although not C, its written in C++. If you can ignore that part: Wt at your service
For doing it client-side, you can use Emscripten. However, this will most probably require some refactoring of your existing code to fit JavaScript's asynchronous main loop requirement.
Note that Emscripten isn't a proof of concept or something like that. It is very powerful and already used to port complex code to the web. You can take a look at the demos (listed in the above URL) to see what can be done with it.
It sounds like you're best off to represent your legacy C library methods as a kind of (WEB) service at the server side. A raw CGI application seems to be a pretty low level point for this approach, but is generally right.
There are C/C++ frameworks available to create webservice servers, and client side libraries that support webservice access and data representation. For the server side you could use gSoap for example.
Another possibility would be to use the webserver of your choice to transmit ordinary files and use a custom webserver (which wouldn't need to support the full HTTP spec) wired up to your C code to communicate with client-side Javascript.
Two minimal webservers you could use as base are libuv-webserver and nweb.

c++ ActiveMQ sending binary messages

Is it possible to send a stringstream containing binary over activemq? If so, how is this done?
I know the Java version of activemq has a feature called BlobMessage or StreamMessage to do so, however, this isn't implemented in the c++ version yet. I've already read about the BytesMessage class however I can't find any good c++ examples that implements it.
Thanks.
If you've downloaded the source for ActiveMQ-CPP then look for the Unit Tests in the the src/test folder that deal with BytesMessage, that will show you how its done. Also the StreamMessage is supported, BlobMessage is not though.
Here is the API Doc for BytesMessage in CMS.
http://activemq.apache.org/cms/api_docs/activemqcpp-3.2.5/html/classcms_1_1_bytes_message.html
and StreamMessage
http://activemq.apache.org/cms/api_docs/activemqcpp-3.2.5/html/classcms_1_1_stream_message.html
-Tim
www.fusesource.com

I am using a comet server and I want it to interact with C++

I am using persevere for an application I am writing that controls remote hardwere.
Persevere is written in Java and doesn't supply an alternative API.
I am using a web-based GUI as the control panel. So far, so good.
I can get and set data using REST channels like dojo does but the problem is that I don't really know how to use REST channels. Which library should I use to do so?
If you use gcc as your toolchain you can embed a JVM with GCJ to run persevere inside your application. GCJ makes it easy to call C++ from Java with it's CNI interface (much easier than JNI). I used that method to use Java scripting inside our C++ application. You can even compile the persevere jar into a native library and link it to your app with GCJ.
The best reference is the GCJ Documentation.
There is also a Linux Journal contains the article Embedded Java with GCJ that you can read.
You can also study applications that use gcj.