Fosstrak全资料(2)

2025-08-03

EPC epc = new EPC();

epc.setValue(%urn:epc:id:sgtin:0614141.107346.2017\EPCListType epcList = new EPCListType(); epcList.getEpc().add(epc); objEvent.setEpcList(epcList);

// set action

objEvent.setAction(ActionType.OBSERVE);

// set bizStep

objEvent.setBizStep(%urn:epcglobal:epcis:bizstep:fmcg:shipped\

// set disposition

objEvent.setDisposition(%urn:epcglobal:epcis:disp:fmcg:unknown\

// set readPoint

ReadPointType readPoint = new ReadPointType(); readPoint.setId(%urn:epc:id:sgln:0614141.07346.1234\objEvent.setReadPoint(readPoint);

// set bizLocation

BusinessLocationType bizLocation = new BusinessLocationType(); bizLocation.setId(\objEvent.setBizLocation(bizLocation);

// create the EPCISDocument containing a single ObjectEvent EPCISDocumentType epcisDoc = new EPCISDocumentType(); EPCISBodyType epcisBody = new EPCISBodyType(); EventListType eventList = new EventListType();

eventList.getObjectEventOrAggregationEventOrQuantityEvent().add(objEvent); epcisBody.setEventList(eventList); epcisDoc.setEPCISBody(epcisBody);

epcisDoc.setSchemaVersion(new BigDecimal(\1.0\epcisDoc.setCreationDate(now);

因为包中这些类都是由EPCglobal's XML schema自动生成的,他们严格遵循JAXB的强制规范,但是用起来不直观。后续Fosstrak EPCIS版本将在org.fosstrak.epcis.model 包上提供一个额外的更加直观的对象模型。

如何查询EPCIS事件

Fosstrak EPCIS知识库实现查询接口与SOAP/HTTP的绑定,这样你需要构建一个有效的SOAP请求发送给知识库。比如,查询一个EPC值等于“urn:epc:id:sgtin:1.1.0”的ObjectEvents,看上去类似于以下内容: SimpleEventQuery eventType ObjectEvent MATCH_epc urn:epc:id:sgtin:0614141.107346.2017 这个XML在发送到查询接口之前必须包装为一个SOAP请求,下面代码片段演示了如何使用epcis-queryclient.jar包中的QueryControlClient类发送请求数据到知识库。 // get the query client and poll the query String queryUrl = \QueryControlClient client = new QueryControlClient(queryUrl); QueryResults results = client.poll(query); // check results of query results.getResultsBody(); // etc. QueryControlClient类的poll方法所要求的事件对象也可以是一个XML String,一个以字节流的方式提供xml数据的InputStream或是一个EPCISDocumentType实例。下面代码片段演示了如何使用org.fosstrak.epcis.model包创建Poll实例。 // construct the query parameters QueryParam queryParam1 = new QueryParam(); queryParam1.setName(\ArrayOfString queryParamValue1 = new ArrayOfString(); queryParamValue1.getString().add(\); queryParam1.setValue(queryParamValue1); QueryParam queryParam2 = new QueryParam(); queryParam2.setName(\ArrayOfString queryParamValue2 = new ArrayOfString(); queryParamValue2.getString().add(%urn:epc:id:sgtin:0614141.107346.2017\); queryParam2.setValue(queryParamValue2); // add the query parameters to the list of parameters QueryParams queryParams = new QueryParams(); queryParams.getParam().add(queryParam1); queryParams.getParam().add(queryParam2); // create the Poll object Poll poll = new Poll(); poll.setQueryName(\SimpleEventQuery\); poll.setParams(queryParams);

如何使用查询排程

EPCIS知识库提供的标准查询每次只运行一次。为了能订阅这样的查询,客户端必须利用排程不断的提交查询信息给知识库。而使用QuerySchedule这比较聪明,我们将在这里讲解他的用法并提供一些例子: 一个QuerySchedule包含不同的字段和时间单元,如果设置一个字段的值,当时间到达该字段所设置的值时,查询将被执行。下面的例子(取自EPCIS规范)说明如何使用QuerySchedule: ?

Example Schedule 1: ? ? ?

second=0 minute=0

all other fields omitted

该查询关联的排程将在每小时小时头运行一次(小时字段被忽略,则表示每小时运行一次,秒和分钟都设置为0则表示在小时头运行此查询)。 ?

Example Schedule 2: ? ? ? ?

second=0 minute=0 dayOfWeek=[1-5]

该查询关联的排程将在每小时小时头运行一次,但只在工作日运行(从周一到周五)。

如何订阅一个排程查询

一个关联排程的查询(如上所示)可像标准查询一样注册到知识库中,当排程到时就会执行这个查询。 我们将注册一个排程查询,该查询使用example 1中的排程,并返回上一章节中的查询结果,该排程查询的注册配置看起来像这样:

SimpleEventQuery eventType ObjectEvent MATCH_epc urn:epc:id:sgtin:0614141.107346.2017 http://localhost:8888/ 0 0 2008-03-16T00:00:00+01:00 false mySubscrId001 如何订阅一个触发查询 如何使用查询回调接口 如何使用事件字段扩展 如何捕获和修改EPCIS元数据 如何查询EPCIS元数据 4) 知识库安全

在Tomcat中设置客户端认证 5) EPCIS知识库的运行时配置文件 application.properties context.xml log4j.properties

四、 开发指南 五、 EPCIS 架构指南 1. 关于本指南说明

本指南将描Fosstrak's EPCIS的架构与设计实现方式,其目的是将此项目介绍给对EPCglobal EPC Information Services (EPCIS) 标准有所了解的潜在开发者。有关该标准的最新版本请参见EPCglobal的官方网站(http://www.epcglobalinc.org/standards/epcis)。


Fosstrak全资料(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2024—2024学年第二学期期中考试初一英语试卷

相关阅读
本类排行
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 7

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219