diff options
author | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-09-30 13:54:54 +0000 |
---|---|---|
committer | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-09-30 13:54:54 +0000 |
commit | d0879e9058943c6afa1912ccbeae936db2811f26 (patch) | |
tree | 66b7c802a9d8d7c8d0d075a563aac852ce1b500f | |
parent | e3f253ed3dc0fa9078d48b74955f6f3b8d6490a4 (diff) | |
download | mocca-d0879e9058943c6afa1912ccbeae936db2811f26.tar.gz mocca-d0879e9058943c6afa1912ccbeae936db2811f26.tar.bz2 mocca-d0879e9058943c6afa1912ccbeae936db2811f26.zip |
backport to JAXWS2.0
STALService initial connect()
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@76 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
37 files changed, 1648 insertions, 883 deletions
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java index 35fe652f..a87b04c4 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java @@ -34,23 +34,23 @@ import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; import at.gv.egiz.smcc.SignatureCard; import at.gv.egiz.smcc.util.SMCCHelper; -import at.gv.egiz.stal.ErrorResponse; -import at.gv.egiz.stal.InfoboxReadRequest; import at.gv.egiz.stal.QuitRequest; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; -import at.gv.egiz.stal.SignRequest; -import at.gv.egiz.stal.service.GetNextRequestResponseType; -import at.gv.egiz.stal.service.GetNextRequestType; -import at.gv.egiz.stal.service.ObjectFactory; +import at.gv.egiz.stal.service.types.GetNextRequestResponseType; +import at.gv.egiz.stal.service.types.GetNextRequestType; +import at.gv.egiz.stal.service.types.ObjectFactory; import at.gv.egiz.stal.service.STALPortType; import at.gv.egiz.stal.service.STALService; +import at.gv.egiz.stal.service.types.ErrorResponseType; +import at.gv.egiz.stal.service.types.RequestType; +import at.gv.egiz.stal.service.types.ResponseType; +import at.gv.egiz.stal.util.STALTranslator; public class BKUWorker extends AbstractSMCCSTAL implements Runnable, - ActionListener, SMCCSTALRequestHandler { + ActionListener, SMCCSTALRequestHandler { private static Log log = LogFactory.getLog(BKUWorker.class); - protected BKUGUIFacade gui; protected BKUApplet parent; private STALPortType stalPort; @@ -65,7 +65,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, * must not be null */ public BKUWorker(BKUGUIFacade gui, BKUApplet parent, - ResourceBundle errorMessageBundle) { + ResourceBundle errorMessageBundle) { if ((gui == null) || (parent == null) || (errorMessageBundle == null)) { throw new NullPointerException("Parameter must not be set to null"); } @@ -73,7 +73,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, this.parent = parent; this.errorMessages = errorMessageBundle; addRequestHandler(QuitRequest.class, this); - // register SignRequestHandler once we have a webservice port + // register SignRequestHandler once we have a webservice port } /** @@ -111,7 +111,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, } log.debug("Found WSDL url: " + wsdlURL); QName endpointName = new QName("http://www.egiz.gv.at/wsdl/stal", - "STALService"); + "STALService"); STALService stal = new STALService(wsdlURL, endpointName); return stal.getSTALPort(); } @@ -135,49 +135,75 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, return; } try { - ObjectFactory factory = new ObjectFactory(); - GetNextRequestType nextRequest = factory.createGetNextRequestType(); - String sessionId = parent.getMyAppletParameter(BKUApplet.SESSION_ID); if (sessionId == null) { // use the testsession for testing sessionId = "TestSession"; } - nextRequest.setSessionId(sessionId); - addRequestHandler(SignRequest.class, new WSSignRequestHandler(sessionId, - stalPort)); + addRequestHandler(at.gv.egiz.stal.SignRequest.class, new WSSignRequestHandler(sessionId, stalPort)); + + ObjectFactory of = new ObjectFactory(); + GetNextRequestResponseType nextRequestResp = stalPort.connect(sessionId); do { - GetNextRequestResponseType resp = stalPort.getNextRequest(nextRequest); - log.info("Got " + resp.getRequest().size() + " requests from server."); - List<STALRequest> stalRequests = resp.getRequest(); + List<RequestType> requests = nextRequestResp.getInfoboxReadRequestOrSignRequestOrQuitRequest(); + List<STALRequest> stalRequests = STALTranslator.translateRequests(requests); + + if (log.isInfoEnabled()) { + StringBuilder sb = new StringBuilder("Received "); + sb.append(stalRequests.size()); + sb.append(" STAL requests: "); + for (STALRequest r : stalRequests) { + sb.append(r.getClass()); + sb.append(' '); + } + log.info(sb.toString()); + } + boolean handle = true; for (STALRequest request : stalRequests) { - if (request instanceof InfoboxReadRequest) { - InfoboxReadRequest infobx = (InfoboxReadRequest) request; - if (infobx.getInfoboxIdentifier().equals("IdentityLink")) { - if (infobx.getDomainIdentifier() == null) { - if (!InternalSSLSocketFactory.getInstance().isEgovAgency()) { - handle = false; - } + if (request instanceof at.gv.egiz.stal.InfoboxReadRequest) { + at.gv.egiz.stal.InfoboxReadRequest r = (at.gv.egiz.stal.InfoboxReadRequest) request; + String infoboxId = r.getInfoboxIdentifier(); + String domainId = r.getDomainIdentifier(); + if ("IdentityLink".equals(infoboxId) && domainId == null) { + if (!InternalSSLSocketFactory.getInstance().isEgovAgency()) { + handle = false; } } } } - List<STALResponse> responses; + + List<ResponseType> responses; if (handle) { - responses = handleRequest(stalRequests); + List<STALResponse> stalResponses = handleRequest(stalRequests); + if (log.isInfoEnabled()) { + StringBuilder sb = new StringBuilder(stalResponses.size()); + sb.append(" STAL responses: "); + for (STALResponse r : stalResponses) { + sb.append(r.getClass()); + sb.append(' '); + } + log.info(sb.toString()); + } + responses = STALTranslator.fromSTAL(stalResponses); } else { - responses = new ArrayList<STALResponse>(1); - responses.add(new ErrorResponse(6002)); + responses = new ArrayList<ResponseType>(1); + ErrorResponseType err = new ErrorResponseType(); + err.setErrorCode(6002); +// err.setErrorMessage(); + responses.add(err); + } + + if (!finished) { + GetNextRequestType nextRequest = of.createGetNextRequestType(); + nextRequest.setSessionId(sessionId); + nextRequest.getInfoboxReadResponseOrSignResponseOrErrorResponse().addAll(responses); + nextRequestResp = stalPort.getNextRequest(nextRequest); } - log.info("Got " + responses.size() + " responses."); - nextRequest = factory.createGetNextRequestType(); - nextRequest.setSessionId(sessionId); - nextRequest.getResponse().addAll(responses); } while (!finished); log.info("Done " + Thread.currentThread().getName()); - // gui.showWelcomeDialog(); } catch (Exception ex) { + log.error(ex.getMessage(), ex); gui.showErrorDialog("Sorry, an internal error occured: " + ex.getMessage()); try { waitForAction(); @@ -196,20 +222,17 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, URL url = null; if (redirectURL != null) { try { - url = new URL(parent.getCodeBase(), redirectURL + ";jsessionid=" - + parent.getMyAppletParameter(BKUApplet.SESSION_ID)); + url = new URL(parent.getCodeBase(), redirectURL + ";jsessionid=" + parent.getMyAppletParameter(BKUApplet.SESSION_ID)); } catch (MalformedURLException ex) { - log.warn("Parameter 'redirectURL': " + redirectURL - + " not a valid URL.", ex); - // gui.showErrorDialog(errorMsg, okListener, actionCommand) + log.warn("Parameter 'redirectURL': " + redirectURL + " not a valid URL.", ex); + // gui.showErrorDialog(errorMsg, okListener, actionCommand) } if (url != null) { if (redirectTarget == null) { log.info("Done. Trying to redirect to " + url + " ..."); parent.getAppletContext().showDocument(url); } else { - log.info("Done. Trying to redirect to " + url + " (target=" - + redirectTarget + ") ..."); + log.info("Done. Trying to redirect to " + url + " (target=" + redirectTarget + ") ..."); parent.getAppletContext().showDocument(url, redirectTarget); } } @@ -253,48 +276,48 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, int oldValue = SMCCHelper.PC_SC_NOT_SUPPORTED; // this is a save default while ((signatureCard == null) && (!actionPerformed)) { switch (smccHelper.getResultCode()) { - case SMCCHelper.PC_SC_NOT_SUPPORTED: - actionCommandList.clear(); - actionCommandList.add("ok"); - gui.showErrorDialog(errorMessages.getString("nopcscsupport"), this, - "ok"); - try { - waitForAction(); - } catch (InterruptedException e) { - log.error(e); - } - return true; - case SMCCHelper.TERMINAL_NOT_PRESENT: - actionCommandList.clear(); - actionCommandList.add("ok"); - gui.showErrorDialog(errorMessages.getString("nocardterminal"), this, - "ok"); - try { - waitForAction(); - } catch (InterruptedException e) { - log.error(e); - } - return true; - case SMCCHelper.CARD_NOT_SUPPORTED: - if (oldValue != SMCCHelper.CARD_NOT_SUPPORTED) { + case SMCCHelper.PC_SC_NOT_SUPPORTED: actionCommandList.clear(); - actionCommandList.add("cancel"); - gui.showCardNotSupportedDialog(this, "cancel"); - oldValue = SMCCHelper.CARD_NOT_SUPPORTED; - } - break; - case SMCCHelper.NO_CARD: - if (oldValue != SMCCHelper.NO_CARD) { + actionCommandList.add("ok"); + gui.showErrorDialog(errorMessages.getString("nopcscsupport"), this, + "ok"); + try { + waitForAction(); + } catch (InterruptedException e) { + log.error(e); + } + return true; + case SMCCHelper.TERMINAL_NOT_PRESENT: actionCommandList.clear(); - actionCommandList.add("cancel"); - gui.showInsertCardDialog(this, "cancel"); - oldValue = SMCCHelper.NO_CARD; - } - break; - case SMCCHelper.CARD_FOUND: - // gui.showWaitDialog(null); - signatureCard = smccHelper.getSignatureCard(errorMessages.getLocale()); - return false; + actionCommandList.add("ok"); + gui.showErrorDialog(errorMessages.getString("nocardterminal"), this, + "ok"); + try { + waitForAction(); + } catch (InterruptedException e) { + log.error(e); + } + return true; + case SMCCHelper.CARD_NOT_SUPPORTED: + if (oldValue != SMCCHelper.CARD_NOT_SUPPORTED) { + actionCommandList.clear(); + actionCommandList.add("cancel"); + gui.showCardNotSupportedDialog(this, "cancel"); + oldValue = SMCCHelper.CARD_NOT_SUPPORTED; + } + break; + case SMCCHelper.NO_CARD: + if (oldValue != SMCCHelper.NO_CARD) { + actionCommandList.clear(); + actionCommandList.add("cancel"); + gui.showInsertCardDialog(this, "cancel"); + oldValue = SMCCHelper.NO_CARD; + } + break; + case SMCCHelper.CARD_FOUND: + // gui.showWaitDialog(null); + signatureCard = smccHelper.getSignatureCard(errorMessages.getLocale()); + return false; } smccHelper.update(3000); } diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java index 6dae264c..5f422164 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java @@ -20,9 +20,9 @@ import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; import at.gv.egiz.bku.smccstal.SignRequestHandler; import at.gv.egiz.stal.HashDataInput; import at.gv.egiz.stal.impl.ByteArrayHashDataInput; -import at.gv.egiz.stal.service.GetHashDataInputResponseType; -import at.gv.egiz.stal.service.GetHashDataInputType; import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.types.GetHashDataInputResponseType; +import at.gv.egiz.stal.service.types.GetHashDataInputType; import at.gv.egiz.stal.signedinfo.DigestMethodType; import at.gv.egiz.stal.signedinfo.ReferenceType; import java.security.DigestException; diff --git a/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java b/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java index 9b58798d..63da8225 100644 --- a/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java +++ b/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java @@ -33,12 +33,14 @@ import org.junit.Test; import at.gv.egiz.stal.InfoboxReadRequest; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.service.GetHashDataInputFault; -import at.gv.egiz.stal.service.GetHashDataInputResponseType; -import at.gv.egiz.stal.service.GetHashDataInputType; -import at.gv.egiz.stal.service.GetNextRequestResponseType; -import at.gv.egiz.stal.service.GetNextRequestType; import at.gv.egiz.stal.service.STALPortType; import at.gv.egiz.stal.service.STALService; +import at.gv.egiz.stal.service.types.GetHashDataInputResponseType; +import at.gv.egiz.stal.service.types.GetHashDataInputType; +import at.gv.egiz.stal.service.types.GetNextRequestResponseType; +import at.gv.egiz.stal.service.types.GetNextRequestType; +import at.gv.egiz.stal.service.types.InfoboxReadRequestType; +import at.gv.egiz.stal.service.types.RequestType; /** * @@ -60,11 +62,11 @@ public class STALServiceTest { // req.getResponse().add(new ErrorResponse(1234)); GetNextRequestResponseType nrResp = port.getNextRequest(nrReq); assertNotNull(nrResp); - System.out.println("got response: " + nrResp.getRequest().size()); - for (STALRequest stalReq : nrResp.getRequest()) { - if (stalReq instanceof InfoboxReadRequest) { - String ibid = ((InfoboxReadRequest) stalReq).getInfoboxIdentifier(); - String did = ((InfoboxReadRequest) stalReq).getDomainIdentifier(); + System.out.println("got response: " + nrResp.getInfoboxReadRequestOrSignRequestOrQuitRequest().size()); + for (RequestType stalReq : nrResp.getInfoboxReadRequestOrSignRequestOrQuitRequest()) { + if (stalReq instanceof InfoboxReadRequestType) { + String ibid = ((InfoboxReadRequestType) stalReq).getInfoboxIdentifier(); + String did = ((InfoboxReadRequestType) stalReq).getDomainIdentifier(); System.out.println(" received InfoboxReadRequest for " + ibid + ", " + did); } else { System.out.println(" received STAL request " + stalReq.getClass().getName()); diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index e699d16b..5cdf5356 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -72,6 +72,7 @@ <groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.1.4</version>
+ <!--scope>provided</scope-->
<!--
conflict with SAAJ from java 6 ? <exclusions> <exclusion>
<groupId>javax.xml.soap</groupId> <artifactId>saaj-api</artifactId>
@@ -127,19 +128,31 @@ <skip>true</skip>
</configuration>
</plugin-->
- <!--plugin>
+ <!--plugin>
<groupId>org.codehaus.mojo</groupId>
- <artifactId>jaxws-maven-plugin</artifactId> <executions> <execution>
- <goals> <goal>wsimport</goal> </goals> <configuration>
- <verbose>true</verbose>
- <bindingDirectory>${basedir}/src/main/custom-binding</bindingDirectory>
- <bindingFiles> <bindingFile>stalservice-custom.xml</bindingFile>
- <bindingFile>staltypes-custom.xml</bindingFile> </bindingFiles>
- <wsdlDirectory>${basedir}/src/main/webapp/WEB-INF/wsdl</wsdlDirectory>
- <wsdlFiles> <wsdlFile>stal.wsdl</wsdlFile> </wsdlFiles>
- <sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir>
- <staleFile>${project.build.directory}/generated-sources/wsimport/.staleFlag</staleFile>
- </configuration> </execution> </executions>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ </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>
+ </bindingFiles>
+ <wsdlDirectory>${basedir}/src/main/webapp/WEB-INF/wsdl</wsdlDirectory>
+ <wsdlFiles>
+ <wsdlFile>stal.wsdl</wsdlFile>
+ </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir>
+ <staleFile>${project.build.directory}/generated-sources/wsimport/.staleFlag</staleFile>
+ </configuration>
</plugin-->
<plugin>
<artifactId>maven-war-plugin</artifactId>
diff --git a/BKUOnline/src/main/custom-binding/stalservice-custom.xml b/BKUOnline/src/main/custom-binding/stalservice-custom.xml index 384b04f7..9c35cbdf 100644 --- a/BKUOnline/src/main/custom-binding/stalservice-custom.xml +++ b/BKUOnline/src/main/custom-binding/stalservice-custom.xml @@ -42,6 +42,20 @@ </bindings> <!-- wsdl:portType operation customization --> + <bindings node="wsdl:definitions/wsdl:portType[@name='STALPortType']/wsdl:operation[@name='connect']"> + <!-- rename method name --> + <method name="connect"> + <javadoc>Initial connection, get the first request.</javadoc> + </method> + + <!-- rename method params --> + <parameter part="wsdl:definitions/wsdl:message[@name='ConnectRequest']/wsdl:part[@name='part1']" name="sessionId" /> + + <!-- override default settings --> + <enableWrapperStyle>true</enableWrapperStyle> + <enableAsyncMapping>false</enableAsyncMapping> + </bindings> + <bindings node="wsdl:definitions/wsdl:portType[@name='STALPortType']/wsdl:operation[@name='nextRequest']"> <!-- rename method name --> <method name="getNextRequest"> diff --git a/BKUOnline/src/main/custom-binding/staltypes-custom.xml b/BKUOnline/src/main/custom-binding/staltypes-custom.xml index 2ea42082..3e150363 100644 --- a/BKUOnline/src/main/custom-binding/staltypes-custom.xml +++ b/BKUOnline/src/main/custom-binding/staltypes-custom.xml @@ -35,36 +35,13 @@ <bindings scd="x-schema::stal" xmlns:stal="http://www.egiz.gv.at/stal"> <schemaBindings> <!-- generate all classes to at.gv.egiz.stal, then move service-only classes to at.gv.egiz.stal.service --> - <package name="at.gv.egiz.stal"/> + <package name="at.gv.egiz.stal.service.types"/> </schemaBindings> </bindings> - <bindings scd="/type::stal:RequestType"> + <!--bindings scd="/type::stal:RequestType"> <class name="STALRequest"/> </bindings> <bindings scd="/type::stal:ResponseType"> <class name="STALResponse"/> - </bindings> - <bindings scd="/type::stal:InfoboxReadResponseType"> - <class name="InfoboxReadResponse"/> - </bindings> - <bindings scd="/type::stal:SignResponseType"> - <class name="SignResponse"/> - </bindings> - <bindings scd="/type::stal:ErrorResponseType"> - <class name="ErrorResponse"/> - <!--class implClass="at.gv.egiz.stal.types.ErrorResponse"/--> - </bindings> - <bindings scd="/type::stal:InfoboxReadRequestType" > - <class name="InfoboxReadRequest"/> - </bindings> - <bindings scd="/type::stal:SignRequestType" > - <class name="SignRequest"/> - <!--class implClass="at.gv.egiz.stal.types.SignRequest"/--> - </bindings> - <bindings scd="/type::stal:QuitRequestType" > - <class name="QuitRequest"/> - </bindings> - <!--bindings scd="/type::stal:GetHashDataInputFaultType" > - <class name="GetHashDataInputFault"/> </bindings--> </bindings> 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 560282ac..af886eec 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,8 +22,8 @@ package at.gv.egiz.stal.service.impl; import at.gv.egiz.stal.HashDataInput; import at.gv.egiz.stal.STAL; -import at.gv.egiz.stal.STALRequest; -import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.service.types.RequestType; +import at.gv.egiz.stal.service.types.ResponseType; import java.util.List; /** @@ -35,7 +35,9 @@ public interface STALRequestBroker extends STAL { public static final int ERR_6000 = 6000; public static final long DEFAULT_TIMEOUT_MS = 1000*60*5; //5mn - public List<STALRequest> nextRequest(List<STALResponse> response); + public List<RequestType> connect(); + + public List<RequestType> nextRequest(List<ResponseType> response); 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 dc3cc6d3..bfa83dd4 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 @@ -22,10 +22,17 @@ package at.gv.egiz.stal.service.impl; import at.gv.egiz.stal.ErrorResponse; import at.gv.egiz.stal.HashDataInput; +import at.gv.egiz.stal.InfoboxReadRequest; import at.gv.egiz.stal.QuitRequest; 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.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 at.gv.egiz.stal.util.STALTranslator; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -48,18 +55,26 @@ public class STALRequestBrokerImpl implements STALRequestBroker { private static final Log log = LogFactory.getLog(STALRequestBrokerImpl.class); - private boolean expectingResponse = false; +// private boolean expectingResponse = false; private boolean interrupted = false; - private final RequestsMonitor reqMon = new RequestsMonitor(); - private final ResponsesMonitor respMon = new ResponsesMonitor(); +// private final RequestsMonitor reqMon = new RequestsMonitor(); +// private final ResponsesMonitor respMon = new ResponsesMonitor(); + + protected ArrayList<RequestType> requests; + protected ArrayList<ResponseType> responses; + + protected ArrayList<HashDataInput> hashDataInputs; private long timeout; public STALRequestBrokerImpl(long timeoutMillisec) { if (timeoutMillisec <= 0) timeoutMillisec = DEFAULT_TIMEOUT_MS; - this.timeout = timeoutMillisec; + timeout = timeoutMillisec; + requests = new ArrayList<RequestType>(); + responses = new ArrayList<ResponseType>(); + hashDataInputs = new ArrayList<HashDataInput>(); } /** @@ -73,52 +88,80 @@ public class STALRequestBrokerImpl implements STALRequestBroker { * @pre requests: either single SignRequest, QuitRequest or multiple ReadInfoboxRequests */ @Override - public List<STALResponse> handleRequest(List<STALRequest> requests) { + public List<STALResponse> handleRequest(List<STALRequest> stalRequests) { if (interrupted) { return null; } try { - synchronized (reqMon) { + synchronized (requests) { log.trace("produce request"); - reqMon.produce(requests); - reqMon.setHashDataInput(null); - for (STALRequest request : requests) { - if (request instanceof SignRequest) { - log.trace("Received SignRequest, keep HashDataInput."); - reqMon.setHashDataInput(((SignRequest) request).getHashDataInput()); - break; - } else if (request instanceof QuitRequest) { - log.trace("Received QuitRequest, do not wait for responses."); - log.trace("notifying request consumers"); - reqMon.notify(); - return new ArrayList<STALResponse>(); - } else if (log.isTraceEnabled()) { - log.trace("Received STAL request: " + request.getClass().getName()); + 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()); + requests.add(req); + 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()); + requests.add(req); + } else if (stalRequest instanceof QuitRequest) { + log.trace("Received QuitRequest, do not wait for responses."); + requests.add(new QuitRequestType()); + 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()); + log.trace("notifying request consumers"); + requests.notify(); + return new ArrayList<STALResponse>(); } } log.trace("notifying request consumers"); - reqMon.notify(); + requests.notify(); +// reqMon.notify(); } - synchronized (respMon) { + synchronized (responses) { //respMon) { long beforeWait = System.currentTimeMillis(); - while (respMon.responses == null) { +// while (respMon.responses == null) { + while (responses.isEmpty()) { log.trace("waiting to consume response"); - respMon.wait(timeout); +// 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); +// reqMon.consume(); //TODO check deadlock? +// reqMon.setHashDataInput(null); + requests.clear(); //TODO sync on requests? + hashDataInputs.clear(); return Collections.singletonList((STALResponse) new ErrorResponse(ERR_6000)); } } log.trace("consuming responses"); - List<STALResponse> responses = respMon.consume(); +// List<STALResponse> responses = respMon.consume(); + List<STALResponse> resps = STALTranslator.toSTAL(responses); + responses.clear(); log.trace("notifying response producers"); - respMon.notify(); + responses.notify(); +// respMon.notify(); - return responses; + return resps; } } catch (InterruptedException ex) { log.warn("interrupt in handleRequest(): " + ex.getMessage()); @@ -127,6 +170,36 @@ public class STALRequestBrokerImpl implements STALRequestBroker { } } + @Override + public List<RequestType> connect() { + if (interrupted) { + return null; + } + try { + synchronized (requests) { + long beforeWait = System.currentTimeMillis(); + while (requests.isEmpty()) { + log.trace("waiting to consume request"); + requests.wait(timeout); + if (System.currentTimeMillis() - beforeWait >= timeout) { + log.warn("timeout while waiting to consume request"); + return Collections.singletonList((RequestType) new QuitRequestType()); + } + } + log.trace("consume request"); + List<RequestType> reqs = new ArrayList<RequestType>(); + reqs.addAll(requests); + + requests.clear(); + return reqs; + } + } catch (InterruptedException ex) { + log.warn("interrupt in nextRequest(): " + ex.getMessage()); + interrupted = true; + return null; + } + } + /** * This method is thread-safe, except for * an 'initial' call to nextRequest(null) followed by a @@ -139,63 +212,74 @@ public class STALRequestBrokerImpl implements STALRequestBroker { * @return QUIT if expected responses are not provided */ @Override - public List<STALRequest> nextRequest(List<STALResponse> responses) { + public List<RequestType> nextRequest(List<ResponseType> resps) { if (interrupted) { return null; } try { - synchronized (respMon) { - if (responses != null && responses.size() > 0) { - if (!expectingResponse) { - log.warn("Received unexpected response in nextRequest(), return QUIT"); - return Collections.singletonList((STALRequest) new QuitRequest()); - } + synchronized (responses) { //respMon) { + 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 (respMon.responses != null) { + while (!responses.isEmpty()) { log.trace("waiting to produce response"); - respMon.wait(timeout); +// respMon.wait(timeout); + responses.wait(timeout); if (System.currentTimeMillis() - beforeWait >= timeout) { log.warn("timeout while waiting to produce response"); - return Collections.singletonList((STALRequest) new QuitRequest()); + return Collections.singletonList((RequestType) new QuitRequestType()); } } log.trace("produce response"); - respMon.produce(responses); +// respMon.produce(resps); + responses.addAll(resps); //reset HashDataInputCallback iff SignResponse if (log.isTraceEnabled()) { - for (STALResponse response : responses) { + for (ResponseType response : resps) { log.trace("Received STAL response: " + response.getClass().getName()); } } log.trace("notifying response consumers"); - respMon.notify(); +// respMon.notify(); + responses.notify(); } else { - if (expectingResponse) { - log.warn("Did not receive expected response(s) in nextRequest(), return QUIT"); - return Collections.singletonList((STALRequest) new QuitRequest()); - } - log.trace("expecting non-null response in next nextRequest(response)"); - expectingResponse = true; +// 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()); } } - synchronized (reqMon) { + synchronized (requests) { //reqMon) { long beforeWait = System.currentTimeMillis(); - while (reqMon.requests == null) { +// while (reqMon.requests == null) { + while (requests.isEmpty()) { log.trace("waiting to consume request"); - reqMon.wait(timeout); +// reqMon.wait(timeout); + requests.wait(timeout); if (System.currentTimeMillis() - beforeWait >= timeout) { log.warn("timeout while waiting to consume request"); - return Collections.singletonList((STALRequest) new QuitRequest()); + return Collections.singletonList((RequestType) new QuitRequestType()); } } log.trace("consume request"); - List<STALRequest> requests = reqMon.consume(); - if (requests.size() > 0 && requests.get(0) instanceof QuitRequest) { - log.trace("expecting no response in next nextRequest()"); - expectingResponse = false; - } - return requests; + 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; } } catch (InterruptedException ex) { log.warn("interrupt in nextRequest(): " + ex.getMessage()); @@ -205,49 +289,95 @@ public class STALRequestBrokerImpl implements STALRequestBroker { } @Override - public synchronized List<HashDataInput> getHashDataInput() { - log.trace("return " + reqMon.hashDataInput.size() + " current HashDataInput(s) "); - return reqMon.getHashDataInput(); + public List<HashDataInput> getHashDataInput() { + synchronized (requests) { + log.trace("return " + hashDataInputs.size() + " current HashDataInput(s) "); + return hashDataInputs; //reqMon.getHashDataInput(); + } } @Override public void setLocale(Locale locale) { } - class RequestsMonitor { - List<STALRequest> requests; - List<HashDataInput> hashDataInput; - - void produce(List<STALRequest> req) { - requests = req; - } - - synchronized List<STALRequest> consume() { - List<STALRequest> reqs = requests; - requests = null; - return reqs; - } - - void setHashDataInput(List<HashDataInput> hdi) { - hashDataInput = hdi; - } - - List<HashDataInput> getHashDataInput() { - return hashDataInput; - } - } - - class ResponsesMonitor { - List<STALResponse> responses; - - void produce(List<STALResponse> resp) { - responses = resp; - } - - synchronized List<STALResponse> consume() { - List<STALResponse> resps = responses; - responses = null; - return resps; - } - } +// 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; +// } +// } } 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 d3d6c8db..bcee1e77 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 @@ -22,22 +22,27 @@ package at.gv.egiz.stal.service.impl; import at.gv.egiz.bku.binding.BindingProcessor; import at.gv.egiz.bku.binding.BindingProcessorManager; -import at.gv.egiz.stal.HashDataInput; -import at.gv.egiz.stal.service.*; import at.gv.egiz.bku.binding.Id; import at.gv.egiz.bku.binding.IdFactory; -import at.gv.egiz.stal.ErrorResponse; -import at.gv.egiz.stal.STALRequest; -import at.gv.egiz.stal.STALResponse; -import at.gv.egiz.stal.InfoboxReadRequest; -import at.gv.egiz.stal.QuitRequest; -import at.gv.egiz.stal.SignRequest; - -import java.io.ByteArrayInputStream; + +import at.gv.egiz.stal.HashDataInput; +import at.gv.egiz.stal.service.GetHashDataInputFault; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.types.ErrorResponseType; +import at.gv.egiz.stal.service.types.GetHashDataInputFaultType; +import at.gv.egiz.stal.service.types.GetHashDataInputResponseType; +import at.gv.egiz.stal.service.types.GetHashDataInputType; +import at.gv.egiz.stal.service.types.GetNextRequestResponseType; +import at.gv.egiz.stal.service.types.GetNextRequestType; +import at.gv.egiz.stal.service.types.InfoboxReadRequestType; +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 java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; -import java.util.Collections; +import java.nio.charset.Charset; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -63,57 +68,90 @@ public class STALServiceImpl implements STALPortType { WebServiceContext wsContext; protected IdFactory idF = IdFactory.getInstance(); + @Override - public GetNextRequestResponseType getNextRequest(GetNextRequestType request) { - - Id sessionId = idF.createId(request.getSessionId()); - - List<STALResponse> responsesIn = request.getResponse(); - - GetNextRequestResponseType response = new GetNextRequestResponseType(); - response.setSessionId(sessionId.toString()); + 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)) { - if (responsesIn.size() > 0 && responsesIn.get(0) instanceof ErrorResponse) { - log.info("Received TestSession GetNextRequest(ErrorResponse), returning QuitRequest"); - response.getRequest().add(new QuitRequest()); - } else { - log.info("Received TestSession GetNextRequest, returning InfoboxReadRequest "); - SignRequest sig = new SignRequest(); - 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.getRequest().add(sig); - InfoboxReadRequest req = new InfoboxReadRequest(); - req.setInfoboxIdentifier("IdentityLink"); - req.setDomainIdentifier("hansiwurzel"); - response.getRequest().add(req); - req = new InfoboxReadRequest(); - req.setInfoboxIdentifier("CertifiedKeypair"); - response.getRequest().add(req); - req = new InfoboxReadRequest(); - req.setInfoboxIdentifier("SecureSignatureKeypair"); - response.getRequest().add(req); - } - return response; + return getTestSessionNextRequestResponse(null); } + + GetNextRequestResponseType response = new GetNextRequestResponseType(); + response.setSessionId(sessionId.toString()); STALRequestBroker stal = getStal(sessionId); if (stal != null) { + + List<RequestType> requestsOut = ((STALRequestBroker) stal).connect(); + response.getInfoboxReadRequestOrSignRequestOrQuitRequest().addAll(requestsOut); + if (log.isDebugEnabled()) { - StringBuilder sb = new StringBuilder("Received GetNextRequest ["); + StringBuilder sb = new StringBuilder("Returning initial GetNextRequestResponse ["); sb.append(sessionId.toString()); sb.append("] containing "); - sb.append(responsesIn.size()); - sb.append(" responses: "); - for (STALResponse respIn : responsesIn) { - sb.append(respIn); + sb.append(requestsOut.size()); + sb.append(" requests: "); + for (RequestType reqOut : requestsOut) { + sb.append(reqOut.getClass()); sb.append(' '); } + log.debug(sb.toString()); } + } else { + log.error("Failed to get STAL for session " + sessionId + ", returning QuitRequest"); + response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(new QuitRequestType()); + } + 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(); + + if (log.isDebugEnabled()) { + StringBuilder sb = new StringBuilder("Received GetNextRequest ["); + sb.append(sessionId.toString()); + sb.append("] containing "); + sb.append(responsesIn.size()); + sb.append(" responses: "); + for (ResponseType respIn : responsesIn) { + sb.append(respIn.getClass()); + sb.append(' '); + } + log.debug(sb.toString()); + } + + if (TEST_SESSION_ID.equals(sessionId)) { + return getTestSessionNextRequestResponse(responsesIn); + } - List<STALRequest> requestsOut = ((STALRequestBroker) stal).nextRequest(responsesIn); - response.getRequest().addAll(requestsOut); + GetNextRequestResponseType response = new GetNextRequestResponseType(); + response.setSessionId(sessionId.toString()); + + STALRequestBroker stal = getStal(sessionId); + + if (stal != null) { + + List<RequestType> requestsOut = ((STALRequestBroker) stal).nextRequest(responsesIn); + response.getInfoboxReadRequestOrSignRequestOrQuitRequest().addAll(requestsOut); if (log.isDebugEnabled()) { StringBuilder sb = new StringBuilder("Returning GetNextRequestResponse ["); @@ -121,14 +159,15 @@ public class STALServiceImpl implements STALPortType { sb.append("] containing "); sb.append(requestsOut.size()); sb.append(" requests: "); - for (STALRequest reqOut : requestsOut) { - sb.append(reqOut); + for (RequestType reqOut : requestsOut) { + sb.append(reqOut.getClass()); sb.append(' '); } + log.debug(sb.toString()); } } else { log.error("Failed to get STAL for session " + sessionId + ", returning QuitRequest"); - response.getRequest().add(new QuitRequest()); + response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(new QuitRequestType()); } return response; } @@ -136,6 +175,10 @@ public class STALServiceImpl implements STALPortType { @Override public GetHashDataInputResponseType getHashDataInput(GetHashDataInputType request) throws GetHashDataInputFault { + if (request.getSessionId() == null) { + throw new NullPointerException("No session id provided"); + } + Id sessionId = idF.createId(request.getSessionId()); if (log.isDebugEnabled()) { @@ -150,8 +193,17 @@ public class STALServiceImpl implements STALPortType { GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference(); ref.setID("Reference-" + TEST_SESSION_ID + "-001"); ref.setMimeType("text/plain"); - ref.setEncoding("UTF-8"); - ref.setValue("hashdatainput-öäüß@€-00000000001".getBytes()); + + Charset charset; + try { + charset = Charset.forName("iso-8859-15"); + ref.setEncoding("iso-8859-15"); + } catch (Exception ex) { + log.warn(ex.getMessage()); + charset = Charset.defaultCharset(); + ref.setEncoding(charset.toString()); + } + ref.setValue("hashdatainput-öäüß@€-00000000001".getBytes(charset)); response.getReference().add(ref); return response; } else { @@ -244,10 +296,40 @@ public class STALServiceImpl implements STALPortType { } private STALRequestBroker getStal(Id sessionId) { + if (log.isTraceEnabled()) { + log.trace("resolve STAL for session " + sessionId); + } MessageContext mCtx = wsContext.getMessageContext(); ServletContext sCtx = (ServletContext) mCtx.get(MessageContext.SERVLET_CONTEXT); BindingProcessorManager bpMgr = (BindingProcessorManager) sCtx.getAttribute(BINDING_PROCESSOR_MANAGER); BindingProcessor bp = bpMgr.getBindingProcessor(sessionId); return (bp == null) ? null : (bp.isFinished() ? null : (STALRequestBroker) bp.getSTAL()); } + + private GetNextRequestResponseType getTestSessionNextRequestResponse(List<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()); + } else { + log.info("Received TestSession GetNextRequest, returning InfoboxReadRequest "); + 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); + InfoboxReadRequestType req = new InfoboxReadRequestType(); + req.setInfoboxIdentifier("IdentityLink"); + req.setDomainIdentifier("hansiwurzel"); + response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(req); + req = new InfoboxReadRequestType(); + req.setInfoboxIdentifier("CertifiedKeypair"); + response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(req); + req = new InfoboxReadRequestType(); + req.setInfoboxIdentifier("SecureSignatureKeypair"); + response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(req); + } + return response; + } } diff --git a/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.wsdl b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.wsdl index a9f16a12..344e5ce2 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.wsdl +++ b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.wsdl @@ -24,6 +24,9 @@ <xsd:import namespace="http://www.egiz.gv.at/stal" schemaLocation="stal.xsd"/> </xsd:schema> </types> + <message name="ConnectRequest"> + <part name="part1" element="ns:SessionId"/> + </message> <message name="NextRequestRequest"> <part name="part1" element="ns:GetNextRequest"/> </message> @@ -40,6 +43,10 @@ <part name="part1" element="ns:GetHashDataInputFault"/> </message> <portType name="STALPortType"> + <operation name="connect"> + <input name="input3" message="tns:ConnectRequest"/> + <output name="output3" message="tns:NextRequestResponse"/> + </operation> <operation name="nextRequest"> <input name="input1" message="tns:NextRequestRequest"/> <output name="output1" message="tns:NextRequestResponse"/> @@ -52,6 +59,14 @@ </portType> <binding name="STALBinding" type="tns:STALPortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + <operation name="connect"> + <input name="input3"> + <soap:body use="literal"/> + </input> + <output name="output3"> + <soap:body use="literal"/> + </output> + </operation> <operation name="nextRequest"> <soap:operation/> <input name="input1"> diff --git a/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd index b3c4841a..6f3946dc 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd +++ b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd @@ -18,121 +18,136 @@ <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.egiz.gv.at/stal" xmlns:tns="http://www.egiz.gv.at/stal" elementFormDefault="qualified"> - <element name="GetNextRequest" type="tns:GetNextRequestType"/> - <element name="GetNextRequestResponse" type="tns:GetNextRequestResponseType"/> - <element name="GetHashDataInput" type="tns:GetHashDataInputType"/> - <element name="GetHashDataInputResponse" type="tns:GetHashDataInputResponseType"/> - <element name="GetHashDataInputFault" type="tns:GetHashDataInputFaultType"/> - <complexType name="GetNextRequestType"> + <element name="SessionId" type="string"/> + <element name="GetNextRequest" type="tns:GetNextRequestType"/> + <element name="GetNextRequestResponse" type="tns:GetNextRequestResponseType"/> + <element name="GetHashDataInput" type="tns:GetHashDataInputType"/> + <element name="GetHashDataInputResponse" type="tns:GetHashDataInputResponseType"/> + <element name="GetHashDataInputFault" type="tns:GetHashDataInputFaultType"/> + <complexType name="GetNextRequestType"> + <!-- abstract Request/Response type not supported by JAX-WS 2.0 (jdk < 1.6.0_04) <sequence> <element name="Response" type="tns:ResponseType" minOccurs="0" maxOccurs="unbounded"/> + </sequence--> + <choice maxOccurs="unbounded"> + <element name="InfoboxReadResponse" type="tns:InfoboxReadResponseType"/> + <element name="SignResponse" type="tns:SignResponseType"/> + <element name="ErrorResponse" type="tns:ErrorResponseType"/> + </choice> + <attribute name="SessionId" type="string"/> + </complexType> + <complexType name="ResponseType" abstract="true" /> + <complexType name="InfoboxReadResponseType"> + <complexContent> + <extension base="tns:ResponseType"> + <sequence> + <element name="InfoboxValue" type="base64Binary"/> </sequence> - <attribute name="sessionId" type="string"/> - <!--choice maxOccurs="unbounded"> - <element name="InfoboxReadResponse" type="tns:InfoboxReadResponseType"/> - <element name="SignResponse" type="tns:SignResponseType"/> - <element name="ErrorResponse" type="tns:ErrorResponseType"/> - </choice--> - </complexType> - <complexType name="ResponseType" abstract="true"> - <attribute name="Id" type="ID"/> - </complexType> - <complexType name="InfoboxReadResponseType"> - <complexContent> - <extension base="tns:ResponseType"> - <sequence> - <element name="InfoboxValue" type="base64Binary"/> - </sequence> - </extension> - </complexContent> - </complexType> - <complexType name="SignResponseType"> - <complexContent> - <extension base="tns:ResponseType"> - <sequence> - <element name="SignatureValue" type="base64Binary"/> - </sequence> - </extension> - </complexContent> - </complexType> - <complexType name="ErrorResponseType"> - <complexContent> - <extension base="tns:ResponseType"> - <sequence> - <element name="ErrorCode" type="int"/> - <element name="ErrorMessage" type="string"/> - </sequence> - </extension> - </complexContent> - </complexType> - <complexType name="GetNextRequestResponseType"> + </extension> + </complexContent> + </complexType> + <complexType name="SignResponseType"> + <complexContent> + <extension base="tns:ResponseType"> <sequence> - <element name="Request" type="tns:RequestType" minOccurs="0" maxOccurs="unbounded"/> + <element name="SignatureValue" type="base64Binary"/> </sequence> - <attribute name="sessionId" type="string"/> - <!--choice maxOccurs="unbounded"> - <element name="InfoboxReadRequest" type="tns:InfoboxReadRequestType"/> - <element name="SignRequest" type="tns:SignRequestType"/> - <element name="QuitRequest" type="tns:QuitRequestType"/> - </choice--> - </complexType> - <complexType name="RequestType" abstract="true"/> - <complexType name="InfoboxReadRequestType"> - <complexContent> - <extension base="tns:RequestType"> - <sequence> - <!-- enumeration IdentityLink, CertifiedKeyPair --> - <element name="InfoboxIdentifier" type="string"/> - <element name="DomainIdentifier" type="string" minOccurs="0"/> - </sequence> - </extension> - </complexContent> - </complexType> - <complexType name="SignRequestType"> - <complexContent> - <extension base="tns:RequestType"> - <sequence> - <element name="KeyIdentifier" type="string"/> - <element name="SignedInfo" type="base64Binary"/> - </sequence> - </extension> - </complexContent> - </complexType> - <complexType name="QuitRequestType"> - <complexContent> - <extension base="tns:RequestType"/> - </complexContent> - </complexType> - <complexType name="GetHashDataInputType"> + </extension> + </complexContent> + </complexType> + <complexType name="ErrorResponseType"> + <complexContent> + <extension base="tns:ResponseType"> <sequence> - <element name="Reference" maxOccurs="unbounded"> - <complexType> - <attribute name="ID" type="string"/> - </complexType> - </element> + <element name="ErrorCode" type="int"/> + <element name="ErrorMessage" type="string"/> </sequence> - <attribute name="sessionId" type="string"/> - </complexType> - <complexType name="GetHashDataInputResponseType"> + </extension> + </complexContent> + </complexType> + <complexType name="GetNextRequestResponseType"> + <!-- abstract Request/Response type not supported by JAX-WS 2.0 (jdk < 1.6.0_04) <sequence> - <element name="Reference" maxOccurs="unbounded"> - <complexType> - <simpleContent> - <extension base="base64Binary"> - <attribute name="ID" type="string"/> - <attribute name="MimeType" type="string" use="optional"/> - <attribute name="Encoding" type="string" use="optional"/> - </extension> - </simpleContent> - </complexType> - </element> + <element name="Request" type="tns:RequestType" minOccurs="0" maxOccurs="unbounded"/> + </sequence--> + <choice maxOccurs="unbounded"> + <element name="InfoboxReadRequest" type="tns:InfoboxReadRequestType"/> + <element name="SignRequest" type="tns:SignRequestType"/> + <element name="QuitRequest" type="tns:QuitRequestType"/> + </choice> + <attribute name="SessionId" type="string"/> + </complexType> + <complexType name="RequestType" abstract="true"/> + <complexType name="InfoboxReadRequestType"> + <complexContent> + <extension base="tns:RequestType"> + <sequence> + <element name="InfoboxIdentifier"> + <simpleType> + <restriction base="string"> + <enumeration value="Certificates"/> + <enumeration value="IdentityLink"/> + <enumeration value="Mandates"/> + </restriction> + </simpleType> + </element> + <element name="DomainIdentifier" type="anyURI" minOccurs="0"/> </sequence> - <attribute name="sessionId" type="string"/> - </complexType> - <complexType name="GetHashDataInputFaultType"> + </extension> + </complexContent> + </complexType> + <complexType name="SignRequestType"> + <complexContent> + <extension base="tns:RequestType"> <sequence> - <element name="ErrorCode" type="int"/> - <element name="ErrorMessage" type="string"/> + <element name="KeyIdentifier"> + <simpleType> + <restriction base="string"> + <enumeration value="SecureSignatureKeypair"/> + <enumeration value="CertifiedKeypair"/> + </restriction> + </simpleType> + </element> + <element name="SignedInfo" type="base64Binary"/> </sequence> - </complexType> + </extension> + </complexContent> + </complexType> + <complexType name="QuitRequestType"> + <complexContent> + <extension base="tns:RequestType"/> + </complexContent> + </complexType> + <complexType name="GetHashDataInputType"> + <sequence> + <element name="Reference" maxOccurs="unbounded"> + <complexType> + <attribute name="ID" type="string"/> + </complexType> + </element> + </sequence> + <attribute name="SessionId" type="string"/> + </complexType> + <complexType name="GetHashDataInputResponseType"> + <sequence> + <element name="Reference" maxOccurs="unbounded"> + <complexType> + <simpleContent> + <extension base="base64Binary"> + <attribute name="ID" type="string"/> + <attribute name="MimeType" type="string" use="optional"/> + <attribute name="Encoding" type="string" use="optional"/> + </extension> + </simpleContent> + </complexType> + </element> + </sequence> + <attribute name="SessionId" type="string"/> + </complexType> + <complexType name="GetHashDataInputFaultType"> + <sequence> + <element name="ErrorCode" type="int"/> + <element name="ErrorMessage" type="string"/> + </sequence> + </complexType> </schema> 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 d6ce2720..8830a81c 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 @@ -32,6 +32,13 @@ import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; 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.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 at.gv.egiz.stal.service.types.SignResponseType; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -277,19 +284,19 @@ public class STALRequestBrokerTest { public void run() { try { log.debug("calling stal.nextRequest(oldResponse)"); - STALResponse oldResp = new InfoboxReadResponse(); - List<STALRequest> requests = stal.nextRequest(Collections.singletonList(oldResp)); + ResponseType oldResp = new InfoboxReadResponseType(); + List<RequestType> requests = stal.nextRequest(Collections.singletonList(oldResp)); log.debug("got " + requests.size() + " requests. processing..."); Thread.sleep(1); - List<STALResponse> responses = new ArrayList<STALResponse>(); - for (STALRequest request : requests) { - if (request instanceof InfoboxReadRequest) { + List<ResponseType> responses = new ArrayList<ResponseType>(); + for (RequestType request : requests) { + if (request instanceof InfoboxReadRequestType) { log.debug("received UNEXPECTED READINFOBOX request"); - InfoboxReadResponse r = new InfoboxReadResponse(); + InfoboxReadResponseType r = new InfoboxReadResponseType(); r.setInfoboxValue("dummyInfobox".getBytes()); responses.add(r); - } else if (request instanceof SignRequest) { + } else if (request instanceof SignRequestType) { log.debug("received UNEXPECTED SIGN request"); @@ -304,10 +311,10 @@ public class STALRequestBrokerTest { log.debug("got HashDataInput " + new String(data)); - SignResponse r = new SignResponse(); + SignResponseType r = new SignResponseType(); r.setSignatureValue("dummySignature".getBytes()); responses.add(r); - } else if (request instanceof QuitRequest) { + } else if (request instanceof QuitRequestType) { log.debug("received EXPECTED QUIT request"); return; } @@ -319,8 +326,8 @@ public class STALRequestBrokerTest { // } log.debug("calling stal.nextRequest with " + responses.size() + " responses"); requests = stal.nextRequest(responses); - for (STALRequest request : requests) { - if (request instanceof QuitRequest) { + for (RequestType request : requests) { + if (request instanceof QuitRequestType) { log.debug("got QUIT request"); } else { log.debug("expected QUIT request, got " + request.getClass().getName()); @@ -342,16 +349,16 @@ public class STALRequestBrokerTest { try { // first call w/ empty response list log.debug("calling stal.nextRequest"); - List<STALRequest> requests = stal.nextRequest(null); //new ArrayList<ResponseType>()); + List<RequestType> requests = stal.nextRequest(null); //new ArrayList<ResponseType>()); log.debug("got " + requests.size() + " requests. processing..."); Thread.sleep(1); - List<STALResponse> responses = new ArrayList<STALResponse>(); - for (STALRequest request : requests) { - if (request instanceof InfoboxReadRequest) { - InfoboxReadResponse r = new InfoboxReadResponse(); + List<ResponseType> responses = new ArrayList<ResponseType>(); + for (RequestType request : requests) { + if (request instanceof InfoboxReadRequestType) { + InfoboxReadResponseType r = new InfoboxReadResponseType(); r.setInfoboxValue("dummyInfobox".getBytes()); responses.add(r); - } else if (request instanceof SignRequest) { + } else if (request instanceof SignRequestType) { log.debug("calling stal.getCurrentHashDataInputCallback"); List<HashDataInput> hdis = stal.getHashDataInput(); @@ -364,10 +371,10 @@ public class STALRequestBrokerTest { log.debug("got HashDataInput " + new String(data)); - SignResponse r = new SignResponse(); + SignResponseType r = new SignResponseType(); r.setSignatureValue("dummySignature".getBytes()); responses.add(r); - } else if (request instanceof QuitRequest) { + } else if (request instanceof QuitRequestType) { log.debug("received UNEXPECTED QUIT request"); return; } @@ -379,8 +386,8 @@ public class STALRequestBrokerTest { // } log.debug("calling stal.nextRequest with " + responses.size() + " responses"); requests = stal.nextRequest(responses); - for (STALRequest request : requests) { - if (request instanceof QuitRequest) { + for (RequestType request : requests) { + if (request instanceof QuitRequestType) { log.debug("got QUIT request"); } else { log.debug("expected QUIT request, got " + request.getClass().getName()); @@ -401,12 +408,12 @@ public class STALRequestBrokerTest { try { // first call w/ empty response list log.debug("calling stal.nextRequest"); - List<STALRequest> requests = stal.nextRequest(null); //new ArrayList<ResponseType>()); + List<RequestType> requests = stal.nextRequest(null); //new ArrayList<ResponseType>()); log.debug("got " + requests.size() + " requests. processing..."); Thread.sleep(1); - for (STALRequest request : requests) { + for (RequestType request : requests) { // if (request instanceof InfoboxReadRequest) { - if (request instanceof SignRequest) { + if (request instanceof SignRequestType) { log.debug("calling stal.getCurrentHashDataInputCallback"); List<HashDataInput> hdis = stal.getHashDataInput(); assertNotNull(hdis); @@ -416,7 +423,7 @@ public class STALRequestBrokerTest { byte[] data = new byte[hd.available()]; hd.read(data); log.debug("got HashDataInput " + new String(data)); - } else if (request instanceof QuitRequest) { + } else if (request instanceof QuitRequestType) { log.debug("received UNEXPECTED QUIT requests"); return; } diff --git a/STAL/src/main/java/at/gv/egiz/stal/HashDataInput.java b/STAL/src/main/java/at/gv/egiz/stal/HashDataInput.java index 1c648531..62c25fc4 100644 --- a/STAL/src/main/java/at/gv/egiz/stal/HashDataInput.java +++ b/STAL/src/main/java/at/gv/egiz/stal/HashDataInput.java @@ -1,7 +1,19 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ +* 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; diff --git a/STAL/src/main/java/at/gv/egiz/stal/STALRequest.java b/STAL/src/main/java/at/gv/egiz/stal/STALRequest.java index 0c3f88c2..226ac277 100644 --- a/STAL/src/main/java/at/gv/egiz/stal/STALRequest.java +++ b/STAL/src/main/java/at/gv/egiz/stal/STALRequest.java @@ -19,7 +19,8 @@ package at.gv.egiz.stal; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlSeeAlso; +//import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; @@ -43,11 +44,11 @@ import javax.xml.bind.annotation.XmlType; */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "RequestType") -@XmlSeeAlso({ - SignRequest.class, - InfoboxReadRequest.class, - QuitRequest.class -}) +//@XmlSeeAlso({ +// SignRequest.class, +// InfoboxReadRequest.class, +// QuitRequest.class +//}) public abstract class STALRequest { diff --git a/STAL/src/main/java/at/gv/egiz/stal/STALResponse.java b/STAL/src/main/java/at/gv/egiz/stal/STALResponse.java index 91ef3c24..f561a2aa 100644 --- a/STAL/src/main/java/at/gv/egiz/stal/STALResponse.java +++ b/STAL/src/main/java/at/gv/egiz/stal/STALResponse.java @@ -22,7 +22,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlID; import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlSeeAlso; +//import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; @@ -49,41 +49,41 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ResponseType") -@XmlSeeAlso({ - ErrorResponse.class, - SignResponse.class, - InfoboxReadResponse.class -}) +//@XmlSeeAlso({ +// ErrorResponse.class, +// SignResponse.class, +// InfoboxReadResponse.class +//}) public abstract class STALResponse { - @XmlAttribute(name = "Id") - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlID - @XmlSchemaType(name = "ID") - protected String id; - - /** - * Gets the value of the id property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getId() { - return id; - } - - /** - * Sets the value of the id property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setId(String value) { - this.id = value; - } +// @XmlAttribute(name = "Id") +// @XmlJavaTypeAdapter(CollapsedStringAdapter.class) +// @XmlID +// @XmlSchemaType(name = "ID") +// protected String id; +// +// /** +// * Gets the value of the id property. +// * +// * @return +// * possible object is +// * {@link String } +// * +// */ +// public String getId() { +// return id; +// } +// +// /** +// * Sets the value of the id property. +// * +// * @param value +// * allowed object is +// * {@link String } +// * +// */ +// public void setId(String value) { +// this.id = value; +// } } diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/GetHashDataInputFault.java b/STALService/src/main/java/at/gv/egiz/stal/service/GetHashDataInputFault.java index 4db6a91c..df42ab47 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/GetHashDataInputFault.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/GetHashDataInputFault.java @@ -1,28 +1,14 @@ -/* -* 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; import javax.xml.ws.WebFault; +import at.gv.egiz.stal.service.types.GetHashDataInputFaultType; + /** * This class was generated by the JAX-WS RI. * JAX-WS RI 2.1.3-b02- - * Generated source version: 2.1 + * Generated source version: 2.0 * */ @WebFault(name = "GetHashDataInputFault", targetNamespace = "http://www.egiz.gv.at/stal") @@ -60,7 +46,7 @@ public class GetHashDataInputFault /** * * @return - * returns fault bean: at.gv.egiz.stal.GetHashDataInputFaultType + * returns fault bean: at.gv.egiz.stal.service.types.GetHashDataInputFaultType */ public GetHashDataInputFaultType getFaultInfo() { return faultInfo; diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/STALPortType.java b/STALService/src/main/java/at/gv/egiz/stal/service/STALPortType.java index 8d1f9f9c..6ac6b10a 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/STALPortType.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/STALPortType.java @@ -1,19 +1,3 @@ -/* -* 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; @@ -22,28 +6,42 @@ import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; -import javax.xml.bind.annotation.XmlSeeAlso; +import at.gv.egiz.stal.service.types.GetHashDataInputResponseType; +import at.gv.egiz.stal.service.types.GetHashDataInputType; +import at.gv.egiz.stal.service.types.GetNextRequestResponseType; +import at.gv.egiz.stal.service.types.GetNextRequestType; + /** * This class was generated by the JAX-WS RI. * JAX-WS RI 2.1.3-b02- - * Generated source version: 2.1 + * Generated source version: 2.0 * */ @WebService(name = "STALPortType", targetNamespace = "http://www.egiz.gv.at/wsdl/stal") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -@XmlSeeAlso({ - ObjectFactory.class -}) public interface STALPortType { /** + * Initial connection, get the first request. + * + * @param sessionId + * @return + * returns at.gv.egiz.stal.service.types.GetNextRequestResponseType + */ + @WebMethod + @WebResult(name = "GetNextRequestResponse", targetNamespace = "http://www.egiz.gv.at/stal", partName = "part1") + public GetNextRequestResponseType connect( + @WebParam(name = "SessionId", targetNamespace = "http://www.egiz.gv.at/stal", partName = "part1") + String sessionId); + + /** * Fetch the next request. * * @param request * @return - * returns at.gv.egiz.stal.GetNextRequestResponseType + * returns at.gv.egiz.stal.service.types.GetNextRequestResponseType */ @WebMethod(operationName = "nextRequest") @WebResult(name = "GetNextRequestResponse", targetNamespace = "http://www.egiz.gv.at/stal", partName = "part1") @@ -56,7 +54,7 @@ public interface STALPortType { * * @param request * @return - * returns at.gv.egiz.stal.GetHashDataInputResponseType + * returns at.gv.egiz.stal.service.types.GetHashDataInputResponseType * @throws GetHashDataInputFault */ @WebMethod diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/STALService.java b/STALService/src/main/java/at/gv/egiz/stal/service/STALService.java index 7023b02a..d4b58af9 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/STALService.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/STALService.java @@ -1,36 +1,18 @@ -/* -* 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; -import java.net.MalformedURLException; import java.net.URL; import java.util.logging.Logger; import javax.xml.namespace.QName; import javax.xml.ws.Service; import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceFeature; /** * This class was generated by the JAX-WS RI. * JAX-WS RI 2.1.3-b02- - * Generated source version: 2.1 + * Generated source version: 2.0 * */ @WebServiceClient(name = "STALService", targetNamespace = "http://www.egiz.gv.at/wsdl/stal") @@ -54,16 +36,4 @@ public class STALService return super.getPort(new QName("http://www.egiz.gv.at/wsdl/stal", "STALPort"), STALPortType.class); } - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. - * @return - * returns STALPortType - */ - @WebEndpoint(name = "STALPort") - public STALPortType getSTALPort(WebServiceFeature... features) { - return super.getPort(new QName("http://www.egiz.gv.at/wsdl/stal", "STALPort"), STALPortType.class, features); - } - } diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/package-info.java b/STALService/src/main/java/at/gv/egiz/stal/service/package-info.java deleted file mode 100644 index eb3e29dd..00000000 --- a/STALService/src/main/java/at/gv/egiz/stal/service/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* -* 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. -*/ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.egiz.gv.at/stal", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package at.gv.egiz.stal.service; diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/types/ErrorResponseType.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/ErrorResponseType.java new file mode 100644 index 00000000..14ae0d39 --- /dev/null +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/ErrorResponseType.java @@ -0,0 +1,84 @@ + +package at.gv.egiz.stal.service.types; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for ErrorResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="ErrorResponseType"> + * <complexContent> + * <extension base="{http://www.egiz.gv.at/stal}ResponseType"> + * <sequence> + * <element name="ErrorCode" type="{http://www.w3.org/2001/XMLSchema}int"/> + * <element name="ErrorMessage" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </extension> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ErrorResponseType", propOrder = { + "errorCode", + "errorMessage" +}) +public class ErrorResponseType + extends ResponseType +{ + + @XmlElement(name = "ErrorCode") + protected int errorCode; + @XmlElement(name = "ErrorMessage", required = true) + protected String errorMessage; + + /** + * Gets the value of the errorCode property. + * + */ + public int getErrorCode() { + return errorCode; + } + + /** + * Sets the value of the errorCode property. + * + */ + public void setErrorCode(int value) { + this.errorCode = value; + } + + /** + * Gets the value of the errorMessage property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getErrorMessage() { + return errorMessage; + } + + /** + * Sets the value of the errorMessage property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setErrorMessage(String value) { + this.errorMessage = value; + } + +} diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/GetHashDataInputFaultType.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/GetHashDataInputFaultType.java index 5301a3bd..bf9f96ab 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/GetHashDataInputFaultType.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/GetHashDataInputFaultType.java @@ -1,21 +1,5 @@ -/* -* 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; +package at.gv.egiz.stal.service.types; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/GetHashDataInputResponseType.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/GetHashDataInputResponseType.java index f02d1ce6..7536d936 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/GetHashDataInputResponseType.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/GetHashDataInputResponseType.java @@ -1,21 +1,5 @@ -/* -* 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; + +package at.gv.egiz.stal.service.types; import java.util.ArrayList; import java.util.List; @@ -49,7 +33,7 @@ import javax.xml.bind.annotation.XmlValue; * </complexType> * </element> * </sequence> - * <attribute name="sessionId" type="{http://www.w3.org/2001/XMLSchema}string" /> + * <attribute name="SessionId" type="{http://www.w3.org/2001/XMLSchema}string" /> * </restriction> * </complexContent> * </complexType> @@ -65,7 +49,7 @@ public class GetHashDataInputResponseType { @XmlElement(name = "Reference", required = true) protected List<GetHashDataInputResponseType.Reference> reference; - @XmlAttribute + @XmlAttribute(name = "SessionId") protected String sessionId; /** diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/GetHashDataInputType.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/GetHashDataInputType.java index 970b0744..5309482a 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/GetHashDataInputType.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/GetHashDataInputType.java @@ -1,21 +1,5 @@ -/* -* 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; +package at.gv.egiz.stal.service.types; import java.util.ArrayList; import java.util.List; @@ -46,7 +30,7 @@ import javax.xml.bind.annotation.XmlType; * </complexType> * </element> * </sequence> - * <attribute name="sessionId" type="{http://www.w3.org/2001/XMLSchema}string" /> + * <attribute name="SessionId" type="{http://www.w3.org/2001/XMLSchema}string" /> * </restriction> * </complexContent> * </complexType> @@ -62,7 +46,7 @@ public class GetHashDataInputType { @XmlElement(name = "Reference", required = true) protected List<GetHashDataInputType.Reference> reference; - @XmlAttribute + @XmlAttribute(name = "SessionId") protected String sessionId; /** diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/GetNextRequestResponseType.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/GetNextRequestResponseType.java index 7a723431..6f8204cc 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/GetNextRequestResponseType.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/GetNextRequestResponseType.java @@ -1,29 +1,13 @@ -/* -* 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; +package at.gv.egiz.stal.service.types; -import at.gv.egiz.stal.STALRequest; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlType; @@ -36,10 +20,12 @@ import javax.xml.bind.annotation.XmlType; * <complexType name="GetNextRequestResponseType"> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="Request" type="{http://www.egiz.gv.at/stal}RequestType" maxOccurs="unbounded" minOccurs="0"/> - * </sequence> - * <attribute name="sessionId" type="{http://www.w3.org/2001/XMLSchema}string" /> + * <choice maxOccurs="unbounded"> + * <element name="InfoboxReadRequest" type="{http://www.egiz.gv.at/stal}InfoboxReadRequestType"/> + * <element name="SignRequest" type="{http://www.egiz.gv.at/stal}SignRequestType"/> + * <element name="QuitRequest" type="{http://www.egiz.gv.at/stal}QuitRequestType"/> + * </choice> + * <attribute name="SessionId" type="{http://www.w3.org/2001/XMLSchema}string" /> * </restriction> * </complexContent> * </complexType> @@ -49,42 +35,48 @@ import javax.xml.bind.annotation.XmlType; */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "GetNextRequestResponseType", propOrder = { - "request" + "infoboxReadRequestOrSignRequestOrQuitRequest" }) public class GetNextRequestResponseType { - @XmlElement(name = "Request") - protected List<STALRequest> request; - @XmlAttribute + @XmlElements({ + @XmlElement(name = "InfoboxReadRequest", type = InfoboxReadRequestType.class), + @XmlElement(name = "QuitRequest", type = QuitRequestType.class), + @XmlElement(name = "SignRequest", type = SignRequestType.class) + }) + protected List<RequestType> infoboxReadRequestOrSignRequestOrQuitRequest; + @XmlAttribute(name = "SessionId") protected String sessionId; /** - * Gets the value of the request property. + * Gets the value of the infoboxReadRequestOrSignRequestOrQuitRequest property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. - * This is why there is not a <CODE>set</CODE> method for the request property. + * This is why there is not a <CODE>set</CODE> method for the infoboxReadRequestOrSignRequestOrQuitRequest property. * * <p> * For example, to add a new item, do as follows: * <pre> - * getRequest().add(newItem); + * getInfoboxReadRequestOrSignRequestOrQuitRequest().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list - * {@link STALRequest } + * {@link InfoboxReadRequestType } + * {@link QuitRequestType } + * {@link SignRequestType } * * */ - public List<STALRequest> getRequest() { - if (request == null) { - request = new ArrayList<STALRequest>(); + public List<RequestType> getInfoboxReadRequestOrSignRequestOrQuitRequest() { + if (infoboxReadRequestOrSignRequestOrQuitRequest == null) { + infoboxReadRequestOrSignRequestOrQuitRequest = new ArrayList<RequestType>(); } - return this.request; + return this.infoboxReadRequestOrSignRequestOrQuitRequest; } /** diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/GetNextRequestType.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/GetNextRequestType.java index 410f1d8d..eab3d40b 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/GetNextRequestType.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/GetNextRequestType.java @@ -1,29 +1,13 @@ -/* -* 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; +package at.gv.egiz.stal.service.types; -import at.gv.egiz.stal.STALResponse; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlType; @@ -36,10 +20,12 @@ import javax.xml.bind.annotation.XmlType; * <complexType name="GetNextRequestType"> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="Response" type="{http://www.egiz.gv.at/stal}ResponseType" maxOccurs="unbounded" minOccurs="0"/> - * </sequence> - * <attribute name="sessionId" type="{http://www.w3.org/2001/XMLSchema}string" /> + * <choice maxOccurs="unbounded"> + * <element name="InfoboxReadResponse" type="{http://www.egiz.gv.at/stal}InfoboxReadResponseType"/> + * <element name="SignResponse" type="{http://www.egiz.gv.at/stal}SignResponseType"/> + * <element name="ErrorResponse" type="{http://www.egiz.gv.at/stal}ErrorResponseType"/> + * </choice> + * <attribute name="SessionId" type="{http://www.w3.org/2001/XMLSchema}string" /> * </restriction> * </complexContent> * </complexType> @@ -49,42 +35,48 @@ import javax.xml.bind.annotation.XmlType; */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "GetNextRequestType", propOrder = { - "response" + "infoboxReadResponseOrSignResponseOrErrorResponse" }) public class GetNextRequestType { - @XmlElement(name = "Response") - protected List<STALResponse> response; - @XmlAttribute + @XmlElements({ + @XmlElement(name = "SignResponse", type = SignResponseType.class), + @XmlElement(name = "InfoboxReadResponse", type = InfoboxReadResponseType.class), + @XmlElement(name = "ErrorResponse", type = ErrorResponseType.class) + }) + protected List<ResponseType> infoboxReadResponseOrSignResponseOrErrorResponse; + @XmlAttribute(name = "SessionId") protected String sessionId; /** - * Gets the value of the response property. + * Gets the value of the infoboxReadResponseOrSignResponseOrErrorResponse property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. - * This is why there is not a <CODE>set</CODE> method for the response property. + * This is why there is not a <CODE>set</CODE> method for the infoboxReadResponseOrSignResponseOrErrorResponse property. * * <p> * For example, to add a new item, do as follows: * <pre> - * getResponse().add(newItem); + * getInfoboxReadResponseOrSignResponseOrErrorResponse().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list - * {@link STALResponse } + * {@link SignResponseType } + * {@link InfoboxReadResponseType } + * {@link ErrorResponseType } * * */ - public List<STALResponse> getResponse() { - if (response == null) { - response = new ArrayList<STALResponse>(); + public List<ResponseType> getInfoboxReadResponseOrSignResponseOrErrorResponse() { + if (infoboxReadResponseOrSignResponseOrErrorResponse == null) { + infoboxReadResponseOrSignResponseOrErrorResponse = new ArrayList<ResponseType>(); } - return this.response; + return this.infoboxReadResponseOrSignResponseOrErrorResponse; } /** diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/types/InfoboxReadRequestType.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/InfoboxReadRequestType.java new file mode 100644 index 00000000..0ab6f5f3 --- /dev/null +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/InfoboxReadRequestType.java @@ -0,0 +1,102 @@ + +package at.gv.egiz.stal.service.types; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for InfoboxReadRequestType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="InfoboxReadRequestType"> + * <complexContent> + * <extension base="{http://www.egiz.gv.at/stal}RequestType"> + * <sequence> + * <element name="InfoboxIdentifier"> + * <simpleType> + * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> + * <enumeration value="Certificates"/> + * <enumeration value="IdentityLink"/> + * <enumeration value="Mandates"/> + * </restriction> + * </simpleType> + * </element> + * <element name="DomainIdentifier" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/> + * </sequence> + * </extension> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "InfoboxReadRequestType", propOrder = { + "infoboxIdentifier", + "domainIdentifier" +}) +public class InfoboxReadRequestType + extends RequestType +{ + + @XmlElement(name = "InfoboxIdentifier", required = true) + protected String infoboxIdentifier; + @XmlElement(name = "DomainIdentifier") + @XmlSchemaType(name = "anyURI") + protected String domainIdentifier; + + /** + * Gets the value of the infoboxIdentifier property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getInfoboxIdentifier() { + return infoboxIdentifier; + } + + /** + * Sets the value of the infoboxIdentifier property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setInfoboxIdentifier(String value) { + this.infoboxIdentifier = value; + } + + /** + * Gets the value of the domainIdentifier property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDomainIdentifier() { + return domainIdentifier; + } + + /** + * Sets the value of the domainIdentifier property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDomainIdentifier(String value) { + this.domainIdentifier = value; + } + +} diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/types/InfoboxReadResponseType.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/InfoboxReadResponseType.java new file mode 100644 index 00000000..1d88737d --- /dev/null +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/InfoboxReadResponseType.java @@ -0,0 +1,62 @@ + +package at.gv.egiz.stal.service.types; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for InfoboxReadResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="InfoboxReadResponseType"> + * <complexContent> + * <extension base="{http://www.egiz.gv.at/stal}ResponseType"> + * <sequence> + * <element name="InfoboxValue" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/> + * </sequence> + * </extension> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "InfoboxReadResponseType", propOrder = { + "infoboxValue" +}) +public class InfoboxReadResponseType + extends ResponseType +{ + + @XmlElement(name = "InfoboxValue", required = true) + protected byte[] infoboxValue; + + /** + * Gets the value of the infoboxValue property. + * + * @return + * possible object is + * byte[] + */ + public byte[] getInfoboxValue() { + return infoboxValue; + } + + /** + * Sets the value of the infoboxValue property. + * + * @param value + * allowed object is + * byte[] + */ + public void setInfoboxValue(byte[] value) { + this.infoboxValue = ((byte[]) value); + } + +} diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/ObjectFactory.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/ObjectFactory.java index 11ad1101..d485f1e1 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/ObjectFactory.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/ObjectFactory.java @@ -1,29 +1,6 @@ -/* -* 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; - - -import at.gv.egiz.stal.ErrorResponse; -import at.gv.egiz.stal.InfoboxReadRequest; -import at.gv.egiz.stal.InfoboxReadResponse; -import at.gv.egiz.stal.QuitRequest; -import at.gv.egiz.stal.SignRequest; -import at.gv.egiz.stal.SignResponse; + +package at.gv.egiz.stal.service.types; + import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlElementDecl; import javax.xml.bind.annotation.XmlRegistry; @@ -33,7 +10,7 @@ import javax.xml.namespace.QName; /** * This object contains factory methods for each * Java content interface and Java element interface - * generated in the at.gv.egiz.stal package. + * generated in the at.gv.egiz.stal.service.types package. * <p>An ObjectFactory allows you to programatically * construct new instances of the Java representation * for XML content. The Java representation of XML @@ -52,9 +29,10 @@ public class ObjectFactory { private final static QName _GetNextRequestResponse_QNAME = new QName("http://www.egiz.gv.at/stal", "GetNextRequestResponse"); private final static QName _GetHashDataInputResponse_QNAME = new QName("http://www.egiz.gv.at/stal", "GetHashDataInputResponse"); private final static QName _GetNextRequest_QNAME = new QName("http://www.egiz.gv.at/stal", "GetNextRequest"); + private final static QName _SessionId_QNAME = new QName("http://www.egiz.gv.at/stal", "SessionId"); /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: at.gv.egiz.stal + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: at.gv.egiz.stal.service.types * */ public ObjectFactory() { @@ -69,99 +47,99 @@ public class ObjectFactory { } /** - * Create an instance of {@link SignRequest } + * Create an instance of {@link InfoboxReadRequestType } * */ - public SignRequest createSignRequest() { - return new SignRequest(); + public InfoboxReadRequestType createInfoboxReadRequestType() { + return new InfoboxReadRequestType(); } /** - * Create an instance of {@link GetHashDataInputResponseType } + * Create an instance of {@link GetHashDataInputResponseType.Reference } * */ - public GetHashDataInputResponseType createGetHashDataInputResponseType() { - return new GetHashDataInputResponseType(); + public GetHashDataInputResponseType.Reference createGetHashDataInputResponseTypeReference() { + return new GetHashDataInputResponseType.Reference(); } /** - * Create an instance of {@link InfoboxReadResponse } + * Create an instance of {@link ErrorResponseType } * */ - public InfoboxReadResponse createInfoboxReadResponse() { - return new InfoboxReadResponse(); + public ErrorResponseType createErrorResponseType() { + return new ErrorResponseType(); } /** - * Create an instance of {@link ErrorResponse } + * Create an instance of {@link GetHashDataInputType } * */ - public ErrorResponse createErrorResponse() { - return new ErrorResponse(); + public GetHashDataInputType createGetHashDataInputType() { + return new GetHashDataInputType(); } /** - * Create an instance of {@link GetHashDataInputFaultType } + * Create an instance of {@link SignRequestType } * */ - public GetHashDataInputFaultType createGetHashDataInputFaultType() { - return new GetHashDataInputFaultType(); + public SignRequestType createSignRequestType() { + return new SignRequestType(); } /** - * Create an instance of {@link GetHashDataInputType.Reference } + * Create an instance of {@link GetHashDataInputFaultType } * */ - public GetHashDataInputType.Reference createGetHashDataInputTypeReference() { - return new GetHashDataInputType.Reference(); + public GetHashDataInputFaultType createGetHashDataInputFaultType() { + return new GetHashDataInputFaultType(); } /** - * Create an instance of {@link InfoboxReadRequest } + * Create an instance of {@link SignResponseType } * */ - public InfoboxReadRequest createInfoboxReadRequest() { - return new InfoboxReadRequest(); + public SignResponseType createSignResponseType() { + return new SignResponseType(); } /** - * Create an instance of {@link SignResponse } + * Create an instance of {@link GetHashDataInputType.Reference } * */ - public SignResponse createSignResponse() { - return new SignResponse(); + public GetHashDataInputType.Reference createGetHashDataInputTypeReference() { + return new GetHashDataInputType.Reference(); } /** - * Create an instance of {@link GetNextRequestResponseType } + * Create an instance of {@link GetHashDataInputResponseType } * */ - public GetNextRequestResponseType createGetNextRequestResponseType() { - return new GetNextRequestResponseType(); + public GetHashDataInputResponseType createGetHashDataInputResponseType() { + return new GetHashDataInputResponseType(); } /** - * Create an instance of {@link GetHashDataInputType } + * Create an instance of {@link InfoboxReadResponseType } * */ - public GetHashDataInputType createGetHashDataInputType() { - return new GetHashDataInputType(); + public InfoboxReadResponseType createInfoboxReadResponseType() { + return new InfoboxReadResponseType(); } /** - * Create an instance of {@link QuitRequest } + * Create an instance of {@link QuitRequestType } * */ - public QuitRequest createQuitRequest() { - return new QuitRequest(); + public QuitRequestType createQuitRequestType() { + return new QuitRequestType(); } /** - * Create an instance of {@link GetHashDataInputResponseType.Reference } + * Create an instance of {@link GetNextRequestResponseType } * */ - public GetHashDataInputResponseType.Reference createGetHashDataInputResponseTypeReference() { - return new GetHashDataInputResponseType.Reference(); + public GetNextRequestResponseType createGetNextRequestResponseType() { + return new GetNextRequestResponseType(); } /** @@ -209,4 +187,13 @@ public class ObjectFactory { return new JAXBElement<GetNextRequestType>(_GetNextRequest_QNAME, GetNextRequestType.class, null, value); } + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.egiz.gv.at/stal", name = "SessionId") + public JAXBElement<String> createSessionId(String value) { + return new JAXBElement<String>(_SessionId_QNAME, String.class, null, value); + } + } diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/types/QuitRequestType.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/QuitRequestType.java new file mode 100644 index 00000000..7dc4197f --- /dev/null +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/QuitRequestType.java @@ -0,0 +1,32 @@ + +package at.gv.egiz.stal.service.types; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for QuitRequestType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="QuitRequestType"> + * <complexContent> + * <extension base="{http://www.egiz.gv.at/stal}RequestType"> + * </extension> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "QuitRequestType") +public class QuitRequestType + extends RequestType +{ + + +} diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/types/RequestType.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/RequestType.java new file mode 100644 index 00000000..32b7894f --- /dev/null +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/RequestType.java @@ -0,0 +1,30 @@ + +package at.gv.egiz.stal.service.types; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for RequestType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="RequestType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "RequestType") +public abstract class RequestType { + + +} diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/types/ResponseType.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/ResponseType.java new file mode 100644 index 00000000..c94bcbe8 --- /dev/null +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/ResponseType.java @@ -0,0 +1,30 @@ + +package at.gv.egiz.stal.service.types; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for ResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="ResponseType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ResponseType") +public abstract class ResponseType { + + +} diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/types/SignRequestType.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/SignRequestType.java new file mode 100644 index 00000000..09e30967 --- /dev/null +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/SignRequestType.java @@ -0,0 +1,97 @@ + +package at.gv.egiz.stal.service.types; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for SignRequestType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="SignRequestType"> + * <complexContent> + * <extension base="{http://www.egiz.gv.at/stal}RequestType"> + * <sequence> + * <element name="KeyIdentifier"> + * <simpleType> + * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> + * <enumeration value="SecureSignatureKeypair"/> + * <enumeration value="CertifiedKeypair"/> + * </restriction> + * </simpleType> + * </element> + * <element name="SignedInfo" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/> + * </sequence> + * </extension> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SignRequestType", propOrder = { + "keyIdentifier", + "signedInfo" +}) +public class SignRequestType + extends RequestType +{ + + @XmlElement(name = "KeyIdentifier", required = true) + protected String keyIdentifier; + @XmlElement(name = "SignedInfo", required = true) + protected byte[] signedInfo; + + /** + * Gets the value of the keyIdentifier property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getKeyIdentifier() { + return keyIdentifier; + } + + /** + * Sets the value of the keyIdentifier property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setKeyIdentifier(String value) { + this.keyIdentifier = value; + } + + /** + * Gets the value of the signedInfo property. + * + * @return + * possible object is + * byte[] + */ + public byte[] getSignedInfo() { + return signedInfo; + } + + /** + * Sets the value of the signedInfo property. + * + * @param value + * allowed object is + * byte[] + */ + public void setSignedInfo(byte[] value) { + this.signedInfo = ((byte[]) value); + } + +} diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/types/SignResponseType.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/SignResponseType.java new file mode 100644 index 00000000..a33fb34c --- /dev/null +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/SignResponseType.java @@ -0,0 +1,62 @@ + +package at.gv.egiz.stal.service.types; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for SignResponseType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="SignResponseType"> + * <complexContent> + * <extension base="{http://www.egiz.gv.at/stal}ResponseType"> + * <sequence> + * <element name="SignatureValue" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/> + * </sequence> + * </extension> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SignResponseType", propOrder = { + "signatureValue" +}) +public class SignResponseType + extends ResponseType +{ + + @XmlElement(name = "SignatureValue", required = true) + protected byte[] signatureValue; + + /** + * Gets the value of the signatureValue property. + * + * @return + * possible object is + * byte[] + */ + public byte[] getSignatureValue() { + return signatureValue; + } + + /** + * Sets the value of the signatureValue property. + * + * @param value + * allowed object is + * byte[] + */ + public void setSignatureValue(byte[] value) { + this.signatureValue = ((byte[]) value); + } + +} diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/types/package-info.java b/STALService/src/main/java/at/gv/egiz/stal/service/types/package-info.java new file mode 100644 index 00000000..3328fdc0 --- /dev/null +++ b/STALService/src/main/java/at/gv/egiz/stal/service/types/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.egiz.gv.at/stal", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package at.gv.egiz.stal.service.types; diff --git a/STALService/src/main/java/at/gv/egiz/stal/util/STALTranslator.java b/STALService/src/main/java/at/gv/egiz/stal/util/STALTranslator.java new file mode 100644 index 00000000..b8681084 --- /dev/null +++ b/STALService/src/main/java/at/gv/egiz/stal/util/STALTranslator.java @@ -0,0 +1,109 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package at.gv.egiz.stal.util; + +import at.gv.egiz.stal.ErrorResponse; +import at.gv.egiz.stal.InfoboxReadRequest; +import at.gv.egiz.stal.InfoboxReadResponse; +import at.gv.egiz.stal.QuitRequest; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.SignRequest; +import at.gv.egiz.stal.SignResponse; +import at.gv.egiz.stal.service.types.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author clemens + */ +public class STALTranslator { + + protected static final Log log = LogFactory.getLog(STALTranslator.class); + + public static List<STALRequest> translateRequests(List<RequestType> requests) { + List<STALRequest> stalRequests = new ArrayList<STALRequest>(requests.size()); + for (RequestType request : requests) { + if (request instanceof InfoboxReadRequestType) { + InfoboxReadRequest stalReq = new InfoboxReadRequest(); + stalReq.setDomainIdentifier(((InfoboxReadRequestType) request).getDomainIdentifier()); + stalReq.setInfoboxIdentifier(((InfoboxReadRequestType) request).getInfoboxIdentifier()); + stalRequests.add(stalReq); + } else if (request instanceof SignRequestType) { + SignRequest stalReq = new SignRequest(); + stalReq.setKeyIdentifier(((SignRequestType) request).getKeyIdentifier()); + stalReq.setSignedInfo(((SignRequestType) request).getSignedInfo()); + stalRequests.add(stalReq); + } else if (request instanceof QuitRequestType) { + stalRequests.add(new QuitRequest()); + } else { + log.error("unknown STALService request type: " + request.getClass()); + stalRequests = Collections.singletonList((STALRequest) new QuitRequest()); + break; + } + } + return stalRequests; + } + + public static List<ResponseType> fromSTAL(List<STALResponse> stalResponses) { + List<ResponseType> responses = new ArrayList<ResponseType>(stalResponses.size()); + for (STALResponse stalResp : stalResponses) { + if (stalResp instanceof InfoboxReadResponse) { + InfoboxReadResponseType resp = new InfoboxReadResponseType(); + resp.setInfoboxValue(((InfoboxReadResponse) stalResp).getInfoboxValue()); + responses.add(resp); + } else if (stalResp instanceof SignResponse) { + SignResponseType resp = new SignResponseType(); + resp.setSignatureValue(((SignResponse) stalResp).getSignatureValue()); + responses.add(resp); + } else if (stalResp instanceof ErrorResponse) { + ErrorResponseType resp = new ErrorResponseType(); + resp.setErrorCode(((ErrorResponse) stalResp).getErrorCode()); + resp.setErrorMessage(((ErrorResponse) stalResp).getErrorMessage()); + responses.add(resp); + } else { + log.error("unknown STAL response type: " + stalResp.getClass()); + ErrorResponseType resp = new ErrorResponseType(); + resp.setErrorCode(4000); + resp.setErrorMessage("unknown STAL response type: " + stalResp.getClass()); + responses = Collections.singletonList((ResponseType) resp); + break; + } + } + return responses; + } + + public static List<STALResponse> toSTAL(List<ResponseType> responses) { + List<STALResponse> stalResponses = new ArrayList<STALResponse>(responses.size()); + for (ResponseType resp : responses) { + if (resp instanceof InfoboxReadResponseType) { + InfoboxReadResponse stalResp = new InfoboxReadResponse(); + stalResp.setInfoboxValue(((InfoboxReadResponseType) resp).getInfoboxValue()); + stalResponses.add(stalResp); + } else if (resp instanceof SignResponseType) { + SignResponse stalResp = new SignResponse(); + stalResp.setSignatureValue(((SignResponseType) resp).getSignatureValue()); + stalResponses.add(stalResp); + } else if (resp instanceof ErrorResponseType) { + ErrorResponse stalResp = new ErrorResponse(); + stalResp.setErrorCode(((ErrorResponseType) resp).getErrorCode()); + stalResp.setErrorMessage(((ErrorResponseType) resp).getErrorMessage()); + stalResponses.add(stalResp); + } else { + log.error("unknown STALService response type: " + resp.getClass()); + ErrorResponse stalResp = new ErrorResponse(); + stalResp.setErrorCode(4000); + stalResp.setErrorMessage("unknown STALService response type: " + resp.getClass()); + stalResponses = Collections.singletonList((STALResponse) stalResp); + break; + } + } + return stalResponses; + } +} @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <modelVersion>4.0.0</modelVersion> - <groupId>at.gv.egiz</groupId> - <artifactId>bku</artifactId> - <packaging>pom</packaging> - <version>1.0-SNAPSHOT</version> - <name>BKU</name> - <url>http://bku.egiz.gv.at</url> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>bku</artifactId>
+ <packaging>pom</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>BKU</name>
+ <url>http://bku.egiz.gv.at</url>
<modules>
<module>utils</module>
<module>bkucommon</module>
@@ -18,7 +18,7 @@ <module>smccSTAL</module>
<module>STALService</module>
<module>BKUCommonGUI</module>
- <module>BKUViewer</module> + <module>BKUViewer</module>
</modules>
<developers>
<developer>
@@ -43,74 +43,74 @@ <organization>
<name>E-Government Innovation Center (EGIZ)</name>
<url>http://www.egiz.gv.at</url>
- </organization> - <build> - <pluginManagement> - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <groupId>org.apache.maven.plugins</groupId> - <version>2.0.2</version> - <configuration> - <!-- - fork>true</fork> - <executable>${java_6_sun}/bin/javac</executable> - <compilerVersion>1.6</compilerVersion - --> - <source>1.6</source> - <target>1.6</target> - <verbose>true</verbose> - <showWarnings>true</showWarnings> - </configuration> - </plugin> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <groupId>org.apache.maven.plugins</groupId> - <version>2.2-beta-2</version> - </plugin> - <plugin> - <artifactId>maven-dependency-plugin</artifactId> - <groupId>org.apache.maven.plugins</groupId> - <version>2.0</version> - </plugin> - <plugin> - <artifactId>maven-jaxb2-plugin</artifactId> - <groupId>org.jvnet.jaxb2.maven2</groupId> - <version>0.6.0</version> - </plugin> - <plugin> - <artifactId>jaxws-maven-plugin</artifactId> - <groupId>org.codehaus.mojo</groupId> - <version>1.10</version> - </plugin> - </plugins> - </pluginManagement> - <plugins> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptors> - <descriptor>${basedir}/src/main/assemblies/assembly-test.xml</descriptor> - <!-- - descriptor>${basedir}/src/main/assemblies/assembly-online.xml</descriptor> - <descriptor>${basedir}/src/main/assemblies/assembly-local.xml</descriptor> - <descriptor>${basedir}/src/main/assemblies/assembly-server.xml</descriptor - --> - </descriptors> - </configuration> - <!-- - don't include execution here, but explicitly in the execute - command (see custom goals: mvn clean package - assembly:assembly) | NOTE: Because of a quirk in Maven 2.0's - execution model relating to aggregator mojos and the - inheritance hierarchy, | we need to explicitly execute the - package phase ahead of the assembly invocation, to ensure all - modules have been built. <executions> <execution> - <phase>package</phase> <goals> <goal>attached</goal> </goals> - </execution> </executions - --> - </plugin> - </plugins> + </organization>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>2.0.2</version>
+ <configuration>
+ <!--
+ fork>true</fork>
+ <executable>${java_6_sun}/bin/javac</executable>
+ <compilerVersion>1.6</compilerVersion
+ -->
+ <source>1.6</source>
+ <target>1.6</target>
+ <verbose>true</verbose>
+ <showWarnings>true</showWarnings>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>2.2-beta-2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>2.0</version>
+ </plugin>
+ <!--plugin>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <version>0.6.0</version>
+ </plugin-->
+ <plugin>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ <version>1.10</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>${basedir}/src/main/assemblies/assembly-test.xml</descriptor>
+ <!--
+ descriptor>${basedir}/src/main/assemblies/assembly-online.xml</descriptor>
+ <descriptor>${basedir}/src/main/assemblies/assembly-local.xml</descriptor>
+ <descriptor>${basedir}/src/main/assemblies/assembly-server.xml</descriptor
+ -->
+ </descriptors>
+ </configuration>
+ <!--
+ don't include execution here, but explicitly in the execute
+ command (see custom goals: mvn clean package
+ assembly:assembly) | NOTE: Because of a quirk in Maven 2.0's
+ execution model relating to aggregator mojos and the
+ inheritance hierarchy, | we need to explicitly execute the
+ package phase ahead of the assembly invocation, to ensure all
+ modules have been built. <executions> <execution>
+ <phase>package</phase> <goals> <goal>attached</goal> </goals>
+ </execution> </executions
+ -->
+ </plugin>
+ </plugins>
</build>
<repositories>
<repository>
@@ -129,39 +129,39 @@ <url>http://download.java.net/maven/1/</url>
<layout>legacy</layout>
</repository>
- </repositories> - <dependencies> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.12</version> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.1.1</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.4</version> - <scope>test</scope> - </dependency> + </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.12</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
@@ -172,39 +172,39 @@ <artifactId>xalan</artifactId>
<version>2.7.0</version>
</dependency>
- <dependency> - <groupId>iaik</groupId> - <artifactId>iaik_jce_full_signed</artifactId> - <version>3.16</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>iaik</groupId> - <artifactId>iaik_jce_me4se</artifactId> - <version>3.04</version> - </dependency> - <dependency> - <groupId>iaik</groupId> - <artifactId>iaik_ecc_signed</artifactId> - <version>2.15</version> - </dependency> - <dependency> - <groupId>iaik</groupId> - <artifactId>iaik_xsect</artifactId> - <version>1.14</version> - </dependency> - <dependency> - <groupId>commons-fileupload</groupId> - <artifactId>commons-fileupload</artifactId> - <version>1.2.1</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <version>3.1</version> - <scope>compile</scope> - </dependency> - </dependencies> - </dependencyManagement> + <dependency>
+ <groupId>iaik</groupId>
+ <artifactId>iaik_jce_full_signed</artifactId>
+ <version>3.16</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>iaik</groupId>
+ <artifactId>iaik_jce_me4se</artifactId>
+ <version>3.04</version>
+ </dependency>
+ <dependency>
+ <groupId>iaik</groupId>
+ <artifactId>iaik_ecc_signed</artifactId>
+ <version>2.15</version>
+ </dependency>
+ <dependency>
+ <groupId>iaik</groupId>
+ <artifactId>iaik_xsect</artifactId>
+ <version>1.14</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.2.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
</project>
\ No newline at end of file diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java index f3b94078..8ee70f1a 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java @@ -65,7 +65,7 @@ public abstract class AbstractSMCCSTAL implements STAL { List<STALResponse> responseList = new ArrayList<STALResponse>(requestList .size()); for (STALRequest request : requestList) { - log.info("Processing: " + request); + log.info("Processing: " + request.getClass()); SMCCSTALRequestHandler handler = null; handler = handlerMap.get(request.getClass().getSimpleName()); if (handler != null) { @@ -78,7 +78,10 @@ public abstract class AbstractSMCCSTAL implements STAL { try { handler = handler.newInstance(); handler.init(signatureCard, getGUI()); - responseList.add(handler.handleRequest(request)); + STALResponse response = handler.handleRequest(request); + if (response != null) { + responseList.add(response); + } } catch (Exception e) { log.info("Error while handling STAL request:" + e); responseList.add(new ErrorResponse(6000)); |