GVKun编程网logo

android – 如何使用ksoap2验证sap web服务(sap authenticator)

4

在本文中,我们将给您介绍关于android–如何使用ksoap2验证sapweb服务的详细内容,并且为您解答sapauthenticator的相关问题,此外,我们还将为您提供关于androidhttp

在本文中,我们将给您介绍关于android – 如何使用ksoap2验证sap web服务的详细内容,并且为您解答sap authenticator的相关问题,此外,我们还将为您提供关于android http 本地 web服务(tomcat)、android – 在Internet上发布我的RESTful Web服务、android – 如何在本地网络中提供ASP.NET Web API Web服务、CentOS 7 搭建Java Web服务(Nginx+Tomcat+MySql)的知识。

本文目录一览:

android – 如何使用ksoap2验证sap web服务(sap authenticator)

android – 如何使用ksoap2验证sap web服务(sap authenticator)

我必须连接SAP Web服务.这是我的代码,但它警告:org.xmlpull.v1.XmlPullParserException:expected:START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope(位置:START_TAG @ 1:7 in java.io.InputStreamReader @ 40e3fe98)

这是我用户名和密码连接的完整代码.
谢谢你的回复.

final static String NAMESPACE = "urn:sap-com:document:sap:soap:functions:mc-style";
final static String METHOD_NAME = "ZmblHucremalzemelistesi";
final static String SOAP_ACTION = "";
final static String URL = "http://xxx.xxx.xxx.xxx:1080/sap/bc/srt/wsdl/bndg_4F969242EA785040E10080008D0B0B03/wsdl11/allinone/ws_policy/document?sap-client=010";


private void testWS() {
    // Todo Auto-generated method stub


    SoapObject reSoapObject = new SoapObject(NAMESPACE,METHOD_NAME);
    SoapSerializationEnvelope soaSerializationEnvelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);

    reSoapObject.addProperty("ILgort","H12");

    soaSerializationEnvelope.setoutputSoapObject(reSoapObject);
    soaSerializationEnvelope.headerOut = new Element[1]; 
    soaSerializationEnvelope.headerOut[0] = buildAuthHeader(); 

    HttpTransportSE httpTransportSE = new HttpTransportSE(URL);

    try {

        httpTransportSE.call(SOAP_ACTION,soaSerializationEnvelope);

        Object response = soaSerializationEnvelope.getResponse();

        tv.setText(response.toString());

    } catch (IOException e) {
        e.printstacktrace();
    } catch (XmlPullParserException e) {
        e.printstacktrace();
    }


}

private Element buildAuthHeader() { 

    Element h = new Element().createElement(NAMESPACE,"AuthHeader"); 
    Element username = new Element().createElement(NAMESPACE,"user"); 
    username.addChild(Node.TEXT,"testuser"); 
    h.addChild(Node.ELEMENT,username); 
    Element pass = new Element().createElement(NAMESPACE,"pass"); 
    pass.addChild(Node.TEXT,"testpwd"); 
    h.addChild(Node.ELEMENT,pass); 

    return h; 
}

解决方法

试试这个:

final static String NAMESPACE = "urn:sap-com:document:sap:soap:functions:mc-style";
    final static String METHOD_NAME = "ZmblHucremalzemelistesi";
    final static String SOAP_ACTION = "";
    final static String URL = "http://xxx.xxx.xxx.xxx:1080/sap/bc/srt/wsdl/bndg_4F969242EA785040E10080008D0B0B03/wsdl11/allinone/ws_policy/document?sap-client=010";

    private static final String USERNAME = "YOUR_USERNAME";
    private static final String PASSWORD = "YOUR_PASSWORD";

    private void testWS() {
        SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
        request.addProperty("ILgort","H12");

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.setoutputSoapObject(request);

        AuthTransportSE androidHttpTransport = new AuthTransportSE(URL,USERNAME,PASSWORD);
        androidHttpTransport.debug = true;

        try {
            androidHttpTransport.call(SOAP_ACTION,envelope);
            SoapObject response = (SoapObject) envelope.getResponse();
            // if it did not work,try this:
            // SoapObject response = (SoapObject) envelope.bodyIn;

            tv.setText(response.toString());

        } catch (IOException e) {
            e.printstacktrace();
        }
    }

而AuthTransportSE类是:

import java.io.IOException;

import org.ksoap2.transport.HttpTransportSE;
import org.ksoap2.transport.ServiceConnection;
import org.ksoap2.transport.ServiceConnectionSE;

