Connect web server with database and J2ME

强颜欢笑 提交于 2020-01-14 16:35:51

问题


I do a mobile application which the user can use it get the required place’s number. The user must select the appropriate city and category to get the place’s information. All the information stored in the database.

What I want to know that ..

1) What is the benefit from the web service?

2) How to connect the web service and MySQl database?

3) How to connect the web service and mobile application to get the information from the database?


回答1:


1) Benefits. You didn't mentioned other options, but if you are talking about some custom server-side implementation, the benefits are numerous:

  1. It's easy to connect to web service from J2ME.
  2. Multiple connection sessions at one time.
  3. You can use web service from different applications and different technologies.
  4. No issues with authentication and authorization.
  5. You just call method from ws and in response you get easy-to-parse XML.

2) Web service - MySQL:

  1. You have to create a Tomcat or IIS web service.
  2. From web service code connect to MySQL, call a query and return the result.

For Tomcat and Java web service:

Getting started with Web Services Using Apache Axis Developing and Deploying Java Web Services with MySQL on Apache Tomcat and Axis on Windows JDBC for MySQL

For IIS and C#/.NET web service: CodeProject:Your first C# Web Service by Chris Maunder How to connect to MySQL 5.0. via C# .NET and the MySQL Connector/Net


3) J2ME - web service (with JAX-RPC) 1. generate stub from web service WDDL using J2ME Wireless Toolkit 2. add stub to your project, import stub namespace, set connection properties and call stub methods How to build and run a J2ME Web service application? Web Services APIs for J2ME, Part 1: Remote service invocation API



来源:https://stackoverflow.com/questions/757503/connect-web-server-with-database-and-j2me

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!