webservice本地发布错误bug

This commit is contained in:
xiehonglong 2017-07-09 18:38:48 +08:00
parent d93494a9fc
commit 5d151d4d8a
7 changed files with 20 additions and 55 deletions

View File

@ -1,35 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.config;
import com.sun.xml.ws.transport.http.servlet.WSServletContextListener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
/**
*
* @author Administrator
*/
public class MyWSServletContextListener implements ServletContextListener {
private static WSServletContextListener wsscl = null;
static {
wsscl = new WSServletContextListener();
}
@Override
public void contextInitialized(ServletContextEvent sce) {
wsscl.contextInitialized(sce);
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
wsscl.contextDestroyed(sce);
}
}

View File

@ -108,7 +108,7 @@ public class MinaServerHandler extends IoHandlerAdapter {
*/
@Override
public void messageSent(IoSession session, Object message) {
//System.out.println("messageSent");
System.out.println("messageSent");
}
/**
@ -126,7 +126,7 @@ public class MinaServerHandler extends IoHandlerAdapter {
*/
@Override
public void sessionOpened(IoSession session) throws Exception {
//log.info("session open!!!");
log.info("session open!!!");
}
}

View File

@ -5,10 +5,7 @@
*/
package com.ifish.socket.config;
import com.ifish.helper.UserHelperI;
import com.ifish.socket.model.JobGroup;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.JobKey;
@ -22,7 +19,6 @@ import org.quartz.impl.StdSchedulerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
/**
*

View File

@ -18,8 +18,8 @@ import org.apache.mina.core.session.IoSession;
*/
@WebService
public class MyService {
//查询设备是否在线
public boolean deviceIsOnline(String macAddress) {
if (macAddress != null && macAddress.length() > 0) {
IoSession session = SomeServer.sessions_cz.get(macAddress);
@ -51,5 +51,4 @@ public class MyService {
}
return false;
}
}

View File

@ -13,16 +13,9 @@ import javax.xml.ws.Endpoint;
*/
public class ServiceBean {
private static boolean push = false;
public ServiceBean() {
}
public void init() {
try {
Endpoint.publish("http://localhost:9001/Service/webService", new MyService());
System.out.println("MyService发布成功");
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}

View File

@ -8,7 +8,7 @@
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- webService -->
<bean id="serviceBean" class="com.ifish.socket.webService.ServiceBean" init-method="init"></bean>
<bean id="serviceBean" class="com.ifish.socket.webService.ServiceBean"></bean>
<!-- 消息处理类 -->
<bean id="someServer" class="com.ifish.socket.config.SomeServer"></bean>
<!-- 实现job中注入bean -->

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>