|
From: <tr...@us...> - 2003-06-27 00:15:09
|
Update of /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/stage In directory sc8-pr-cvs1:/tmp/cvs-serv19206/modules/soap/src/com/babeldoc/soap/pipeline/stage Modified Files: SoapWriterPipelineStage.java Log Message: Updated the build system using an explicit modular ant task. This is better than the method previously employed which added "hidden" tasks to the build and clean etc targets. Additionally using a more robust module sorting algorithm. Index: SoapWriterPipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/stage/SoapWriterPipelineStage.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SoapWriterPipelineStage.java 8 Jun 2003 18:23:46 -0000 1.8 --- SoapWriterPipelineStage.java 27 Jun 2003 00:14:56 -0000 1.9 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/24 18:15:55 $ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.soap.pipeline.stage; --- 1,66 ---- ! /* ==================================================================== ! * The Apache Software License, Version 1.1 * + * Copyright (c) 2000 The Apache Software Foundation. All rights + * reserved. * ! * Redistribution and use in source and binary forms, with or without ! * modification, are permitted provided that the following conditions ! * are met: * ! * 1. Redistributions of source code must retain the above copyright ! * notice, this list of conditions and the following disclaimer. * ! * 2. Redistributions in binary form must reproduce the above copyright ! * notice, this list of conditions and the following disclaimer in ! * the documentation and/or other materials provided with the ! * distribution. ! * ! * 3. The end-user documentation included with the redistribution, ! * if any, must include the following acknowledgment: ! * "This product includes software developed by the ! * Apache Software Foundation (http://www.apache.org/)." ! * Alternately, this acknowledgment may appear in the software itself, ! * if and wherever such third-party acknowledgments normally appear. ! * ! * 4. The names "Apache" and "Apache Software Foundation" must ! * not be used to endorse or promote products derived from this ! * software without prior written permission. For written ! * permission, please contact ap...@ap.... ! * ! * 5. Products derived from this software may not be called "Apache", ! * nor may "Apache" appear in their name, without prior written ! * permission of the Apache Software Foundation. ! * ! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ! * SUCH DAMAGE. ! * ==================================================================== ! * ! * This software consists of voluntary contributions made by many ! * individuals on behalf of the Apache Software Foundation. For more ! * information on the Apache Software Foundation, please see ! * <http://www.apache.org/>. ! * ! * Portions of this software are based upon public domain software ! * originally written at the National Center for Supercomputing Applications, ! * University of Illinois, Urbana-Champaign. ! * ==================================================================== ! * ! * Babeldoc: The Universal Document Processor ! * ! * $Header$ ! * $DateTime$ ! * $Author$ * */ package com.babeldoc.soap.pipeline.stage; *************** *** 27,37 **** import com.babeldoc.core.option.IConfigOptionType; import com.babeldoc.core.pipeline.*; import com.babeldoc.soap.pipeline.util.SoapHelper; - import javax.xml.messaging.URLEndpoint; - import javax.xml.soap.*; import java.util.ArrayList; import java.util.Collection; /** --- 71,83 ---- import com.babeldoc.core.option.IConfigOptionType; import com.babeldoc.core.pipeline.*; + import com.babeldoc.soap.pipeline.util.SoapHelper; import java.util.ArrayList; import java.util.Collection; + import javax.xml.messaging.URLEndpoint; + import javax.xml.soap.*; + /** *************** *** 41,50 **** * @version 1.0 */ ! public class SoapWriterPipelineStage ! extends PipelineStage { ! ! public final static String SOAP_URL = "soapUrl"; ! public final static String SOAP_ACTION = "soapAction"; ! public final static String RESULT_STAGE = "resultStage"; /** --- 87,94 ---- * @version 1.0 */ ! public class SoapWriterPipelineStage extends PipelineStage { ! public static final String SOAP_URL = "soapUrl"; ! public static final String SOAP_ACTION = "soapAction"; ! public static final String RESULT_STAGE = "resultStage"; /** *************** *** 53,78 **** public SoapWriterPipelineStage() { super(new PipelineStageInfo() { ! public String getName() { ! return "SoapWriter"; ! } ! public String getDescription() { ! return I18n.get("soap.100"); ! } ! public Collection getTypeSpecificOptions() { ! ArrayList options = new ArrayList(); ! //add specific options ! options.add(new ConfigOption(SOAP_URL, IConfigOptionType.URL, null, ! false, I18n.get("soap.101"))); ! options.add(new ConfigOption(SOAP_ACTION, IConfigOptionType.STRING, ! null, false, I18n.get("soap.102"))); ! options.add(new ConfigOption(RESULT_STAGE, IConfigOptionType.STRING, ! null, true, I18n.get("soap.103"))); ! return options; ! } ! }); } --- 97,122 ---- public SoapWriterPipelineStage() { super(new PipelineStageInfo() { ! public String getName() { ! return "SoapWriter"; ! } ! public String getDescription() { ! return I18n.get("soap.100"); ! } ! public Collection getTypeSpecificOptions() { ! ArrayList options = new ArrayList(); ! //add specific options ! options.add(new ConfigOption(SOAP_URL, IConfigOptionType.URL, null, ! false, I18n.get("soap.101"))); ! options.add(new ConfigOption(SOAP_ACTION, IConfigOptionType.STRING, ! null, false, I18n.get("soap.102"))); ! options.add(new ConfigOption(RESULT_STAGE, IConfigOptionType.STRING, ! null, true, I18n.get("soap.103"))); ! return options; ! } ! }); } *************** *** 83,116 **** * @param soapAction * @param document */ public static String sendSoapMessage(String soapUrl, String soapAction, ! PipelineDocument document) throws Exception { ! // create a message ! MessageFactory mf = MessageFactory.newInstance(); ! SOAPMessage message = mf.createMessage(); ! ! // add the document from the pipeline ! SoapHelper.attachDocument(message,document); ! ! // add the SOAPAction header MimeHeaders headers = message.getMimeHeaders(); headers.addHeader("SOAPAction", soapAction); ! // establish the connection ! URLEndpoint endPoint = new URLEndpoint(soapUrl); ! SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance(); ! SOAPConnection connection = scf.createConnection(); ! ! // send the message and get the reply ! SOAPMessage reply = connection.call(message, endPoint); ! // close the connection ! connection.close(); ! ! // TODO process the reply ! // if (SoapHelper.containsFault(reply)) { ! // throw new Exception("soapFault") ! // } return null; } --- 127,163 ---- * @param soapAction * @param document + * + * @return DOCUMENT ME! + * + * @throws Exception DOCUMENT ME! */ public static String sendSoapMessage(String soapUrl, String soapAction, ! PipelineDocument document) throws Exception { ! // create a message ! MessageFactory mf = MessageFactory.newInstance(); ! SOAPMessage message = mf.createMessage(); ! ! // add the document from the pipeline ! SoapHelper.attachDocument(message, document); ! ! // add the SOAPAction header MimeHeaders headers = message.getMimeHeaders(); headers.addHeader("SOAPAction", soapAction); ! // establish the connection ! URLEndpoint endPoint = new URLEndpoint(soapUrl); ! SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance(); ! SOAPConnection connection = scf.createConnection(); ! // send the message and get the reply ! SOAPMessage reply = connection.call(message, endPoint); ! ! // close the connection ! connection.close(); + // TODO process the reply + // if (SoapHelper.containsFault(reply)) { + // throw new Exception("soapFault") + // } return null; } *************** *** 120,123 **** --- 167,172 ---- * * @return the name of the next stage in the pipe line or nothing + * + * @throws PipelineException DOCUMENT ME! */ public PipelineStageResult[] process() throws PipelineException { |