diff options
13 files changed, 468 insertions, 246 deletions
diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index 5e6ac8ad..5fe0d52d 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -55,7 +55,7 @@ <version>1.0.2-SNAPSHOT</version> <scope>compile</scope> </dependency> - <!-- build BKUApplet prior to BKUOnline --> + <!-- build BKUApplet prior to BKUOnline --> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUApplet</artifactId> @@ -67,15 +67,27 @@ <artifactId>STALService</artifactId> <version>1.0.2-SNAPSHOT</version> </dependency> - + <!-- TODO move at.buergerkarte.namespaces.cardchannel.service out from STALXService + | so that BKUOnline does not have to depend on STALXService + <dependency> + <groupId>at.gv.egiz</groupId> + <artifactId>STALXService</artifactId> + <version>1.0.2-SNAPSHOT</version> + </dependency--> <!-- - | see https://wsit.dev.java.net/issues/show_bug.cgi?id=970 + | see https://wsit.dev.java.net/issues/show_bug.cgi?id=970 --> <dependency> <groupId>com.sun.xml.ws</groupId> <artifactId>jaxws-rt</artifactId> - <version>2.1.4</version> - <!--scope>provided</scope--> + <version>2.1.5</version> + <!-- use JAX-WS RI with SJSXP instead of Woodstox --> + <exclusions> + <exclusion> + <groupId>woodstox</groupId> + <artifactId>wstx-asl</artifactId> + </exclusion> + </exclusions> <!-- conflict with SAAJ from java 6 ? <exclusions> <exclusion> <groupId>javax.xml.soap</groupId> <artifactId>saaj-api</artifactId> @@ -83,6 +95,12 @@ <groupId>com.sun.xml.messaging.saaj</groupId> <artifactId>saaj-impl</artifactId> </exclusion> </exclusions --> </dependency> + <!-- use JAX-WS RI with SJSXP instead of Woodstox --> + <dependency> + <artifactId>sjsxp</artifactId> + <groupId>com.sun.xml.stream</groupId> + <version>1.0.1</version> + </dependency> </dependencies> <properties> <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server> @@ -164,15 +182,16 @@ </execution> </executions> <configuration> - <target>2.0</target> <verbose>true</verbose> <bindingDirectory>${basedir}/src/main/custom-binding</bindingDirectory> <bindingFiles> <bindingFile>stalservice-custom.xml</bindingFile> - <bindingFile>staltypes-custom.xml</bindingFile> + <bindingFile>staltypes-custom.xml</bindingFile> + <bindingFile>cardchannel-custom.xml</bindingFile> </bindingFiles> <wsdlDirectory>${basedir}/src/main/webapp/WEB-INF/wsdl</wsdlDirectory> <wsdlFiles> + <wsdlFile>stal-service.wsdl</wsdlFile> <wsdlFile>stal.wsdl</wsdlFile> </wsdlFiles> <sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir> diff --git a/BKUOnline/src/main/custom-binding/cardchannel-custom.xml b/BKUOnline/src/main/custom-binding/cardchannel-custom.xml new file mode 100644 index 00000000..049a334f --- /dev/null +++ b/BKUOnline/src/main/custom-binding/cardchannel-custom.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2008 Federal Chancellery Austria and + Graz University of Technology + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- + Binding customization for STAL schema (stal.xsd) + Use JAXB version 2.1 which supports "schema component designator" (SCD, http://www.w3.org/TR/xmlschema-ref/) + + All request/response types are generated to at.gv.egiz.stal + and renamed (...Type suffix removed), + except for the base types of the modified implClasses ErrorResponse and SignRequest + + IMPORTANT: WHEN REGENERATING CLASSES MAKE SURE TO BACKUP MODIFIED IMPLCLASSES (ErrorResponse and SignRequest) +--> +<bindings xmlns='http://java.sun.com/xml/ns/jaxb' version='2.1' + xmlns:xs='http://www.w3.org/2001/XMLSchema' + xmlns:xjc='http://java.sun.com/xml/ns/jaxb/xjc' + xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' + schemaLocation='../webapp/WEB-INF/wsdl/CardChannel.xsd' + xsi:schemaLocation='http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd + http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd'> + + <!-- cannot use scd, CardChannel.xsd has no namespace?! --> + <schemaBindings> + <package name="at.buergerkarte.namespaces.cardchannel.service"/> + </schemaBindings> +</bindings> diff --git a/BKUOnline/src/main/custom-binding/staltypes-custom.xml b/BKUOnline/src/main/custom-binding/staltypes-custom.xml index 3e150363..2925fb91 100644 --- a/BKUOnline/src/main/custom-binding/staltypes-custom.xml +++ b/BKUOnline/src/main/custom-binding/staltypes-custom.xml @@ -27,7 +27,7 @@ --> <bindings xmlns='http://java.sun.com/xml/ns/jaxb' version='2.1' xmlns:xs='http://www.w3.org/2001/XMLSchema' - xmlns:stal="http://www.egiz.gv.at/stal" + xmlns:stal="http://www.egiz.gv.at/stal" xmlns:xjc='http://java.sun.com/xml/ns/jaxb/xjc' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java index 781e0832..7930c53a 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java @@ -67,13 +67,11 @@ public class BKURequestHandler extends SpringBKUServlet { return new String(os.toByteArray(), encoding); } + @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException { - log.debug("Got new request"); - String acceptLanguage = req.getHeader("Accept-Language"); - Locale locale = AcceptLanguage.getLocale(acceptLanguage); - log.debug("Accept-Language locale: " + locale); - + log.debug("Received new request"); + HttpSession session = req.getSession(false); if (session != null) { log.warn("Already a session with id: " + session.getId() @@ -95,6 +93,10 @@ public class BKURequestHandler extends SpringBKUServlet { log.debug("Using session id: " + session.getId()); } + String acceptLanguage = req.getHeader("Accept-Language"); + Locale locale = AcceptLanguage.getLocale(acceptLanguage); + log.debug("Accept-Language locale: " + locale); + HTTPBindingProcessor bindingProcessor; bindingProcessor = (HTTPBindingProcessor) getBindingProcessorManager() .createBindingProcessor(req.getRequestURL().toString(), @@ -185,6 +187,7 @@ public class BKURequestHandler extends SpringBKUServlet { dispatcher.forward(req, resp); } + @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException { doPost(req, resp); diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBroker.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBroker.java index d1fe045a..b77f7660 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBroker.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBroker.java @@ -22,6 +22,7 @@ import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.service.types.RequestType; import at.gv.egiz.stal.service.types.ResponseType; import java.util.List; +import javax.xml.bind.JAXBElement; /** * @@ -32,9 +33,9 @@ public interface STALRequestBroker extends STAL { public static final int ERR_4500 = 4500; public static final long DEFAULT_TIMEOUT_MS = 1000*60*5; //5mn - public List<RequestType> connect(); + public List<JAXBElement<? extends RequestType>> connect(); - public List<RequestType> nextRequest(List<ResponseType> response); + public List<JAXBElement<? extends RequestType>> nextRequest(List<JAXBElement<? extends ResponseType>> responses); public List<HashDataInput> getHashDataInput(); } diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java index 5e3a1a99..252327d3 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java @@ -25,6 +25,7 @@ import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; import at.gv.egiz.stal.service.types.InfoboxReadRequestType; +import at.gv.egiz.stal.service.types.ObjectFactory; import at.gv.egiz.stal.service.types.QuitRequestType; import at.gv.egiz.stal.service.types.RequestType; import at.gv.egiz.stal.service.types.ResponseType; @@ -34,6 +35,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Locale; +import javax.xml.bind.JAXBElement; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -52,14 +54,12 @@ public class STALRequestBrokerImpl implements STALRequestBroker { private static final Log log = LogFactory.getLog(STALRequestBrokerImpl.class); -// private boolean expectingResponse = false; + private ObjectFactory stalObjFactory = new ObjectFactory(); + private boolean interrupted = false; -// private final RequestsMonitor reqMon = new RequestsMonitor(); -// private final ResponsesMonitor respMon = new ResponsesMonitor(); - - protected ArrayList<RequestType> requests; - protected ArrayList<ResponseType> responses; + protected final ArrayList<JAXBElement<? extends RequestType>> requests; + protected final ArrayList<JAXBElement<? extends ResponseType>> responses; protected ArrayList<HashDataInput> hashDataInputs; @@ -69,8 +69,8 @@ public class STALRequestBrokerImpl implements STALRequestBroker { if (timeoutMillisec <= 0) timeoutMillisec = DEFAULT_TIMEOUT_MS; timeout = timeoutMillisec; - requests = new ArrayList<RequestType>(); - responses = new ArrayList<ResponseType>(); + requests = new ArrayList<JAXBElement<? extends RequestType>>(); + responses = new ArrayList<JAXBElement<? extends ResponseType>>(); hashDataInputs = new ArrayList<HashDataInput>(); } @@ -95,36 +95,39 @@ public class STALRequestBrokerImpl implements STALRequestBroker { requests.clear(); hashDataInputs.clear(); -// reqMon.produce(requests); -// reqMon.setHashDataInput(null); for (STALRequest stalRequest : stalRequests) { if (stalRequest instanceof SignRequest) { log.trace("Received SignRequest, keep HashDataInput."); - SignRequestType req = new SignRequestType(); - req.setKeyIdentifier(((SignRequest) stalRequest).getKeyIdentifier()); - req.setSignedInfo(((SignRequest) stalRequest).getSignedInfo()); + SignRequestType reqT = stalObjFactory.createSignRequestType(); + reqT.setKeyIdentifier(((SignRequest) stalRequest).getKeyIdentifier()); + reqT.setSignedInfo(((SignRequest) stalRequest).getSignedInfo()); + JAXBElement<SignRequestType> req = stalObjFactory.createGetNextRequestResponseTypeSignRequest(reqT); requests.add(req); //DataObjectHashDataInput with reference caching enabled DataObject hashDataInputs.addAll(((SignRequest) stalRequest).getHashDataInput()); break; } else if (stalRequest instanceof InfoboxReadRequest) { log.trace("Received InfoboxReadRequest"); - InfoboxReadRequestType req = new InfoboxReadRequestType(); - req.setInfoboxIdentifier(((InfoboxReadRequest) stalRequest).getInfoboxIdentifier()); - req.setDomainIdentifier(((InfoboxReadRequest) stalRequest).getDomainIdentifier()); + InfoboxReadRequestType reqT = new InfoboxReadRequestType(); + reqT.setInfoboxIdentifier(((InfoboxReadRequest) stalRequest).getInfoboxIdentifier()); + reqT.setDomainIdentifier(((InfoboxReadRequest) stalRequest).getDomainIdentifier()); + JAXBElement<InfoboxReadRequestType> req = stalObjFactory.createGetNextRequestResponseTypeInfoboxReadRequest(reqT); requests.add(req); } else if (stalRequest instanceof QuitRequest) { log.trace("Received QuitRequest, do not wait for responses."); - requests.add(new QuitRequestType()); + QuitRequestType reqT = stalObjFactory.createQuitRequestType(); + JAXBElement<QuitRequestType> req = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(reqT); + requests.add(req); log.trace("notifying request consumers"); requests.notify(); -// reqMon.notify(); return new ArrayList<STALResponse>(); } else { log.error("Received unsupported STAL request: " + stalRequest.getClass().getName() + ", send QUIT"); requests.clear(); - requests.add(new QuitRequestType()); + QuitRequestType reqT = stalObjFactory.createQuitRequestType(); + JAXBElement<QuitRequestType> req = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(reqT); + requests.add(req); log.trace("notifying request consumers"); requests.notify(); return new ArrayList<STALResponse>(); @@ -132,32 +135,25 @@ public class STALRequestBrokerImpl implements STALRequestBroker { } log.trace("notifying request consumers"); requests.notify(); -// reqMon.notify(); } - synchronized (responses) { //respMon) { + synchronized (responses) { long beforeWait = System.currentTimeMillis(); -// while (respMon.responses == null) { while (responses.isEmpty()) { log.trace("waiting to consume response"); -// respMon.wait(timeout); responses.wait(timeout); if (System.currentTimeMillis() - beforeWait >= timeout) { log.warn("timeout while waiting to consume response, cleanup requests"); -// reqMon.consume(); //TODO check deadlock? -// reqMon.setHashDataInput(null); - requests.clear(); //TODO sync on requests? + requests.clear(); hashDataInputs.clear(); return Collections.singletonList((STALResponse) new ErrorResponse(ERR_4500)); } } log.trace("consuming responses"); -// List<STALResponse> responses = respMon.consume(); List<STALResponse> resps = STALTranslator.toSTAL(responses); responses.clear(); log.trace("notifying response producers"); responses.notify(); -// respMon.notify(); return resps; } @@ -169,7 +165,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker { } @Override - public List<RequestType> connect() { + public List<JAXBElement<? extends RequestType>> connect() { if (interrupted) { return null; } @@ -181,15 +177,9 @@ public class STALRequestBrokerImpl implements STALRequestBroker { requests.wait(timeout); if (System.currentTimeMillis() - beforeWait >= timeout) { log.warn("timeout while waiting to consume request"); - return Collections.singletonList((RequestType) new QuitRequestType()); + return createSingleQuitRequest(); } } - -// log.trace("consume request"); -// List<RequestType> reqs = new ArrayList<RequestType>(); -// reqs.addAll(requests); -// requests.clear(); -// return reqs; log.trace("don't consume request now, leave for further connect calls"); return requests; } @@ -212,7 +202,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker { * @return QUIT if expected responses are not provided */ @Override - public List<RequestType> nextRequest(List<ResponseType> resps) { + public List<JAXBElement<? extends RequestType>> nextRequest(List<JAXBElement<? extends ResponseType>> resps) { if (interrupted) { return null; } @@ -227,69 +217,43 @@ public class STALRequestBrokerImpl implements STALRequestBroker { } } - synchronized (responses) { //respMon) { + synchronized (responses) { if (resps != null && resps.size() > 0) { -// if (!expectingResponse) { -// log.warn("Received unexpected response in nextRequest(), return QUIT"); -// return Collections.singletonList((RequestType) new QuitRequestType()); -// } long beforeWait = System.currentTimeMillis(); -// while (respMon.responses != null) { while (!responses.isEmpty()) { log.trace("waiting to produce response"); -// respMon.wait(timeout); responses.wait(timeout); if (System.currentTimeMillis() - beforeWait >= timeout) { log.warn("timeout while waiting to produce response"); - return Collections.singletonList((RequestType) new QuitRequestType()); + return createSingleQuitRequest(); } } log.trace("produce response"); -// respMon.produce(resps); responses.addAll(resps); //reset HashDataInputCallback iff SignResponse if (log.isTraceEnabled()) { - for (ResponseType response : resps) { - log.trace("Received STAL response: " + response.getClass().getName()); + for (JAXBElement<? extends ResponseType> response : resps) { + log.trace("Received STAL response: " + response.getValue().getClass().getName()); } } log.trace("notifying response consumers"); -// respMon.notify(); responses.notify(); } else { -// if (expectingResponse) { -// log.warn("Did not receive expected response(s) in nextRequest(), return QUIT"); -// return Collections.singletonList((RequestType) new QuitRequestType()); -// } -// log.trace("expecting non-null response in next nextRequest(response)"); -// expectingResponse = true; log.error("Received NextRequest without responses, return QUIT"); - return Collections.singletonList((RequestType) new QuitRequestType()); + return createSingleQuitRequest(); } } - synchronized (requests) { //reqMon) { + synchronized (requests) { long beforeWait = System.currentTimeMillis(); -// while (reqMon.requests == null) { while (requests.isEmpty()) { log.trace("waiting to consume request"); -// reqMon.wait(timeout); requests.wait(timeout); if (System.currentTimeMillis() - beforeWait >= timeout) { log.warn("timeout while waiting to consume request"); - return Collections.singletonList((RequestType) new QuitRequestType()); + return createSingleQuitRequest(); } } -// log.trace("consume request"); -// List<RequestType> reqs = new ArrayList<RequestType>(); // reqMon.consume(); -// reqs.addAll(requests); -// -//// if (requests.size() > 0 && requests.get(0) instanceof QuitRequestType) { -//// log.trace("expecting no response in next nextRequest()"); -//// expectingResponse = false; -//// } -// requests.clear(); -// return reqs; log.trace("don't consume request now, but on next response delivery"); return requests; } @@ -304,92 +268,19 @@ public class STALRequestBrokerImpl implements STALRequestBroker { public List<HashDataInput> getHashDataInput() { synchronized (requests) { log.trace("return " + hashDataInputs.size() + " current HashDataInput(s) "); - return hashDataInputs; //reqMon.getHashDataInput(); + return hashDataInputs; } } @Override public void setLocale(Locale locale) { } - -// class RequestsMonitor { -// List<STALRequest> requests; -// List<HashDataInput> hashDataInput; -// -// void produce(List<STALRequest> req) { -// requests = req; -// } -// -// synchronized List<at.gv.egiz.stal.service.types.STALRequest> consume() { -// List<at.gv.egiz.stal.service.types.STALRequest> reqs = new ArrayList<at.gv.egiz.stal.service.types.STALRequest>(); -// for (STALRequest request : requests) { -// if (request instanceof SignRequest) { -// at.gv.egiz.stal.service.types.SignRequest r = new at.gv.egiz.stal.service.types.SignRequest(); -// r.setKeyIdentifier(((SignRequest) request).getKeyIdentifier()); -// r.setSignedInfo(((SignRequest) request).getSignedInfo()); -// reqs.add(r); -// } else if (request instanceof InfoboxReadRequest) { -// at.gv.egiz.stal.service.types.InfoboxReadRequest r = new at.gv.egiz.stal.service.types.InfoboxReadRequest(); -// r.setDomainIdentifier(((InfoboxReadRequest) request).getDomainIdentifier()); -// r.setInfoboxIdentifier(((InfoboxReadRequest) request).getInfoboxIdentifier()); -// reqs.add(r); -// } else if (request instanceof QuitRequest) { -// at.gv.egiz.stal.service.types.QuitRequest r = new at.gv.egiz.stal.service.types.QuitRequest(); -// reqs.add(r); -// } else { -// log.error("unknown STAL request type: " + request.getClass()); -// requests = null; -// return Collections.singletonList((at.gv.egiz.stal.service.types.STALRequest) new at.gv.egiz.stal.service.types.QuitRequest()); -// } -// } -// requests = null; -// return reqs; -// } -// -// void setHashDataInput(List<HashDataInput> hdi) { -// hashDataInput = hdi; -// } -// -// List<HashDataInput> getHashDataInput() { -// return hashDataInput; -// } -// } -// -// /** TODO: now, that responses are not nulled, synchronize directly on responses? */ -// class ResponsesMonitor { -// List<at.gv.egiz.stal.service.types.STALResponse> responses; -// -// void produce(List<at.gv.egiz.stal.service.types.STALResponse> resp) { -// responses = resp; -// } -// -// synchronized List<STALResponse> consume() { -// List<STALResponse> resps = new ArrayList<STALResponse>(); -// -// for (at.gv.egiz.stal.service.types.STALResponse response : responses) { -// if (response instanceof at.gv.egiz.stal.service.types.InfoboxReadResponse) { -// InfoboxReadResponse r = new InfoboxReadResponse(); -// r.setInfoboxValue(((at.gv.egiz.stal.service.types.InfoboxReadResponse) response).getInfoboxValue()); -// resps.add(r); -// } else if (response instanceof at.gv.egiz.stal.service.types.SignResponse) { -// SignResponse r = new SignResponse(); -// r.setSignatureValue(((at.gv.egiz.stal.service.types.SignResponse) response).getSignatureValue()); -// resps.add(r); -// } else if (response instanceof at.gv.egiz.stal.service.types.ErrorResponse) { -// ErrorResponse r = new ErrorResponse(); -// r.setErrorCode(((at.gv.egiz.stal.service.types.ErrorResponse) response).getErrorCode()); -// r.setErrorMessage(((at.gv.egiz.stal.service.types.ErrorResponse) response).getErrorMessage()); -// resps.add(r); -// } else { -// log.error("unknown STAL response type: " + response.getClass()); -// ErrorResponse r = new ErrorResponse(4000); -// r.setErrorMessage("unknown STAL response type: " + response.getClass()); -// responses = null; -// return Collections.singletonList((STALResponse) r); -// } -// } -// responses = null; -// return resps; -// } -// } + + private List<JAXBElement<? extends RequestType>> createSingleQuitRequest() { + QuitRequestType quitT = stalObjFactory.createQuitRequestType(); + JAXBElement<QuitRequestType> quit = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT); + ArrayList<JAXBElement<? extends RequestType>> l = new ArrayList<JAXBElement<? extends RequestType>>(); + l.add(quit); + return l; + } } diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java index 05a3f5e5..45629869 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java @@ -14,9 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package at.gv.egiz.stal.service.impl; +//import at.buergerkarte.namespaces.cardchannel.service.CommandAPDUType; +//import at.buergerkarte.namespaces.cardchannel.service.ScriptType; import at.gv.egiz.bku.binding.BindingProcessor; import at.gv.egiz.bku.binding.BindingProcessorManager; import at.gv.egiz.bku.binding.Id; @@ -36,6 +37,7 @@ import at.gv.egiz.stal.service.types.QuitRequestType; import at.gv.egiz.stal.service.types.RequestType; import at.gv.egiz.stal.service.types.ResponseType; import at.gv.egiz.stal.service.types.SignRequestType; +import com.sun.xml.ws.developer.UsesJAXBContext; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -46,6 +48,7 @@ import java.util.Map; import javax.annotation.Resource; import javax.jws.WebService; import javax.servlet.ServletContext; +import javax.xml.bind.JAXBElement; import javax.xml.ws.WebServiceContext; import javax.xml.ws.handler.MessageContext; import org.apache.commons.logging.Log; @@ -56,46 +59,45 @@ import org.apache.commons.logging.LogFactory; * @author clemens */ @WebService(endpointInterface = "at.gv.egiz.stal.service.STALPortType") +@UsesJAXBContext(STALXJAXBContextFactory.class) public class STALServiceImpl implements STALPortType { public static final String BINDING_PROCESSOR_MANAGER = "bindingProcessorManager"; public static final Id TEST_SESSION_ID = IdFactory.getInstance().createId("TestSession"); - protected static final Log log = LogFactory.getLog(STALServiceImpl.class); - + + static { - if (log.isTraceEnabled()) { log.trace("enabling webservice communication dump"); System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true"); } else { System.setProperty("com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace", "false"); } - } - @Resource - WebServiceContext wsContext; + protected WebServiceContext wsContext; protected IdFactory idF = IdFactory.getInstance(); + private at.gv.egiz.stal.service.types.ObjectFactory stalObjFactory = new at.gv.egiz.stal.service.types.ObjectFactory(); +// private at.buergerkarte.namespaces.cardchannel.service.ObjectFactory ccObjFactory = new at.buergerkarte.namespaces.cardchannel.service.ObjectFactory(); - @Override public GetNextRequestResponseType connect(String sessId) { - + if (sessId == null) { throw new NullPointerException("No session id provided"); } - + Id sessionId = idF.createId(sessId); if (log.isDebugEnabled()) { log.debug("Received Connect [" + sessionId + "]"); } - + if (TEST_SESSION_ID.equals(sessionId)) { return getTestSessionNextRequestResponse(null); } - + GetNextRequestResponseType response = new GetNextRequestResponseType(); response.setSessionId(sessionId.toString()); @@ -103,7 +105,7 @@ public class STALServiceImpl implements STALPortType { if (stal != null) { - List<RequestType> requestsOut = ((STALRequestBroker) stal).connect(); + List<JAXBElement<? extends RequestType>> requestsOut = ((STALRequestBroker) stal).connect(); response.getInfoboxReadRequestOrSignRequestOrQuitRequest().addAll(requestsOut); if (log.isDebugEnabled()) { @@ -112,29 +114,32 @@ public class STALServiceImpl implements STALPortType { sb.append("] containing "); sb.append(requestsOut.size()); sb.append(" requests: "); - for (RequestType reqOut : requestsOut) { - sb.append(reqOut.getClass()); + for (JAXBElement<? extends RequestType> reqOut : requestsOut) { + sb.append(reqOut.getValue().getClass()); sb.append(' '); } log.debug(sb.toString()); } } else { log.error("Failed to get STAL for session " + sessionId + ", returning QuitRequest"); - response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(new QuitRequestType()); + QuitRequestType quitT = stalObjFactory.createQuitRequestType(); + JAXBElement<QuitRequestType> quit = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT); + response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(quit); } return response; } - + @Override public GetNextRequestResponseType getNextRequest(GetNextRequestType request) { if (request.getSessionId() == null) { throw new NullPointerException("No session id provided"); } - + Id sessionId = idF.createId(request.getSessionId()); - List<ResponseType> responsesIn = request.getInfoboxReadResponseOrSignResponseOrErrorResponse();//getResponse(); + List<JAXBElement<? extends ResponseType>> responsesIn = request.getInfoboxReadResponseOrSignResponseOrErrorResponse(); +// List<ResponseType> responsesIn = request.getInfoboxReadResponseOrSignResponseOrErrorResponse();//getResponse(); if (log.isDebugEnabled()) { StringBuilder sb = new StringBuilder("Received GetNextRequest ["); @@ -142,25 +147,25 @@ public class STALServiceImpl implements STALPortType { sb.append("] containing "); sb.append(responsesIn.size()); sb.append(" responses: "); - for (ResponseType respIn : responsesIn) { + for (Object respIn : responsesIn) { sb.append(respIn.getClass()); sb.append(' '); } log.debug(sb.toString()); } - + if (TEST_SESSION_ID.equals(sessionId)) { return getTestSessionNextRequestResponse(responsesIn); } GetNextRequestResponseType response = new GetNextRequestResponseType(); response.setSessionId(sessionId.toString()); - + STALRequestBroker stal = getStal(sessionId); if (stal != null) { - List<RequestType> requestsOut = ((STALRequestBroker) stal).nextRequest(responsesIn); + List<JAXBElement<? extends RequestType>> requestsOut = ((STALRequestBroker) stal).nextRequest(responsesIn); response.getInfoboxReadRequestOrSignRequestOrQuitRequest().addAll(requestsOut); if (log.isDebugEnabled()) { @@ -169,15 +174,17 @@ public class STALServiceImpl implements STALPortType { sb.append("] containing "); sb.append(requestsOut.size()); sb.append(" requests: "); - for (RequestType reqOut : requestsOut) { - sb.append(reqOut.getClass()); + for (JAXBElement<? extends RequestType> reqOut : requestsOut) { + sb.append(reqOut.getValue().getClass()); sb.append(' '); } log.debug(sb.toString()); } } else { log.error("Failed to get STAL for session " + sessionId + ", returning QuitRequest"); - response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(new QuitRequestType()); + QuitRequestType quitT = stalObjFactory.createQuitRequestType(); + JAXBElement<QuitRequestType> quit = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT); + response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(quit); } return response; } @@ -188,7 +195,7 @@ public class STALServiceImpl implements STALPortType { if (request.getSessionId() == null) { throw new NullPointerException("No session id provided"); } - + Id sessionId = idF.createId(request.getSessionId()); if (log.isDebugEnabled()) { @@ -197,13 +204,13 @@ public class STALServiceImpl implements STALPortType { GetHashDataInputResponseType response = new GetHashDataInputResponseType(); response.setSessionId(sessionId.toString()); - + if (TEST_SESSION_ID.equals(sessionId)) { log.debug("Received GetHashDataInput for session " + TEST_SESSION_ID + ", return DummyHashDataInput"); GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference(); ref.setID("signed-data-reference-0-1214921968-27971781-24309"); //Reference-" + TEST_SESSION_ID + "-001"); ref.setMimeType("text/plain"); - + Charset charset; try { charset = Charset.forName("iso-8859-15"); @@ -316,30 +323,52 @@ public class STALServiceImpl implements STALPortType { return (bp == null) ? null : (bp.isFinished() ? null : (STALRequestBroker) bp.getSTAL()); } - private GetNextRequestResponseType getTestSessionNextRequestResponse(List<ResponseType> responsesIn) { + private GetNextRequestResponseType getTestSessionNextRequestResponse(List<JAXBElement<? extends ResponseType>> responsesIn) { GetNextRequestResponseType response = new GetNextRequestResponseType(); response.setSessionId(TEST_SESSION_ID.toString()); - - if (responsesIn != null && responsesIn.size() > 0 && responsesIn.get(0) instanceof ErrorResponseType) { - log.info("Received TestSession GetNextRequest(ErrorResponse), returning QuitRequest"); - response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(new QuitRequestType()); + + List<JAXBElement<? extends RequestType>> reqs = response.getInfoboxReadRequestOrSignRequestOrQuitRequest(); + + if (responsesIn == null) { + log.info("[TestSession] received CONNECT, return dummy requests "); +// ScriptType scriptT = ccObjFactory.createScriptType(); +// CommandAPDUType cmd = ccObjFactory.createCommandAPDUType(); +// cmd.setValue("TestSession CardChannelCMD 1234".getBytes()); +// scriptT.getResetOrCommandAPDUOrVerifyAPDU().add(cmd); +// reqs.add(ccObjFactory.createScript(scriptT)); + addDummyRequests(reqs); + } else if (responsesIn != null && responsesIn.size() > 0 && responsesIn.get(0).getValue() instanceof ErrorResponseType) { + log.info("[TestSession] received ErrorResponse, return QUIT request"); + QuitRequestType quitT = stalObjFactory.createQuitRequestType(); + reqs.add(stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT)); } else { - log.info("Received TestSession GetNextRequest, returning SignRequest and 3 InfoboxReadRequests "); - InfoboxReadRequestType req = new InfoboxReadRequestType(); - req.setInfoboxIdentifier("IdentityLink"); - req.setDomainIdentifier("hansiwurzel"); - response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(req); - SignRequestType sig = new SignRequestType(); - sig.setKeyIdentifier("SecureSignatureKeypair"); - sig.setSignedInfo("<dsig:SignedInfo xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\"><dsig:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /> <dsig:SignatureMethod Algorithm=\"http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1\" /> <dsig:Reference Id=\"signed-data-reference-0-1214921968-27971781-24309\" URI=\"#signed-data-object-0-1214921968-27971781-13578\"><dsig:Transforms> <dsig:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\"> <xpf:XPath xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">id('signed-data-object-0-1214921968-27971781-13578')/node()</xpf:XPath></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /> <dsig:DigestValue>H1IePEEfGQ2SG03H6LTzw1TpCuM=</dsig:DigestValue></dsig:Reference><dsig:Reference Id=\"etsi-data-reference-0-1214921968-27971781-25439\" Type=\"http://uri.etsi.org/01903/v1.1.1#SignedProperties\" URI=\"#xmlns(etsi=http://uri.etsi.org/01903/v1.1.1%23)%20xpointer(id('etsi-data-object-0-1214921968-27971781-3095')/child::etsi:QualifyingProperties/child::etsi:SignedProperties)\"><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><dsig:DigestValue>yV6Q+I60buqR4mMaxA7fi+CV35A=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo>".getBytes()); - response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(sig); - req = new InfoboxReadRequestType(); - req.setInfoboxIdentifier("CertifiedKeypair"); - response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(req); - req = new InfoboxReadRequestType(); - req.setInfoboxIdentifier("SecureSignatureKeypair"); - response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(req); + log.info("[TestSession] received " + responsesIn.size() + " response(s), return dummy requests" ); + addDummyRequests(reqs); } return response; } + + private void addDummyRequests(List<JAXBElement<? extends RequestType>> reqs) { +// log.info("[TestSession] add READ request for Infobox IdentityLink"); +// InfoboxReadRequestType ibrT1 = stalObjFactory.createInfoboxReadRequestType(); +// ibrT1.setInfoboxIdentifier("IdentityLink"); +// reqs.add(stalObjFactory.createGetNextRequestResponseTypeInfoboxReadRequest(ibrT1)); + + log.info("[TestSession] add READ request for Infobox CertifiedKeypair"); + InfoboxReadRequestType ibrT2 = stalObjFactory.createInfoboxReadRequestType(); + ibrT2.setInfoboxIdentifier("CertifiedKeypair"); + reqs.add(stalObjFactory.createGetNextRequestResponseTypeInfoboxReadRequest(ibrT2)); + + log.info("[TestSession] add READ request for Infobox SecureSignatureKeypair"); + InfoboxReadRequestType ibrT3 = stalObjFactory.createInfoboxReadRequestType(); + ibrT3.setInfoboxIdentifier("SecureSignatureKeypair"); + reqs.add(stalObjFactory.createGetNextRequestResponseTypeInfoboxReadRequest(ibrT3)); + + log.info("[TestSession] add SIGN request"); + SignRequestType sigT1 = stalObjFactory.createSignRequestType(); + sigT1.setKeyIdentifier("SecureSignatureKeypair"); + sigT1.setSignedInfo("<dsig:SignedInfo xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\"><dsig:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /> <dsig:SignatureMethod Algorithm=\"http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1\" /> <dsig:Reference Id=\"signed-data-reference-0-1214921968-27971781-24309\" URI=\"#signed-data-object-0-1214921968-27971781-13578\"><dsig:Transforms> <dsig:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\"> <xpf:XPath xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">id('signed-data-object-0-1214921968-27971781-13578')/node()</xpf:XPath></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /> <dsig:DigestValue>H1IePEEfGQ2SG03H6LTzw1TpCuM=</dsig:DigestValue></dsig:Reference><dsig:Reference Id=\"etsi-data-reference-0-1214921968-27971781-25439\" Type=\"http://uri.etsi.org/01903/v1.1.1#SignedProperties\" URI=\"#xmlns(etsi=http://uri.etsi.org/01903/v1.1.1%23)%20xpointer(id('etsi-data-object-0-1214921968-27971781-3095')/child::etsi:QualifyingProperties/child::etsi:SignedProperties)\"><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><dsig:DigestValue>yV6Q+I60buqR4mMaxA7fi+CV35A=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo>".getBytes()); + reqs.add(stalObjFactory.createGetNextRequestResponseTypeSignRequest(sigT1)); + } + } diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java new file mode 100644 index 00000000..92559254 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java @@ -0,0 +1,61 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.stal.service.impl; + +import com.sun.xml.bind.api.JAXBRIContext; +import com.sun.xml.bind.api.TypeReference; +import com.sun.xml.ws.api.model.SEIModel; +import com.sun.xml.ws.developer.JAXBContextFactory; +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.JAXBException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> + */ +public class STALXJAXBContextFactory implements JAXBContextFactory { + + private static final Log log = LogFactory.getLog(STALXJAXBContextFactory.class); + + @Override + public JAXBRIContext createJAXBContext(SEIModel sei, List<Class> classesToBind, List<TypeReference> typeReferences) throws JAXBException { + if (log.isTraceEnabled()) { + log.trace("JAXBContext seed for SEI " + sei.getTargetNamespace() + ":"); + for (Class class1 : classesToBind) { + log.trace(" " + class1); + } + for (TypeReference typeReference : typeReferences) { + log.trace(" typeRef " + typeReference.tagName + " -> " + typeReference.type); + } + } + List<Class> classes = new ArrayList<Class>(); + classes.addAll(classesToBind); +// Class ccOF = at.buergerkarte.namespaces.cardchannel.service.ObjectFactory.class; +// if (!classes.contains(ccOF)) { +// log.debug("adding " + ccOF + " to JAXBContext seed"); +// classes.add(ccOF); +// } + + //TODO add typeReference? + + return JAXBRIContext.newInstance(classes.toArray(new Class[classes.size()]), + typeReferences, null, sei.getTargetNamespace(), false, null); + } +} diff --git a/BKUOnline/src/main/webapp/WEB-INF/wsdl/CardChannel.xsd b/BKUOnline/src/main/webapp/WEB-INF/wsdl/CardChannel.xsd new file mode 100644 index 00000000..4aff264b --- /dev/null +++ b/BKUOnline/src/main/webapp/WEB-INF/wsdl/CardChannel.xsd @@ -0,0 +1,148 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.buergerkarte.at/cardchannel" + xmlns:tns="http://www.buergerkarte.at/cardchannel" + elementFormDefault="qualified" + xmlns:stal="http://www.egiz.gv.at/stal"> + + <xs:import namespace="http://www.egiz.gv.at/stal" schemaLocation="stal-extended.xsd"/> + + <xs:annotation> + <xs:documentation>Schema for transparent access to cards using a BKU and the CardChannel + infobox</xs:documentation> + </xs:annotation> + + <xs:element name="Script" type="tns:ScriptType" substitutionGroup="stal:OtherRequest"/> + <xs:element name="Response" type="tns:ResponseType" substitutionGroup="stal:OtherResponse"/> + <xs:element name="Grunddaten" type="tns:AttributeList"/> + <xs:element name="EHIC" type="tns:AttributeList"/> + <xs:element name="Status" type="tns:AttributeList"/> + <xs:element name="SV-Personenbindung" type="xs:hexBinary"/> + + <xs:complexType name="ScriptType"> + <xs:annotation> + <xs:documentation>extends abstract stal:RequestType</xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="stal:RequestType"> + <xs:annotation> + <xs:documentation>Contains the script to be executed by the BKU</xs:documentation> + </xs:annotation> + <xs:choice maxOccurs="unbounded" minOccurs="1"> + <xs:element name="Reset" type="tns:ResetType"/> + <xs:element name="CommandAPDU" type="tns:CommandAPDUType"/> + <xs:element name="VerifyAPDU" type="tns:VerifyAPDUType"/> + </xs:choice> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="ResponseType"> + <xs:annotation> + <xs:documentation>extends abstract stal:ResponseType</xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="stal:ResponseType"> + <xs:annotation> + <xs:documentation>Contains the result of the script executed by the + BKU</xs:documentation> + </xs:annotation> + <xs:choice maxOccurs="unbounded" minOccurs="1"> + <xs:element name="ATR" type="tns:ATRType"/> + <xs:element name="ResponseAPDU" type="tns:ResponseAPDUType"/> + </xs:choice> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="ResetType"> + <xs:annotation> + <xs:documentation>Reset the icc and sequence counter</xs:documentation> + </xs:annotation> + <xs:attribute name="cold" type="xs:boolean" default="true"/> + </xs:complexType> + + <xs:complexType name="CommandAPDUType"> + <xs:annotation> + <xs:documentation>Contains a sequence of bytes send as command APDU to the + icc</xs:documentation> + </xs:annotation> + <xs:simpleContent> + <xs:extension base="xs:hexBinary"> + <xs:attribute name="sequence" type="xs:positiveInteger" use="required"/> + <xs:attribute name="of" type="xs:positiveInteger" use="required"/> + <xs:attribute name="expectedSW" type="xs:hexBinary"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + + <xs:complexType name="VerifyAPDUType"> + <xs:annotation> + <xs:documentation>Contains a sequence of bytes send as command APDU to the icc after a + PIN entered by the user has been incorporated into the APDU</xs:documentation> + </xs:annotation> + <xs:simpleContent> + <xs:extension base="xs:hexBinary"> + <xs:attribute name="sequence" type="xs:positiveInteger" use="required"/> + <xs:attribute name="of" type="xs:positiveInteger" use="required"/> + <xs:attribute name="expectedSW" type="xs:hexBinary"/> + <xs:attribute name="message" type="xs:string" use="required"/> + <xs:attribute name="format" type="xs:hexBinary" use="required"/> + <xs:attribute name="offset" type="xs:nonNegativeInteger" use="required"/> + <xs:attribute name="timeout" type="xs:nonNegativeInteger" use="required"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + + <xs:complexType name="ATRType"> + <xs:annotation> + <xs:documentation>Contains the ATR received as reponse to a Reset + command</xs:documentation> + </xs:annotation> + <xs:simpleContent> + <xs:extension base="xs:hexBinary"> + <xs:attribute name="rc" type="xs:integer" default="0"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + + <xs:complexType name="ResponseAPDUType"> + <xs:annotation> + <xs:documentation>Contains a sequence of bytes received from the card as response + APDU</xs:documentation> + </xs:annotation> + <xs:simpleContent> + <xs:extension base="xs:hexBinary"> + <xs:attribute name="sequence" type="xs:positiveInteger" use="required"/> + <xs:attribute name="rc" type="xs:integer" default="0"/> + <xs:attribute name="SW" type="xs:hexBinary" default="9000"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + + <xs:complexType name="AttributeList"> + <xs:annotation> + <xs:documentation>Contains a list of attributes</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="Attribute" type="tns:AttributeType" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="AttributeType"> + <xs:annotation> + <xs:documentation>Contains an attribute converted from ASN.1</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="Integer" type="xs:integer" minOccurs="0" maxOccurs="1"/> + <xs:element name="Latin1String" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="UTF8String" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="NumericString" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="PrintableString" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="GeneralizedTime" type="xs:dateTime" minOccurs="0" maxOccurs="1"/> + <xs:element name="Date" type="xs:string" minOccurs="0" maxOccurs="1"/> + </xs:sequence> + <xs:attribute name="oid" type="xs:string" use="required"/> + </xs:complexType> + +</xs:schema> diff --git a/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.wsdl b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.wsdl index 344e5ce2..9ef43f39 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.wsdl +++ b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.wsdl @@ -18,29 +18,37 @@ <definitions name="stal" targetNamespace="http://www.egiz.gv.at/wsdl/stal" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.egiz.gv.at/wsdl/stal" xmlns:ns="http://www.egiz.gv.at/stal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:tns="http://www.egiz.gv.at/wsdl/stal" + xmlns:stal="http://www.egiz.gv.at/stal" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <types> <xsd:schema targetNamespace="http://www.egiz.gv.at/wsdl/stal"> - <xsd:import namespace="http://www.egiz.gv.at/stal" schemaLocation="stal.xsd"/> + <xsd:import namespace="http://www.egiz.gv.at/stal" schemaLocation="stal-service.xsd"/> + <!--xsd:import namespace="http://www.egiz.gv.at/stal" schemaLocation="stal-extended.xsd"/--> </xsd:schema> + <!-- test + <xsd:schema targetNamespace="http://www.egiz.gv.at/wsdl/stal-extended"> + <xsd:import namespace="http://www.buergerkarte.at/cardchannel" schemaLocation="CardChannel.xsd"/> + </xsd:schema--> </types> <message name="ConnectRequest"> - <part name="part1" element="ns:SessionId"/> + <part name="part1" element="stal:SessionId"/> </message> <message name="NextRequestRequest"> - <part name="part1" element="ns:GetNextRequest"/> + <part name="part1" element="stal:GetNextRequest"/> </message> <message name="NextRequestResponse"> - <part name="part1" element="ns:GetNextRequestResponse"/> + <part name="part1" element="stal:GetNextRequestResponse"/> </message> <message name="GetHashDataInputRequest"> - <part name="part1" element="ns:GetHashDataInput"/> + <part name="part1" element="stal:GetHashDataInput"/> </message> <message name="GetHashDataInputResponse"> - <part name="part1" element="ns:GetHashDataInputResponse"/> + <part name="part1" element="stal:GetHashDataInputResponse"/> </message> <message name="GetHashDataInputFault"> - <part name="part1" element="ns:GetHashDataInputFault"/> + <part name="part1" element="stal:GetHashDataInputFault"/> </message> <portType name="STALPortType"> <operation name="connect"> diff --git a/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd index 761b5556..6f3946dc 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd +++ b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd @@ -74,7 +74,6 @@ <element name="InfoboxReadRequest" type="tns:InfoboxReadRequestType"/> <element name="SignRequest" type="tns:SignRequestType"/> <element name="QuitRequest" type="tns:QuitRequestType"/> - <!--any namespace="##other" /--> </choice> <attribute name="SessionId" type="string"/> </complexType> diff --git a/BKUOnline/src/main/webapp/helpfiles/de/error.pcsc.html b/BKUOnline/src/main/webapp/helpfiles/de/error.pcsc.html index 209ae6fa..d38e77ca 100644 --- a/BKUOnline/src/main/webapp/helpfiles/de/error.pcsc.html +++ b/BKUOnline/src/main/webapp/helpfiles/de/error.pcsc.html @@ -26,8 +26,18 @@ <!-- end #sidebar1 --></div> <div id="mainContent"> <h1> Fehler: Es konnte keine PC/SC-Schnittstelle gefunden werden</h1> - <p>Die Software für den Zugriff auf die Bürgerkarte konnte keine PC/SC-Schnittstelle für den Zugriff auf Kartenleser erkennen. Das Betriebssystem scheint keine PC/SC-Schnittstelle zur Verfügung zu stellen.</p> - <p>Unter Betriebssystemen die PCSC-Lite verwenden (Linux u.a.) tritt dieses Problem auch auf, wenn kein Kartenleser angeschlossen ist und daher der entsprechende Dienst nicht gestartet wurde oder wenn die entsprechende Bibliothek nicht zur Verfügung steht (<a href="http://java.sun.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunPCSCProvider">weitere Informationen</a>).<br class="clearfloat" /> + <p>Die Software für den Zugriff auf die Bürgerkarte konnte keine PC/SC-Schnittstelle für den Zugriff auf Kartenleser erkennen. + Das Betriebssystem scheint keine PC/SC-Schnittstelle zur Verfügung zu stellen.</p> + <p>Häufige Ursachen für dieses Problem sind + <ul> + <li>Der PC/SC Dienst läuft nicht</li> + <li>Die entsprechende PC/SC Bibliothek kann von Java nicht gefunden werden + (<a href="http://java.sun.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunPCSCProvider">weitere Informationen</a>).</li> + </ul> + </p> + <p>Unter Betriebssystemen die PCSC-Lite verwenden (Linux u.a.) tritt dieses Problem auch auf, + wenn kein Kartenleser angeschlossen ist und daher der entsprechende Dienst nicht gestartet wurde. + <br class="clearfloat" /> </p> <p><br class="clearfloat" /></p> </div> diff --git a/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java b/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java index 8830a81c..9d77e53e 100644 --- a/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java +++ b/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java @@ -34,6 +34,7 @@ import at.gv.egiz.stal.SignResponse; import at.gv.egiz.stal.SignRequest; import at.gv.egiz.stal.service.types.InfoboxReadRequestType; import at.gv.egiz.stal.service.types.InfoboxReadResponseType; +import at.gv.egiz.stal.service.types.ObjectFactory; import at.gv.egiz.stal.service.types.QuitRequestType; import at.gv.egiz.stal.service.types.RequestType; import at.gv.egiz.stal.service.types.ResponseType; @@ -45,6 +46,7 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import javax.xml.bind.JAXBElement; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.BeforeClass; @@ -283,19 +285,25 @@ public class STALRequestBrokerTest { @Override public void run() { try { + ObjectFactory of= new ObjectFactory(); + log.debug("calling stal.nextRequest(oldResponse)"); - ResponseType oldResp = new InfoboxReadResponseType(); - List<RequestType> requests = stal.nextRequest(Collections.singletonList(oldResp)); + InfoboxReadResponseType oldResp = of.createInfoboxReadResponseType(); + ArrayList<JAXBElement<? extends ResponseType>> oldResponses = new ArrayList<JAXBElement<? extends ResponseType>>(); + oldResponses.add(of.createGetNextRequestTypeInfoboxReadResponse(oldResp)); + + List<JAXBElement<? extends RequestType>> requests = stal.nextRequest(oldResponses); log.debug("got " + requests.size() + " requests. processing..."); Thread.sleep(1); - List<ResponseType> responses = new ArrayList<ResponseType>(); - for (RequestType request : requests) { + List<JAXBElement<? extends ResponseType>> responses = new ArrayList<JAXBElement<? extends ResponseType>>(); + for (JAXBElement<? extends RequestType> requestElt : requests) { + RequestType request = requestElt.getValue(); if (request instanceof InfoboxReadRequestType) { log.debug("received UNEXPECTED READINFOBOX request"); - InfoboxReadResponseType r = new InfoboxReadResponseType(); + InfoboxReadResponseType r = of.createInfoboxReadResponseType(); r.setInfoboxValue("dummyInfobox".getBytes()); - responses.add(r); + responses.add(of.createGetNextRequestTypeInfoboxReadResponse(r)); } else if (request instanceof SignRequestType) { log.debug("received UNEXPECTED SIGN request"); @@ -311,9 +319,9 @@ public class STALRequestBrokerTest { log.debug("got HashDataInput " + new String(data)); - SignResponseType r = new SignResponseType(); + SignResponseType r = of.createSignResponseType(); r.setSignatureValue("dummySignature".getBytes()); - responses.add(r); + responses.add(of.createGetNextRequestTypeSignResponse(r)); } else if (request instanceof QuitRequestType) { log.debug("received EXPECTED QUIT request"); return; @@ -326,7 +334,8 @@ public class STALRequestBrokerTest { // } log.debug("calling stal.nextRequest with " + responses.size() + " responses"); requests = stal.nextRequest(responses); - for (RequestType request : requests) { + for (JAXBElement<? extends RequestType> requestElt : requests) { + RequestType request = requestElt.getValue(); if (request instanceof QuitRequestType) { log.debug("got QUIT request"); } else { @@ -347,17 +356,19 @@ public class STALRequestBrokerTest { @Override public void run() { try { + ObjectFactory of = new ObjectFactory(); // first call w/ empty response list log.debug("calling stal.nextRequest"); - List<RequestType> requests = stal.nextRequest(null); //new ArrayList<ResponseType>()); + List<JAXBElement<? extends RequestType>> requests = stal.nextRequest(null); //new ArrayList<ResponseType>()); log.debug("got " + requests.size() + " requests. processing..."); Thread.sleep(1); - List<ResponseType> responses = new ArrayList<ResponseType>(); - for (RequestType request : requests) { + List<JAXBElement<? extends ResponseType>> responses = new ArrayList<JAXBElement<? extends ResponseType>>(); + for (JAXBElement<? extends RequestType> requestElt : requests) { + RequestType request = requestElt.getValue(); if (request instanceof InfoboxReadRequestType) { - InfoboxReadResponseType r = new InfoboxReadResponseType(); + InfoboxReadResponseType r = of.createInfoboxReadResponseType(); r.setInfoboxValue("dummyInfobox".getBytes()); - responses.add(r); + responses.add(of.createGetNextRequestTypeInfoboxReadResponse(r)); } else if (request instanceof SignRequestType) { log.debug("calling stal.getCurrentHashDataInputCallback"); @@ -371,9 +382,9 @@ public class STALRequestBrokerTest { log.debug("got HashDataInput " + new String(data)); - SignResponseType r = new SignResponseType(); + SignResponseType r = of.createSignResponseType(); r.setSignatureValue("dummySignature".getBytes()); - responses.add(r); + responses.add(of.createGetNextRequestTypeSignResponse(r)); } else if (request instanceof QuitRequestType) { log.debug("received UNEXPECTED QUIT request"); return; @@ -386,7 +397,8 @@ public class STALRequestBrokerTest { // } log.debug("calling stal.nextRequest with " + responses.size() + " responses"); requests = stal.nextRequest(responses); - for (RequestType request : requests) { + for (JAXBElement<? extends RequestType> requestElt : requests) { + RequestType request = requestElt.getValue(); if (request instanceof QuitRequestType) { log.debug("got QUIT request"); } else { @@ -408,10 +420,11 @@ public class STALRequestBrokerTest { try { // first call w/ empty response list log.debug("calling stal.nextRequest"); - List<RequestType> requests = stal.nextRequest(null); //new ArrayList<ResponseType>()); + List<JAXBElement<? extends RequestType>> requests = stal.nextRequest(null); //new ArrayList<ResponseType>()); log.debug("got " + requests.size() + " requests. processing..."); Thread.sleep(1); - for (RequestType request : requests) { + for (JAXBElement<? extends RequestType> requestElt : requests) { + RequestType request = requestElt.getValue(); // if (request instanceof InfoboxReadRequest) { if (request instanceof SignRequestType) { log.debug("calling stal.getCurrentHashDataInputCallback"); |