public class AuthTransportSE extends HttpTransportSE{
    private String username;
    private String password;

    public AuthTransportSE(String url,String username,String password) {
        super(url);
        this.username = username;
        this.password = password;       
    }

    protected ServiceConnection getServiceConnection() throws IOException {
        ServiceConnection midpConnection = new ServiceConnectionSE(url);
        addBasicAuthentication(midpConnection);
        return midpConnection;
    }

    protected void addBasicAuthentication(ServiceConnection midpConnection) throws IOException {
        if (username != null && password != null) {
            StringBuffer buf = new StringBuffer(username);
            buf.append('':'').append(password);
            byte[] raw = buf.toString().getBytes();
            buf.setLength(0);
            buf.append("Basic ");
            org.kobjects.base64.Base64.encode(raw,raw.length,buf);
            midpConnection.setRequestProperty("Authorization",buf.toString());
        }
    }
}

android http 本地 web服务(tomcat)

android http 本地 web服务(tomcat)

1. Android代码

public class JobActivity extends Activity {
	private TextView show;
	private EditText txt;
	private Button btn;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        ConnectivityManager con=(ConnectivityManager)getSystemService(Activity.CONNECTIVITY_SERVICE);
        boolean wifi=con.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnectedOrConnecting();
        boolean internet=con.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnectedOrConnecting();
        if(wifi ){
        	show = (TextView)findViewById(R.id.show);
            txt = (EditText)findViewById(R.id.txt);
            btn = (Button)findViewById(R.id.btn);
            btn.setOnClickListener(new OnClickListener() {
        	@Override
        	   public void onClick(View v) {
        		show.setText("dianjile");
        	    dopost(txt.getText().toString());
        	   }
        	  });
        }
    }
    
    private void dopost(String val){
        //封装数据
        Map<String, String> parmas = new HashMap<String, String>();
        parmas.put("name", val);
       

DefaultHttpClient client = new DefaultHttpClient();//http客户端

//这个地方需要注意:如果是调试器 10.0.2.2 本机地址;真机上:则是路由器中电脑地址

HttpPost httpPost = new HttpPost("http://192.168.2.100:80/loowj/android$Android$go"); ArrayList<BasicNameValuePair> pairs = new ArrayList<BasicNameValuePair>(); if(parmas != null){ Set<String> keys = parmas.keySet(); for(Iterator<String> i = keys.iterator(); i.hasNext();) { String key = (String)i.next(); pairs.add(new BasicNameValuePair(key, parmas.get(key))); } } try { UrlEncodedFormEntity p_entity = new UrlEncodedFormEntity(pairs, "utf-8"); /* * 将POST数据放入HTTP请求 */ httpPost.setEntity(p_entity); /* * 发出实际的HTTP POST请求 */ TextView tv = (TextView)findViewById(R.id.state); tv.setText("start post:"); HttpResponse response = client.execute(httpPost); tv.setText((response.getStatusLine().getStatusCode() +"")); HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); String returnConnection = convertStreamToString(content); show.setText(returnConnection); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } private String convertStreamToString(InputStream is) { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line); } } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } return sb.toString(); } }

2.android 配置文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.loowj.core"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="10" />
     //注意加上网络权限     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
	<uses-permission android:name="android.permission.INTERNET"/>
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name="loowj.JobActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


android – 在Internet上发布我的RESTful Web服务

android – 在Internet上发布我的RESTful Web服务

我在MysqL服务器数据库和我的移动应用程序( Android,iPhone)之间开发了一个 RESTful Web Service using Jersey.

我在Web服务中使用Hibernate与数据库通信,然后将我的DAO连接到Jersey服务.

我的操作系统是Windows7-64bit.
现在,Web服务正在locathost中的Tomcat 7上运行.如何在Internet上发布我的Web服务?什么是最好的方法?例如,我可以使用Amazon Web Services或Apache HTTP Server吗?
或者也许是其他网络服务器,如:Web Servers – Examples

解决方法

我只想推荐你:

How to publish a JSP project on the Internet using Tomcat web server?

请注意,大多数提供商对您家用计算机上运行的服务器不满意,但如果您没有推动疯狂的数量,那么这可能不是什么大问题.

附加物:

前提是将您的个人计算机用于主机.使用像DynDNS这样的服务可以让您在互联网上“存在”,因为现在您有一个可以解析的名称.其中没有端口号的URL将转到端口80,因此您必须为该端口配置服务.这假设您具有100%的Internet连接,并且您可以正确配置网络硬件以接受和路由传入流量(此处超出范围).

