失效链接处理 |
XFIRE教程 PDF 下载
本站整理下载:
提取码:ycsg
相关截图:
主要内容:
1.新建web工程,编写程序,包括接口和相应的实现类
2.配置文件
3.web.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<display-name>rfidread</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>webapp.root</param-value>
</context-param>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>6000</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<servlet>
<servlet-name>XFireServlet</servlet-name>
<servlet-class>
org.codehaus.xfire.transport.http.XFireConfigurableServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
</web-app>
4.wsdl
http://10.14.251.241:8080/rfidcontrol/services/XfireRfidService?wsdl
rfidcontrol:war包名
services:spring <url-pattern>
XfireRfidService:
5.调用
FTPC调用
client = class org.codehaus.xfire.client.Client(class java.net.URL(wsdl));
if (path == null)
{
return false
}
args = Object[path.length]
if (args.length == 0)
{
return false
}
for (i = 0; i < args.length; i++)
{
args[i] = path[i]
}
resultObjArr = client.invoke("getRfidState", args)
vec = vector()
for(obj : resultObjArr)
{
isNormal = obj.toString()
if (isEmptyStr(isNormal))
{
return false
}
isTrue = class net.sf.json.JSONObject::fromObject(isNormal).getBoolean("result")
if (isTrue == false)
{
return false
}
data = class net.sf.json.JSONObject::fromObject(isNormal).getJSONArray("data")
for (i = 0; i < data.size(); i++)
{
tostr = data[i].toString()
result = tostr.substring(1, tostr.length()-1).split(":")
if (result[1] == "false")
{
invokeRfidWebservice("openAlarmResult", result[0].substring(1,result[0].length()-1))
vec.add(result[0])
}
}
}
|