-
Notifications
You must be signed in to change notification settings - Fork 57
7. Examples for Query Service (SOAP HTTP)
Jaewook Byun edited this page Aug 22, 2023
·
1 revision
- Query Service (XML) is using SOAP/HTTP
- HTTP.POST on http://localhost:8080/epcis/query (example)
- Contents of SOAP envelope differentiates the type of queries.
- Description: Get the standard version that the service is targeted for
- Request Body ( Type: application/xml )
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:query="urn:epcglobal:epcis-query:xsd:2">
<soapenv:Header/>
<soapenv:Body>
<query:GetStandardVersion/>
</soapenv:Body>
</soapenv:Envelope>- Response Status: 200 OK (Example)
- Response Body ( Type: application/xml )
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<query:GetStandardVersionResult xmlns:query="urn:epcglobal:epcis-query:xsd:1">2.0.0</query:GetStandardVersionResult>
</soapenv:Body>
</soapenv:Envelope>- Description: Get the vendor-specific version of the service
- Request Body ( Type: application/xml )
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:query="urn:epcglobal:epcis-query:xsd:2">
<soapenv:Header/>
<soapenv:Body>
<query:GetVendorVersion/>
</soapenv:Body>
</soapenv:Envelope>- Response Status: 200 OK (Example)
- Response Body ( Type: application/xml )
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<query:GetVendorVersionResult xmlns:query="urn:epcglobal:epcis-query:xsd:1">org.oliot.epcis-2.2.0</query:GetVendorVersionResult>
</soapenv:Body>
</soapenv:Envelope>- Description: Get the names of SOAP/HTTP queries that the service provides
- Request Body ( Type: application/xml )
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:query="urn:epcglobal:epcis-query:xsd:2">
<soapenv:Header/>
<soapenv:Body>
<query:GetQueryNames/>
</soapenv:Body>
</soapenv:Envelope>- Response Status: 200 OK (Example)
- Response Body ( Type: application/xml )
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<query:GetQueryNamesResult xmlns:query="urn:epcglobal:epcis-query:xsd:1">
<string>SimpleEventQuery</string>
<string>SimpleMasterDataQuery</string>
</query:GetQueryNamesResult>
</soapenv:Body>
</soapenv:Envelope>- Description: Retrieve events/vocabularies under given queries, immediately
- Request Body ( Type: application/xml ) - Retrieve the object events
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:query="urn:epcglobal:epcis-query:xsd:2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<query:Poll>
<queryName>SimpleEventQuery</queryName>
<params>
<param>
<name>eventType</name>
<value xsi:type="query:ArrayOfString">
<string>ObjectEvent</string>
</value>
</param>
</params>
</query:Poll>
</soapenv:Body>
</soapenv:Envelope>- Response Status: 200 OK (Example)
- Response Body ( Type: application/xml )
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ext0="http://dfpl.sejong.ac.kr/epcis/resource" xmlns:ext1="https://autoidlab.kaist.ac.kr/resource" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns2:queryResults xmlns:ns2="urn:epcglobal:epcis:xsd:2" xmlns:ns3="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader">
<queryName>SimpleEventQuery</queryName>
<resultsBody>
<EventList>
<ObjectEvent>
<eventTime>2022-11-11T05:59:02.099Z</eventTime>
<recordTime>2023-07-12T08:40:27.113Z</recordTime>
<eventTimeZoneOffset>+09:00</eventTimeZoneOffset>
<eventID>ni:///sha-256;09fb1347769d5b0912d0833f54503cba2f9a2ac9444023f33c146d8d9d8b77c5?ver=CBV2.0</eventID>
<certificationInfo>https://customsauthority.example.gov/certificate/ABC12345</certificationInfo>
<epcList>
<epc>urn:epc:id:sgtin:0614141.107346.2018</epc>
<epc>urn:epc:id:sgtin:0614141.107346.2019</epc>
</epcList>
<action>ADD</action>
<bizStep>urn:epcglobal:cbv:bizstep:loading</bizStep>
<disposition>urn:epcglobal:cbv:disp:active</disposition>
<readPoint>
<id>urn:epc:id:sgln:0037000.00729.0</id>
</readPoint>
<bizLocation>
<id>urn:epc:id:sgln:0037000.00730.0</id>
</bizLocation>
<bizTransactionList>
<bizTransaction type="urn:epcglobal:cbv:btt:po">urn:epc:id:gdti:0614141.00001.1618034</bizTransaction>
</bizTransactionList>
<quantityList>
<quantityElement>
<epcClass>urn:epc:class:lgtin:4012345.012345.998877</epcClass>
<quantity>20.0</quantity>
<uom>KGM</uom>
</quantityElement>
</quantityList>
<sourceList>
<source type="urn:epcglobal:cbv:sdt:owning_party">urn:epc:id:pgln:4012345.00225</source>
<source type="urn:epcglobal:cbv:sdt:location">urn:epc:id:sgln:0037000.00729.0</source>
</sourceList>
<destinationList>
<destination type="urn:epcglobal:cbv:sdt:owning_party">urn:epc:id:pgln:4012345.00226</destination>
</destinationList>
<sensorElementList>
<sensorElement>
<sensorMetadata bizRules="urn:epc:id:gdti:0614141.12345.006848" dataProcessingMethod="urn:epc:id:gdti:0614141.12345.006849" deviceID="urn:epc:id:giai:4000001.111" deviceMetadata="urn:epc:id:gdti:0614141.12345.006847" endTime="2022-11-11T05:04:00.000Z" rawData="urn:epc:id:gdti:0614141.12345.006850" startTime="2022-11-11T05:00:00.000Z" time="2022-11-11T05:00:00.000Z"/>
<sensorReport booleanValue="true" chemicalSubstance="https://identifiers.org/inchikey:CZMRCDWAGMRECN-UGDNZRGBSA-N" coordinateReferenceSystem="http://www.opengis.net/def/crs/EPSG/0/27700" dataProcessingMethod="urn:epc:id:gdti:0614141.12345.006849" deviceID="urn:epc:id:giai:4000001.111" deviceMetadata="urn:epc:id:gdti:0614141.12345.006847" hexBinaryValue="FEDC" maxValue="26.0" meanValue="23.0" microorganism="https://www.ncbi.nlm.nih.gov/taxonomy/1126011" minValue="20.0" percRank="100.0" percValue="26.0" rawData="urn:epc:id:gdti:0614141.12345.006850" sDev="0.3" stringValue="error" time="2022-11-11T05:00:00.000Z" type="gs1:Temperature" uom="CEL" uriValue="https://identifiers.org/inchikey:CZMRCDWAGMRECN-UGDNZRGBSA-N" value="26.0"/>
<sensorReport exception="ALARM_CONDITION"/>
<ext0:default xsi:type="xsd:string">A string extension value as a default type</ext0:default>
<ext0:string xsi:type="xsd:string">A string extension value (dfpl)</ext0:string>
<ext1:string xsi:type="xsd:string">A string extension value
(autoid)</ext1:string>
<ext0:int xsi:type="xsd:int">3</ext0:int>
<ext0:double xsi:type="xsd:double">35.7</ext0:double>
<ext0:dateTimeStamp xsi:type="epcis:DateTimeStamp">2022-11-11T14:59:02.099+09:00</ext0:dateTimeStamp>
<ext0:array xsi:type="xsd:string">A string extension value #2</ext0:array>
<ext0:array xsi:type="xsd:int">4</ext0:array>
<ext0:object>
<inner xsi:type="xsd:string">An inner string extension value</inner>
<ext1:inner xsi:type="xsd:int">5</ext1:inner>
</ext0:object>
</sensorElement>
</sensorElementList>
<persistentDisposition>
<unset>urn:epcglobal:cbv:disp:completeness_inferred</unset>
<set>urn:epcglobal:cbv:disp:completeness_verified</set>
</persistentDisposition>
<ilmd>
<ext0:default xsi:type="xsd:string">A string extension value as a default type</ext0:default>
<ext0:string xsi:type="xsd:string">A string extension value (dfpl)</ext0:string>
<ext1:string xsi:type="xsd:string">A string extension value
(autoid)</ext1:string>
<ext0:int xsi:type="xsd:int">3</ext0:int>
<ext0:double xsi:type="xsd:double">35.7</ext0:double>
<ext0:dateTimeStamp xsi:type="epcis:DateTimeStamp">2022-11-11T14:59:02.099+09:00</ext0:dateTimeStamp>
<ext0:array xsi:type="xsd:string">A string extension value #2</ext0:array>
<ext0:array xsi:type="xsd:int">4</ext0:array>
<ext0:object>
<inner xsi:type="xsd:string">An inner string extension value</inner>
<ext1:inner xsi:type="xsd:int">5</ext1:inner>
</ext0:object>
</ilmd>
<ext0:default xsi:type="xsd:string">A string extension value as a default type</ext0:default>
<ext0:string xsi:type="xsd:string">A string extension value (dfpl)</ext0:string>
<ext1:string xsi:type="xsd:string">A string extension value (autoid)</ext1:string>
<ext0:int xsi:type="xsd:int">3</ext0:int>
<ext0:double xsi:type="xsd:double">35.7</ext0:double>
<ext0:dateTimeStamp xsi:type="epcis:DateTimeStamp">2022-11-11T14:59:02.099+09:00</ext0:dateTimeStamp>
<ext0:array xsi:type="xsd:string">A string extension value #2</ext0:array>
<ext0:array xsi:type="xsd:int">4</ext0:array>
<ext0:object>
<inner xsi:type="xsd:string">An inner string extension value</inner>
<ext1:inner xsi:type="xsd:int">5</ext1:inner>
</ext0:object>
</ObjectEvent>
...
</EventList>
</resultsBody>
</ns2:queryResults>
</soapenv:Body>
</soapenv:Envelope>- Description: Subscribe events under given queries, periodically
- Request Body ( Type: application/xml ) - Register the subscription that notifies new 'ADD' events in every 5 seconds to a specific destination
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:query="urn:epcglobal:epcis-query:xsd:1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<query:Subscribe>
<queryName>SimpleEventQuery</queryName>
<params>
<param>
<name>EQ_action</name>
<value xsi:type="query:ArrayOfString">
<string>ADD</string>
</value>
</param>
</params>
<dest>http://localhost:8080/epcis/echo</dest>
<controls>
<schedule>
<second>0/5</second>
</schedule>
<initialRecordTime>2005-04-04T20:33:31.116-06:00</initialRecordTime>
<reportIfEmpty>true</reportIfEmpty>
</controls>
<subscriptionID>1</subscriptionID>
</query:Subscribe>
</soapenv:Body>
</soapenv:Envelope>- Response Status: 200 OK (Example)
- Response Body ( Type: application/xml )
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<query:SubscribeResult xmlns:query="urn:epcglobal:epcis-query:xsd:1"/>
</soapenv:Body>
</soapenv:Envelope>- Description: Subscribe events under given queries for each newly captured event
- Request Body ( Type: application/xml ) - Register the subscription that delivers a new 'Aggregation' event to a specific destination
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:query="urn:epcglobal:epcis-query:xsd:1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<query:Subscribe>
<queryName>SimpleEventQuery</queryName>
<params>
<param>
<name>eventType</name>
<value xsi:type="query:ArrayOfString">
<string>AggregationEvent</string>
</value>
</param>
</params>
<dest>http://localhost:8080/epcis/echo</dest>
<controls>
<trigger>my_trigger</trigger>
<initialRecordTime>2005-04-04T20:33:31.116-06:00</initialRecordTime>
</controls>
<subscriptionID>2</subscriptionID>
</query:Subscribe>
</soapenv:Body>
</soapenv:Envelope>- Response Status: 200 OK (Example)
- Response Body ( Type: application/xml )
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<query:SubscribeResult xmlns:query="urn:epcglobal:epcis-query:xsd:1"/>
</soapenv:Body>
</soapenv:Envelope>- Description: Get all the subscription identifiers
- Request Body ( Type: application/xml )
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:query="urn:epcglobal:epcis-query:xsd:1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<query:GetSubscriptionIDs>
<queryName>SimpleEventQuery</queryName>
</query:GetSubscriptionIDs>
</soapenv:Body>
</soapenv:Envelope>- Response Status: 200 OK (Example)
- Response Body ( Type: application/xml )
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<query:GetSubscriptionIDsResult xmlns:query="urn:epcglobal:epcis-query:xsd:1">
<string>1</string>
<string>2</string>
</query:GetSubscriptionIDsResult>
</soapenv:Body>
</soapenv:Envelope>- Description: Unsubscribe a given subscription
- Request Body ( Type: application/xml )
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:query="urn:epcglobal:epcis-query:xsd:1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<query:Unsubscribe>
<subscriptionID>1</subscriptionID>
</query:Unsubscribe>
</soapenv:Body>
</soapenv:Envelope>- Response Status: 200 OK (Example)
- Response Body ( Type: application/xml )
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<query:UnsubscribeResult xmlns:query="urn:epcglobal:epcis-query:xsd:1"/>
</soapenv:Body>
</soapenv:Envelope>