ISP在家中运行服务器时皱着眉头与Windows无关,它更多的是政策,基础设施,定价等.

android – 如何在本地网络中提供ASP.NET Web API Web服务

android – 如何在本地网络中提供ASP.NET Web API Web服务

我即将编写一个 JSON-web-service(VS Express 2012 – ASP.NET WEB API),现在我想通过尝试从我的 Android-app获取数据来测试它.所以我尝试通过这样做使我的服务可用于本地网络:

– >在applicationhost.config中从localhost更改为192.168.1.52

<site name="MyFirstWebApi" id="5">
     <application path="/" applicationPool="Clr4IntegratedAppPool">
         <virtualDirectory path="/" physicalPath="c:\projects\MyFirstWebApi" />
     </application>
     <bindings>
         <binding protocol="http" bindinginformation="*:61802:192.168.1.52" />
     </bindings>
</site>

– >并且还更改了项目属性 – >网络 – > “使用本地IIS-Webserver” – > project-url to http://192.168.1.52:61802/

但是,当我现在尝试启动该服务时,它会给我一个错误消息框:

The IIS-Express-webserver Could not be started
(Translated from german)

不幸的是,我看不出确切的错误是什么,因为VS输出是空的

任何人都知道如何解决这个问题或如何正确设置?

解决方法

IIS Express默认不允许“远程”连接…这篇文章告诉你该做什么:

IIS Express enable external request

完成后,您应该可以从网络中的任何其他计算机进行连接.

此外,请确保打开防火墙中的端口.

如果这不起作用,我会使用您的本地IIS创建一个站点并以这种方式测试您的服务.

希望能帮助到你,丹尼尔.

CentOS 7 搭建Java Web服务(Nginx+Tomcat+MySql)

CentOS 7 搭建Java Web服务(Nginx+Tomcat+MySql)

对于一个扎根Java编程的程序员来说,搭建Java Web服务是一个必备能力,所以在这里总结下,写了个安装教程。

教程环境为:
CentOS 7.5 mini + Nginx 1.15.8 + JDK1.8.0_201 + Tomcat 9.0.14 + MySql 5.7.22

    1.安装Nginx

安装Nginx是采用编译再安装的形式,所以要先安装编译库。

安装编译依赖库

yum install -y gcc gcc-c++ make kernel-headers glibc-headers zlib-devel openssl openssl-devel pcre-devel

下载安装Nginx

wget -O nginx.tar.gz http://nginx.org/download/nginx-1.15.8.tar.gz
tar -zxvf nginx.tar.gz
#进入目录
cd nginx-*


添加 header协议头增强库

wget https://codeload.github.com/openresty/headers-more-nginx-module/zip/master -O headers-more-nginx-module-master.zip
unzip headers-more-nginx-module-master.zip

编译配置

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --add-module=headers-more-nginx-module-master

编译并安装

make && make install

查看版本

sbin/nginx -v

#修改配置
vi /usr/local/nginx/conf/nginx.conf

配置内容参考如下:
#---------请自行参考注释修改----------
server {
#============监听的Nginx端口========
listen 80;
server_name localhost;
charset utf-8; #默认编码
#access_log logs/host.access.log combined;
root /usr/local/apache-tomcat/webapps/ROOT;
#配置Nginx动静分离,定义的静态页面直接从Nginx发布目录读取。
location ~ .*.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$
{
expires 7d;
}












    location ~ .*\.(js|css)$
    {
        expires      1h;
    }
    #============对 java后台(jsp、servlet) 请求的处理=============
    location ~ .*\.^(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma|js|css)$
    {   
        index index.jsp;
        #==========Nginx提供的代理============
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        #=== 如果遇到 非静态 的请求就进入该服务器(tomcat)===
        proxy_pass http://127.0.0.1:8080;
    }
}

#---------END----------

启动

/usr/local/nginx/sbin/nginx
如果要设置https协议,可参考如下:
server {
listen 80;
server_name www.kioye.cn;



跳转到https协议

rewrite ^(.*)$ https://$server_name$1 permanent;

}

