From 7916c117627db0411b35f202f88b2ab6e115361a Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@d688527b-c9ab-4aba-bd8d-4036d912da1d> Date: Fri, 28 Jan 2005 14:10:50 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'MOA-ID-1_20d09'. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/tags/MOA-ID-1_20d09@264 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../spss/slinterface/moainvoker/MOAInvoker.java | 92 ---------------------- 1 file changed, 92 deletions(-) delete mode 100644 spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/moainvoker/MOAInvoker.java (limited to 'spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/moainvoker') diff --git a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/moainvoker/MOAInvoker.java b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/moainvoker/MOAInvoker.java deleted file mode 100644 index e89d255f0..000000000 --- a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/moainvoker/MOAInvoker.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Created on 19.11.2003 - * - * (c) Stabsstelle IKT-Strategie des Bundes - */ -package at.gv.egovernment.moa.spss.slinterface.moainvoker; - -import java.io.IOException; -import java.io.OutputStream; -import java.rmi.RemoteException; -import java.util.Vector; - -import javax.xml.namespace.QName; -import javax.xml.rpc.Call; -import javax.xml.rpc.Service; -import javax.xml.rpc.ServiceException; -import javax.xml.rpc.ServiceFactory; - -import org.apache.axis.message.SOAPBodyElement; -import org.apache.xml.serialize.OutputFormat; -import org.apache.xml.serialize.XMLSerializer; -import org.w3c.dom.Document; - -import at.gv.egovernment.moa.spss.slinterface.Constants; - -/** - * @author Gregor Karlinger (mailto:gregor.karlinger@cio.gv.at) - */ -public class MOAInvoker -{ - /** - * Invokes MOA SP. - * - * @param request The XML request to be sent to MOA SP. - * - * @param endpoint The endpoint of the SOAP service where to send the XML request to. - * - * @return the XML response from the service. - * - * @throws Exception if getting the XML response from the SOAP response body fails. - * - * @throws RemoteException if MOA SP signals an error. - * - * @throws ServiceException if the SOAP client invoking MOA SP signals an error. - */ - public static Document invokeSP(Document request, String endpoint) - throws Exception, RemoteException, ServiceException - { - QName serviceQName = new QName(Constants.MI_SP_QNAME_); - return invoke(request, endpoint, serviceQName); - } - - /* ---------------------------------------------------------------------------------------------------- */ - - private static Document invoke(Document request, String endpoint, QName serviceQName) throws Exception - { - // Instantiate AXIS service - Service service = ServiceFactory.newInstance().createService(serviceQName); - - // Create and configure service call - Call call = service.createCall(); - call.setTargetEndpointAddress(endpoint); - - // Create SOAP body - SOAPBodyElement body = new SOAPBodyElement(request.getDocumentElement()); - SOAPBodyElement[] params = new SOAPBodyElement[] {body}; - - // Make call - Vector responses = (Vector) call.invoke(params); - - // Get response - SOAPBodyElement responseBody = (SOAPBodyElement) responses.get(0); - Document response = responseBody.getAsDocument(); - return response; - } - - /* ---------------------------------------------------------------------------------------------------- */ - - public static void serializeDocument(Document doc, OutputStream out) throws IOException - { - OutputFormat format = new OutputFormat(doc); - - format.setLineSeparator("\n"); - format.setIndenting(false); - format.setPreserveSpace(true); - format.setOmitXMLDeclaration(false); - format.setEncoding("UTF-8"); - - XMLSerializer serializer = new XMLSerializer(out, format); - serializer.serialize(doc); - } -} -- cgit v1.2.3