server {
listen 443 ssl;
server_name www.kioye.cn;
#root html;
charset utf-8;#默认编码



index index.html index.htm;

# HTTPS server
ssl_certificate /data/release/www.kioye.cn/Nginx/1_www.kioye.cn_bundle.crt; #
ssl_certificate_key /data/release/www.kioye.cn/Nginx/2_www.kioye.cn.key; #server {
ssl_session_timeout 5m; 
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # server_name localhost;
ssl_ciphers 

ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA;
ssl_session_cache shared:SSL:50m; # ssl_certificate cert.pem;
ssl_prefer_server_ciphers on; # ssl_certificate_key cert.key;

#    ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m;
location / {
    root /usr/local/apache-tomcat/webapps/ROOT;
    index index.jsp index.do; # ssl_prefer_server_ciphers on;
    #==========Nginx提供的代理============
    proxy_set_header X-Forwarded-Host $host; 
    proxy_set_header X-Forwarded-Server $host; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_pass http://127.0.0.1:8080;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection ''upgrade'';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}

}

提示:访问出现403,则需要设置文件chown -R centos:centos html
以及chmod -R 755 html
其他命令:
/usr/local/nginx/sbin/nginx -s stop #停止
/usr/local/nginx/sbin/nginx -s reload #重新载入配置文件
/usr/local/nginx/sbin/nginx -s reopen #重启




2.安装JDK
因为CentOS中下载大的安装包容易失败,故所有需要的安装包都是提前下载好再烤到CentOS系统内的。
JDK网址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
这里选择下载的是:jdk-8u201-linux-x64.rpm


查看是否存在其它版本的Java环境(如果有请先卸载!)

rpm -qa|grep java

rpm -e --nodeps <package>

下载安装包

wget -O jdk-8u201-linux-x64.rpm https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.rpm?AuthParam=1548242964_2cf2feda788bc09354d75b934649f1f3

安装

sudo rpm -ivh jdk-8u201-linux-x64.rpm

查看当前环境

java -version

显示如下为安装成功

java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
3.安装Tomcat
Tomcat网址:https://tomcat.apache.org/download-90.cgi
这里选择下载的是:9.0.14.tar.gz
wget -O apache-tomcat.tar.gz http://mirrors.shu.edu.cn/apache/tomcat/tomcat-9/v9.0.14/bin/apache-tomcat-9.0.14.tar.gz





解压下载好的压缩包

tar zxvf apache-tomcat.tar.gz
mv apache-tomcat-* /usr/local/apache-tomcat
cd /usr/local/apache-tomcat

配置tomcat服务

vim conf/server.xml
#----建议配置内容(可选)------
#将protocol="HTTP/1.1"协议中 添加 URIEncoding 为 UTF-8 编码。端口也在下面的参数,可以自行修改。
<Connector port="8080" protocol="HTTP/1.1"  connectionTimeout="20000"  redirectPort="8443"  URIEncoding="UTF-8"/>
附加内容:



给tomcat设置管理用户和密码

打开配置,在tomcat目录下操作

vim conf/tomcat-users.xml

添加如下内容:(访问tomcat管理页面的密码)

<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<user username="admin" password="0000" roles="manager-gui,admin-gui"/>

附录:请求限制设置参考(可选)

#1.只允许127.0.0.1访问:
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1" deny=""/>
#2.根据主机名进行限制:
<Valve className="org.apache.catalina.valves.RemoteHostValve" allow="localhost" deny=""/>


重启服务/usr/local/apache-tomcat/bin/startup.sh
现在就可以打开网页访问了:http://127.0.0.1:8080/

4.安装MySql
先添加mysql的rpm源,再用yum安装mysql
// 查看是否安装MariaDB(如果安装了,请先卸载)
rpm -qa | grep mariadb


rpm -e --nodeps mariadb-libs

进入相应目录

cd /usr/local/src

下载mysql的rpm安装源

wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

安装rpm源

rpm -ivh mysql57-community-release-el7-8.noarch.rpm

直接安装mysql-server(默认最新版)

yum -y install mysql-server
安装完成了,配置部分请参考下面的 rpm安装mysql
配置Mysql
// ----下面是一些初始化配置-----
// 关闭启动的表授权(取消验证root密码)
vim /etc/my.cnf




添加一条语句:

skip-grant-tables

// 启动服务
systemctl start mysqld.service
// 进入mysql管理
mysql -u root


------以下为mysql命令界面------

选择表

use mysql;

修改密码

update mysql.user set authentication_string=password(''0000'') where user=''root'';

更新权限

flush privileges;

退出

exit;

// 开启表授权验证
vim /etc/my.cnf

删除刚刚添加的语句

skip-grant-tables

// (接上)配置默认编码为utf8

在[mysqld]下添加编码配置,如下内容

[mysqld]
character_set_server=utf8
init_connect=''SET NAMES utf8''

// 重启服务
systemctl restart mysqld.service

// 进入mysql管理
mysql -u root -p

------以下为mysql命令界面------

设置关闭密码策略

set global validate_password_policy=0;

设置关闭有效密码最短长度

set global validate_password_length=3;

设置密码

set PASSWORD = PASSWORD(''0000'');

设置用户永不过期

ALTER USER ''root''@''localhost'' PASSWORD EXPIRE NEVER;

生效

flush privileges;

查看 MySQL 的字符集:

show variables like ''%character%'';

为root开启远程登录

use mysql;
update user set host=''%'' where user=''root'' and host=''localhost'';

(可选)新建一个开启远程登录用户(用户remote密码0000)

GRANT ALL PRIVILEGES ON . TO ''remote''@''%'' IDENTIFIED BY ''0000'' WITH GRANT OPTION;

生效

flush privileges;
quit;

好了现在mysql已经可以正常工作了。
添加自启操作是:systemctl enable mysqld.service

5.防火墙设置
对于非本地访问则需要配置一下防火墙,下面是一些开启访问权限的操作。

// 临时关闭SELINUX
setenforce 0

// 永久关闭SELINUX
vim /etc/selinux/config
// 修改如下:(重启机器后生效)
SELINUX=enforcing -> SELINUX=disabled


// 开放端口
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=22/tcp --permanent
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
6.设置自启





由于有些服务是第三方编译安装的,并不会加入系统管理中,故需要自行编写控制脚本,在添加到自启动列表中。

6.1) nginx自启配置
// 编写nginx控制脚本
vim /etc/init.d/nginx

#! /bin/sh

Default-Start: 2 3 4 5

Default-Stop: 0 1 6

Short-Description: starts the nginx web server

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="nginx daemon"
NAME=nginx
DAEMON=/usr/local/nginx/sbin/$NAME
CONFIGFILE=/usr/local/nginx/$NAME.conf
PIDFILE=/usr/local/nginx/logs/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME





set -e
[ -x "$DAEMON" ] || exit 0

do_start() {
$DAEMON -c $CONFIGFILE || echo -n "nginx already running"
}

do_stop() {
kill -INT cat $PIDFILE || echo -n "nginx not running"
}

do_reload() {
kill -HUP cat $PIDFILE || echo -n "nginx can''t reload"
}

case "$1" in
start)
echo -n "Starting $DESC: $NAME"
do_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
do_stop
echo "."
;;
reload|graceful)
echo -n "Reloading $DESC configuration..."
do_reload
echo "."
;;
restart)
echo -n "Restarting $DESC: $NAME"
do_stop
do_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2
exit 3
;;
esac

























exit 0

// 给文件添加执行权限
chmod +x /etc/init.d/nginx

// 添加到自启列表
chkconfig --add ningx
chkconfig --level nginx 2345 on

6.2) Tomcat自启配置
7.// 编写tomcatd控制脚本
vim /etc/init.d/tomcatd

#!/bin/bash
#

/etc/rc.d/init.d/tomcat

init script for tomcat precesses

#

processname: tomcat

description: tomcat is a j2se server

chkconfig: 2345 86 16

description: Start up the Tomcat servlet engine.

if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
else
echo -e "\atomcat: unable to locate functions lib. Cannot continue."
exit -1
fi
RETVAL=$?
CATALINA_HOME="/usr/local/apache-tomcat-9.0.1" #tomcat安装目录








case "$1" in
start)
if [ -f $CATALINA_HOME/bin/startup.sh ];
then
echo $"Starting Tomcat"
$CATALINA_HOME/bin/startup.sh
fi
;;
stop)
if [ -f $CATALINA_HOME/bin/shutdown.sh ];
then
echo $"Stopping Tomcat"
$CATALINA_HOME/bin/shutdown.sh
fi
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
;;
esac
exit $RETVAL



















// 给文件添加执行权限
chmod +x /etc/init.d/tomcatd

// 添加到自启列表
chkconfig --add tomcatd
chkconfig --level 2345 tomcatd on

我们今天的关于android – 如何使用ksoap2验证sap web服务sap authenticator的分享就到这里,谢谢您的阅读,如果想了解更多关于android http 本地 web服务(tomcat)、android – 在Internet上发布我的RESTful Web服务、android – 如何在本地网络中提供ASP.NET Web API Web服务、CentOS 7 搭建Java Web服务(Nginx+Tomcat+MySql)的相关信息,可以在本站进行搜索。

本文标签: