You are viewing a plain text version of this content. The canonical link for it is here.
Posted to tsik-dev@ws.apache.org by ha...@apache.org on 2005/08/08 22:03:01 UTC

svn commit: r230871 [8/61] - in /incubator/tsik/trunk: ./ data/ data/schema/ resources/ resources/junit/ src/ src/org/ src/org/apache/ src/org/apache/tsik/ src/org/apache/tsik/c14n/ src/org/apache/tsik/c14n/elements/ src/org/apache/tsik/common/ src/org...

Added: incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransport.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransport.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransport.java (added)
+++ incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransport.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,106 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.messaging;
+
+import java.io.IOException;
+import org.w3c.dom.Document;
+
+/**
+ * A transport abstraction to be used when invoking web services.
+ *
+ * <p> This interface is implemented by all transport classes.  Normally
+ * transport classes should extend {@link AbstractTransport}, which provides
+ * the common features needed by many web services. </p>
+ *
+ * <p> Transport instances may be stateful and are not intended to be used by
+ * multiple threads.  Instead, a transport instance should be constructed for
+ * each thread that needs one.  Since transports are allowed to retain state,
+ * such as the HTTP or SOAP headers that were last returned by the service,
+ * using a single transport object from multiple threads will caused undefined
+ * results.  Additionally, in the future some transports may retain session
+ * state. </p>
+ */
+public interface XmlTransport
+{
+    /**
+     * Sends the request over the transport and returns the response.
+     * Note that XmlRequest subclasses normally provide a sendRequest method
+     * which returns a subclass of XmlResponse to provide better type safety.
+     *
+     * @param req is the web service request object.
+     *
+     * @return the web service response object.
+     *
+     * @throws IOException is thrown when a transport error occurs while
+     * attempting to send the message to the service provider
+     *
+     * @throws InsecureTransportException if the
+     * XmlRequest.isSecureTransportRequired method returns true, and this
+     * transport is not secure (e.g., SSL/TLS).
+     *
+     * @throws XmlMessageException is thrown if an error occurs when generating
+     * the response.  Subclasses of XmlRequest should normally throw a subclass
+     * of XmlMessageException.
+     */
+    public XmlResponse sendRequest(XmlRequest req)
+        throws InsecureTransportException, IOException, XmlMessageException;
+
+    /**
+     * Sends the request over the transport and returns the response.
+     * Note that XmlRequest subclasses normally provide a sendRequest method
+     * which returns a subclass of XmlResponse to provide better type safety.
+     *
+     * @param request is the web service request object.
+     *
+     * @return the web service response object.
+     *
+     * @throws IOException is thrown when a transport error occurs while
+     * attempting to send the message to the service provider
+     *
+     * @throws InsecureTransportException if the
+     * XmlRequest.isSecureTransportRequired method returns true, and this
+     * transport is not secure (e.g., SSL/TLS).
+     *
+     * @throws Exception is thrown if an error occurs when generating the
+     * response.  Subclasses of XmlRequest should normally throw
+     * a subclass of Exception.
+     *
+     * @deprecated Please use {@link #sendRequest(XmlRequest)} instead, which
+     * throws XmlMessageException instead of Exception for better support of
+     * specific exception classes.
+     */
+    public XmlResponse send(XmlRequest request)
+        throws InsecureTransportException, IOException, Exception;
+
+    /** 
+     * Transmits the request message to the service and receive the response.
+     * See {@link AbstractTransport} for a description of how this method is
+     * used by the transport implementations in this package.
+     *
+     * @param request is the request message to be transmitted, and includes
+     * the message envelope if one is used.
+     *
+     * @return the response message received, and includes the message envelope
+     * if one is used.
+     *
+     * @throws IOException is thrown when a transport error occurs.
+     */
+    public Document call(Document request)
+        throws IOException;
+}

Propchange: incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransport.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportDoc.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportDoc.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportDoc.java (added)
+++ incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportDoc.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,97 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.messaging;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import org.w3c.dom.Document;
+
+/**
+ * Provide a means of logging the raw XML request documents which would have
+ * been transmitted to a web service.  Instantiate this class with an {@link
+ * OutputStream} to which the request message XML should be written.
+ */
+public class XmlTransportDoc extends AbstractTransport
+{
+    /**
+     * Creates a transport for logging request messages.
+     *
+     * @param logOutput is an output stream to which the request will be
+     * written.
+     */
+    public XmlTransportDoc(OutputStream logOutput) 
+    {
+        super(null);
+        if (logOutput != null) {
+            setLogOutput(new PrintStream(logOutput));
+        }
+    }
+
+    /**
+     * Changes the output stream used to log request messages.
+     *
+     * @param logOutput is an output stream to which the request will be
+     * written.
+     *
+     * @deprecated please use {@link #setLogOutput}.
+     */
+    public void setStream(OutputStream logOutput)
+    {
+        if (logOutput != null) {
+            setLogOutput(new PrintStream(logOutput));
+        } else {
+            setLogOutput(null);
+        }
+    }
+
+    // Intentionally inherit javadoc.
+    //
+    protected void logRequest(Document request, PrintStream log)
+    {
+        super.logRequest(request, log);
+        throw new CompletedException();
+    }
+
+    /**
+     * Overrides the normal transport mechanism to log the request message
+     * and return null.
+     *
+     * @param req is the web service request object.
+     * @return always null.
+     *
+     * @throws InsecureTransportException TODO.
+     * @throws IOException TODO.
+     * @throws XmlMessageException TODO.
+     */
+    public XmlResponse sendRequest(XmlRequest req)
+        throws InsecureTransportException, IOException, XmlMessageException
+    {
+        try {
+            super.sendRequest(req);
+            throw new IllegalStateException();
+        } catch (CompletedException e) {
+            return null;
+        }
+    }
+
+    private static class CompletedException extends RuntimeException
+    {
+    }
+}

Propchange: incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportDoc.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportNaked.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportNaked.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportNaked.java (added)
+++ incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportNaked.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,114 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.messaging;
+
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.net.URL;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.cert.X509Certificate;
+
+/**
+ * A basic HTTP/HTTPS transport with no message enveloping.  This class adds no
+ * additional behavior to {@link AbstractTransport}, which it extends.
+ */
+public class XmlTransportNaked extends AbstractTransport
+{
+    /**
+     * Creates a transport with no request signing capability.
+     *
+     * @param url is the URL of the service.
+     */
+    public XmlTransportNaked(URL url)
+    {
+        super(url);
+    }
+
+    /**
+     * Creates a transport with no request signing capability and a debug
+     * output stream.
+     *
+     * @param url is the URL of the service.
+     *
+     * @param logOutput is an output stream to which the request and response
+     * will be written for debugging purposes, in addition to normal processing.
+     */
+    public XmlTransportNaked(URL url, OutputStream logOutput)
+    {
+        super(url);
+        if (logOutput != null) {
+            setLogOutput(new PrintStream(logOutput));
+        }
+    }
+
+    /**
+     * Creates a transport with request signing capability.
+     *
+     * @param url is the URL of the service.
+     *
+     * @param signingPrivateKey contains the private key used to sign the
+     * request message, or null if the request is not to be signed.
+     *
+     * @param signingPublicKey contains the public key that will be included in
+     * the signature to identify the sender, or null if no public key is to be
+     * included.
+     */
+    public XmlTransportNaked(URL url, PrivateKey signingPrivateKey,
+                                PublicKey signingPublicKey)
+    {
+        super(url, signingPrivateKey, signingPublicKey);
+    }
+
+    /**
+     * Creates a transport with request signing capability.
+     *
+     * @param url is the URL of the service.
+     *
+     * @param signingPrivateKey contains the private key used to sign the
+     * request message, or null if the request is not to be signed.
+     *
+     * @param signingCert contains the certificate that will be included in the
+     * signature to identify the sender, or null if no certificate is to be
+     * included.
+     */
+    public XmlTransportNaked(URL url, PrivateKey signingPrivateKey,
+                                X509Certificate signingCert)
+    {
+        super(url, signingPrivateKey, signingCert);
+    }
+
+    /**
+     * Creates a transport with request signing capability.
+     *
+     * @param url is the URL of the service.
+     *
+     * @param signingPrivateKey contains the private key used to sign the
+     * request message, or null if the request is not to be signed.
+     *
+     * @param signingCertChain contains the certificate chain that will be
+     * included in the signature to identify the sender, or null if no
+     * certificate is to be included.
+     */
+    public XmlTransportNaked(URL url, PrivateKey signingPrivateKey,
+                                X509Certificate[] signingCertChain)
+    {
+        super(url, signingPrivateKey, signingCertChain);
+    }
+}

Propchange: incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportNaked.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportSecurity.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportSecurity.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportSecurity.java (added)
+++ incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportSecurity.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,177 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.messaging;
+
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.cert.X509Certificate;
+import org.apache.tsik.verifier.TrustVerifier;
+
+/**
+ * The security characteristics of an {@link XmlTransport}.
+ */ 
+public interface XmlTransportSecurity
+{
+    /** 
+     * Returns whether the transport's communications are private, e.g.,
+     * encrypted.  If this method returns false and the provider requires
+     * privacy, an exception will be thrown by {@link
+     * MessageProvider#checkTransport}.
+     *
+     * <p> This method returns true if the URL scheme is HTTPS or if privacy is
+     * provided by some other mechanism. </p>
+     *
+     * @return whether the transport's communications are private.
+     */
+    boolean isTransportPrivate();
+
+    /**
+     * Returns the custom trust verifier used to verify the certificate/key in
+     * the response signature.
+     *
+     * @return the trust verifier last passed to the setTrustVerifier method.
+     * @see #setTrustVerifier(TrustVerifier).
+     */
+    TrustVerifier getTrustVerifier();
+
+    /**
+     * Changes the trust verifier used to verify the certificate/key in the
+     * response signature.  If the trust verifier is null, it is obtained from
+     * the {@link MessageProvider#getDefaultTrustVerifier()} method.
+     *
+     * @param verifier is the trust verifier used to verify the certificate/key
+     * in the response signature.
+     * @see #getTrustVerifier().
+     */
+    void setTrustVerifier(TrustVerifier verifier);
+
+    /**
+     * Returns the signing private key.
+     *
+     * @return the private key used to sign the request message, or null if the
+     * request is not to be signed.
+     * @see #setSigningPrivateKey(PrivateKey).
+     */
+    PrivateKey getSigningPrivateKey();
+
+    /**
+     * Returns the sigingin public key.
+     *
+     * @return the public key that will be included in the signature to
+     * identify the sender, or null if no public key is to be included.
+     * @see #setSigningPublicKey(PublicKey).
+     */
+    PublicKey getSigningPublicKey();
+
+    /**
+     * Returns the signing certificate.  The signing certificate implicitly
+     * identifies the signing public key.
+     *
+     * @return the certificate that will be included in the signature to
+     * identify the sender, or null if no certificate is to be included.
+     * @see #setSigningCertificate(X509Certificate).
+     */
+    X509Certificate getSigningCertificate();
+
+    /**
+     * Changes the signing private key.
+     *
+     * @param signingPrivateKey contains the private key used to sign the
+     * request message, or null if the request is not to be signed.
+     * @see #getSigningPrivateKey().
+     */
+    void setSigningPrivateKey(PrivateKey signingPrivateKey);
+
+    /**
+     * Changes the signing public key.  This will override the signing
+     * certificate also, if any; i.e., no signing certificate will be used.
+     *
+     * @param signingPublicKey contains the public key that will be included in
+     * the signature to identify the sender, or null if no public key is to be
+     * included.
+     * @see #getSigningPublicKey().
+     */
+    void setSigningPublicKey(PublicKey signingPublicKey);
+
+    /**
+     * Changes the signing certificate.  The signing certificate implicitly
+     * identifies the signing public key, i.e., there is no need to call both
+     * {@link #setSigningPublicKey} and {@link #setSigningCertificate}.
+     *
+     * @param signingCert contains the certificate that will be included in the
+     * signature to identify the sender, or null if no certificate is to be
+     * included.
+     * @see #getSigningCertificate().
+     */
+    void setSigningCertificate(X509Certificate signingCert);
+
+    /**
+     * Returns whether HTTPS/SSL trust verification should be performed for
+     * this transport.  By default, this setting is false.
+     *
+     * <p> In addition to enabling this property, for SSL trust verification to
+     * be performed the transport protocol must be HTTPS or another SSL-based
+     * protocol. </p>
+     *
+     * @return whether HTTPS/SSL trust verification is enabled.
+     * @see #setSSLTrustVerification(boolean).
+     */
+    boolean getSSLTrustVerification();
+
+    /**
+     * Changes whether HTTPS/SSL trust verification should be performed for
+     * this transport.  By default, this setting is false.
+     *
+     * <p> In addition to enabling this property, for SSL trust verification to
+     * be performed the transport protocol must be HTTPS or another SSL-based
+     * protocol. </p>
+     *
+     * @param enabled is whether HTTPS/SSL trust verification is enabled.
+     * @see #getSSLTrustVerification().
+     */
+    void setSSLTrustVerification(boolean enabled);
+
+    /**
+     * Returns whether HTTPS/SSL client authentication should be performed for
+     * this transport.  By default, this setting is false.
+     *
+     * <p> In addition to enabling this property, for SSL client authentication
+     * to be performed the transport protocol must be HTTPS or another
+     * SSL-based protocol and a signing private key and certificate must be
+     * specified.  </p>
+     *
+     * @return whether HTTPS/SSL client authentication is enabled.
+     * @see #setSSLClientAuthentication(boolean).
+     */
+    boolean getSSLClientAuthentication();
+
+    /**
+     * Changes whether HTTPS/SSL client authentication should be performed for
+     * this transport.  By default, this setting is false.
+     *
+     * <p> In addition to enabling this property, for SSL client authentication
+     * to be performed the transport protocol must be HTTPS or another
+     * SSL-based protocol and a signing private key and certificate must be
+     * specified.  </p>
+     *
+     * @param enabled is whether HTTPS/SSL client authentication is enabled.
+     * @see #getSSLClientAuthentication().
+     */
+    void setSSLClientAuthentication(boolean enabled);
+}

Propchange: incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportSecurity.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportSoap.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportSoap.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportSoap.java (added)
+++ incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportSoap.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,230 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.messaging;
+
+import java.io.OutputStream;
+import java.net.URL;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * An HTTP/HTTPS transport that extends {@link XmlTransportNaked} to add SOAP
+ * enveloping.  This class conforms to <a
+ * href="http://www.w3.org/TR/2000/NOTE-SOAP-20000508">Simple Object Access
+ * Protocol (SOAP) 1.1</a> and should be used only with services which conform
+ * to that specification.
+ *
+ * <p> The standard SOAP envelope is added by {@link #addRequestEnvelope},
+ * which also adds any custom SOAP headers that were specified using {@link
+ * #addSoapRequestHeader}.  To obtain SOAP response headers, call {@link
+ * #getSoapResponseHeader} after calling {@link #sendRequest}.  To obtain the
+ * SOAP fault call {@link #getSoapResponseFault}. </p>
+ *
+ * <p> Note that this class uses the {@link SoapMessage} class internally for
+ * performing all SOAP header, encryption/decryption, and SOAP signing
+ * operations.  {@link SoapMessage} may also be used independently of the
+ * transport to perform these operations. </p>
+ */
+public class XmlTransportSoap extends XmlTransportNaked
+{
+    private List requestHeaders = new ArrayList();
+    private SoapMessage responseMsg;
+
+    /**
+     * Creates a transport with no request signing capability.
+     *
+     * @param url is the URL of the service.
+     */
+    public XmlTransportSoap(URL url)
+    {
+        super(url);
+    }
+
+    /**
+     * Creates a transport with no request signing capability.
+     *
+     * @param url is the URL of the service.
+     *
+     * @param debugOutput is an output stream to which the request and response
+     * will be written for debugging purposes, in addition to normal processing.
+     */
+    public XmlTransportSoap(URL url, OutputStream debugOutput)
+    {
+        super(url, debugOutput);
+    }
+
+    /**
+     * Creates a transport with request signing capability.
+     *
+     * @param url is the URL of the service.
+     *
+     * @param signingPrivateKey contains the private key used to sign the
+     * request message, or null if the request is not to be signed.
+     *
+     * @param signingPublicKey contains the public key that will be included in
+     * the signature to identify the sender, or null if no public key is to be
+     * included.
+     */
+    public XmlTransportSoap(URL url, PrivateKey signingPrivateKey,
+                            PublicKey signingPublicKey)
+    {
+        super(url, signingPrivateKey, signingPublicKey);
+    }
+
+    /**
+     * Creates a transport with request signing capability.
+     *
+     * @param url is the URL of the service.
+     *
+     * @param signingPrivateKey contains the private key used to sign the
+     * request message, or null if the request is not to be signed.
+     *
+     * @param signingCert contains the certificate that will be included in the
+     * signature to identify the sender, or null if no certificate is to be
+     * included.
+     */
+    public XmlTransportSoap(URL url, PrivateKey signingPrivateKey,
+                            X509Certificate signingCert)
+    {
+        super(url, signingPrivateKey, signingCert);
+    }
+
+    /**
+     * Creates a transport with request signing capability.
+     *
+     * @param url is the URL of the service.
+     *
+     * @param signingPrivateKey contains the private key used to sign the
+     * request message, or null if the request is not to be signed.
+     *
+     * @param signingCertChain contains the certificate chain that will be
+     * included in the signature to identify the sender, or null if no
+     * certificate is to be included.
+     */
+    public XmlTransportSoap(URL url, PrivateKey signingPrivateKey,
+                            X509Certificate[] signingCertChain)
+    {
+        super(url, signingPrivateKey, signingCertChain);
+    }
+    
+    /**
+     * Clear all custom SOAP request header blocks associated with this
+     * transport.
+     */
+    public void clearSoapRequestHeaders()
+    {
+        requestHeaders.clear();
+    }
+    
+    /**
+     * Adds a custom SOAP request header block for this transport.  Custom
+     * header blocks will be added to the SOAP header of the request message in
+     * the order they were added to the transport.
+     *
+     * @param headerBlock is a SOAP header block element conforming to the
+     * SOAP specification.
+     */
+    public void addSoapRequestHeader(Element headerBlock)
+    {
+        requestHeaders.add(headerBlock);
+    }
+
+    /**
+     * Returns all custom SOAP request header blocks.
+     *
+     * @return the array of header block elements, or an empty array if none
+     * have been specified.
+     */
+    public Element[] getSoapRequestHeaders()
+    {
+        Element[] headers = new Element[requestHeaders.size()];
+        return (Element[]) requestHeaders.toArray(headers);
+    }
+
+    /**
+     * Returns a SOAP header block from the last response message received
+     * over this transport.
+     *
+     * @param namespaceURI is the namespace of the element to be returned. A
+     * namespace is required for all SOAP header blocks.
+     *
+     * @param localName is the local name of the element to be returned.  The
+     * local name does not include the namespace prefix.
+     *
+     * @return the SOAP header block element, or null if a header with the
+     * specified namespace and element name is not found.
+     */
+    public Element getSoapResponseHeader(String namespaceURI, String localName)
+    {
+        return (responseMsg != null) ?
+                responseMsg.getHeader(namespaceURI, localName) : null;
+    }
+
+    /**
+     * Returns all SOAP header blocks from the last response message received
+     * over this transport.
+     *
+     * @return the array of SOAP header block elements.
+     */
+    public Element[] getSoapResponseHeaders()
+    {
+        return (responseMsg != null) ? responseMsg.getHeaders() : null;
+    }
+
+    /**
+     * Returns the SOAP fault from the last response message received over this
+     * transport.
+     *
+     * @return the SOAP fault, or null if no fault was present in the last
+     * response message.
+     */
+    public SoapFault getSoapResponseFault()
+    {
+        return (responseMsg != null) ? responseMsg.getFault() : null;
+    }
+
+    // inherit javadoc
+    protected void clearContext()
+    {
+        super.clearContext();
+        responseMsg = null;
+    }
+
+    // inherit javadoc
+    protected Document addRequestEnvelope(Document inputDoc)
+        throws XmlMessageException
+    {
+        SoapMessage msg = new SoapMessage(inputDoc);
+        msg.setHeaders(getSoapRequestHeaders());
+        return msg.getDocument();
+    }
+
+    // inherit javadoc
+    protected Document removeResponseEnvelope(Document wrappedOutputDoc)
+        throws XmlMessageException
+    {
+        responseMsg = new SoapMessage(wrappedOutputDoc);
+        return responseMsg.extractBody();
+    }
+}

Propchange: incubator/tsik/trunk/src/org/apache/tsik/messaging/XmlTransportSoap.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/src/org/apache/tsik/messaging/package.html
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/src/org/apache/tsik/messaging/package.html?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/src/org/apache/tsik/messaging/package.html (added)
+++ incubator/tsik/trunk/src/org/apache/tsik/messaging/package.html Mon Aug  8 12:58:58 2005
@@ -0,0 +1,352 @@
+<html>
+<!-- $Id: package.html,v 1.1 2002/08/30 14:53:21 mark Exp $ -->
+<body>
+The messaging framework.
+<p> Provides an XML messaging framework for accessing web services. </p>
+
+<p> The following tasks can be performed using this package. </p>
+<ul>
+<li> Create a transport for sending and receiving XML messages to a web
+service's URL address.  This is done in conjunction with the use of a web
+service API. </li>
+<li> Specify signing keys and certificates that are used to protect the
+integrity of the request message and authenticate the sender. </li>
+<li> Specify a trust verifier for determining whether the service's response
+signing key is trusted.  This overrides the default trust verifier for a web
+service API. </li>
+<li> Cause all request and response messages to be logged to a file for 
+debugging and troubleshooting. </li>
+<li> Enable schema validation of request and response messages. </li>
+<li> Customize the transport mechanism in various ways, including using custom
+HTTP headers or SOAP headers. </li>
+<li> Customize the behavior of a web service API by overriding its message
+provider behavior. </li>
+<li> Create a new web service API by implementing a new message provider. </li>
+</ul>
+
+<blockquote>
+<a href="#framework">The Messaging Framework</a><br />
+<a href="#transports">Using Message Transports</a><br />
+<a href="#sign">Specifying Request Message Signing Information</a><br />
+<a href="#verify">Trust Verification of Response Messages</a><br />
+<a href="#validate">Enabling Schema Validation</a><br />
+<a href="#debug">Troubleshooting and Debugging</a><br />
+<a href="#custom">Customizing Transport Behavior</a><br />
+<a href="#provider">Customizing the Message Provider</a><br />
+<a href="#impl">Implementing a Web Service API with the Messaging Framework</a>
+</blockquote>
+
+<p> The API for each web service is built on the messaging framework.  The
+messaging framework has the following parts. </p> 
+<ul>
+<li> Each web service API provides request and response classes which describe
+the messages sent to, and received from, the service.  These messages implement
+the {@link org.apache.tsik.messaging.XmlRequest} and {@link
+org.apache.tsik.messaging.XmlResponse} interfaces. </li>
+<li> A transport object is used to send a request to the service.  Transport
+classes for HTTP/HTTPS and SOAP are provided in the messaging package. These
+may be extended by classes in the web service API or in the application.  All
+transport classes implement the {@link org.apache.tsik.messaging.XmlTransport}
+interface. </li>
+<li> Each web service API includes a {@link
+org.apache.tsik.messaging.MessageProvider} object which is responsible for
+translating request and response objects to and from their XML respresentation.
+It also provides other information about the service interface, such as the
+location of the signatures in the messages. </li>
+</ul>
+
+<h3><a name="transports">Using Message Transports</a></h3>
+
+<p> A transport object is used to send a message to a web service.  Typically
+either the {@link org.apache.tsik.messaging.XmlTransportSoap} or {@link
+org.apache.tsik.messaging.XmlTransportNaked} class is used, depending on whether
+SOAP is supported by the service. </p>
+
+<p> Some web services may also accept signed and/or encrypted SOAP messages, in
+which case the {@link org.apache.tsik.messaging.XmlTransportSoap} class is used.
+operations.  {@link org.apache.tsik.messaging.SoapMessage} may also be used
+independently of the transport to implement a web service client, gateway, or
+SOAP router.  SOAP signing and encryption conforms to the WS-Security
+specification (<a
+href="http://www.ibm.com/developerworks/library/ws-secure/">http://www.ibm.com/developerworks/library/ws-secure/</a>).
+</p>
+
+<p> The steps for sending a message over a transport are as follows. </p>
+<ol>
+<li> Create a transport object with the URL of the web service.  A single
+transport object can be used for any number of requests.
+  <pre>  XmlTransportSoap transport = new XmlTransportSoap(serviceURL); </pre>
+</li>
+<li> Create a request object.  For the specific request class to use, see the
+web service's API.
+  <pre>  ABCRequest request = new ABCRequest(...); </pre>
+</li>
+<li> Send the request object over the transport. The first example below shows
+the recommended technique, which avoids casting the response message.  The
+second example can be used with any request class, but casting the response is
+usually necessary.
+<pre>  ABCResponse response = request.sendRequest(transport);</pre>
+    or
+<pre>  ABCResponse response = (ABCResponse) transport.sendRequest(request);</pre>
+</li>
+</ol>
+
+<p> To determine which transports may be used, see the documentation for the
+web service you are using. </p>
+
+<p> In addition to the service URL, some web services require messaging
+signature information to be specified for signing the request and verifying the
+signature of the response.  This is described in the following two sections.
+</p>
+
+<h3><a name="sign">Specifying Request Message Signing Information</a></h3>
+
+<p> Many web services require or allow request messages to be signed by the
+client application.  This may be to provide message integrity, to allow
+authentication of the client, or both. To determine whether a signing key is
+needed and how to obtain one, see the documentation for the web service you are
+using. </p>
+
+<p> If the web service requires that the request message be signed, the
+application must supply a private key and either a public key or a certificate.
+The private key is used to sign the request message, and the public key or
+certificate is placed in the signature to identify the sender. </p>
+
+<p> The signing key information may be specified in the transport constructor
+or using a setter method.  Each transport class supplies a constructor for
+specifying a private key and public key, and another constructor for specifying
+a private key and a certificate.  The following setter methods are also
+provided in the {@link org.apache.tsik.messaging.XmlTransportSecurity} interface,
+which is implemented by {@link org.apache.tsik.messaging.AbstractTransport} and
+all its subclasses.  </p>
+<ul>
+<li> {@link org.apache.tsik.messaging.XmlTransportSecurity#setSigningPrivateKey}
+</li>
+<li> {@link org.apache.tsik.messaging.XmlTransportSecurity#setSigningPublicKey}
+</li>
+<li> {@link org.apache.tsik.messaging.XmlTransportSecurity#setSigningCertificate}
+</li>
+</ul>
+
+<p> The following example uses a signing key and certificate to construct a
+transport object. </p>
+<pre>
+  import java.security.PrivateKey;
+  import java.security.cert.X509Certificate;
+  ...
+  PrivateKey privateKey = ...;
+  X509Certificate certificate = ...;
+  XmlTransportSoap transport = new XmlTransportSoap(serviceURL, privateKey,
+                                                    certificate); </pre>
+
+<p> Note that the transport and message provider cooperate to sign the request
+message in the manner required by the web service being used.  For example, if
+the signature must be placed in the SOAP message body or SOAP is not used,
+the message provider supplies information to the transport about where the
+signature should be located in the message.  This takes place transparently to
+the application; however, the application must use a transport that is
+supported by the web service as described in the web service's documentation.
+</p>
+
+<h3><a name="verify">Trust Verification of Response Messages</a></h3>
+
+<p> Many web services sign the response message to provide message integrity,
+to allow authentication of the service, or both.  The transport automatically
+verifies the signature of the response message.  In addition, the tranport
+uses a {@link org.apache.tsik.verifier.TrustVerifier} to determine whether
+the key used to sign the response is trusted. </p>
+
+<p> The message provider, which is supplied transparently by the web service,
+supplies a default trust verifier to the transport via the {@link
+org.apache.tsik.messaging.MessageProvider#getDefaultTrustVerifier} method.
+Typically the default trust verifier checks that the signing key is known to be
+a valid signing key for the particular web service in use.  To determine the
+specific behavior of the default trust verifier, see the web service's
+documenation. </p>
+
+<p> The behavior of the default trust verifier is sufficient for the needs of
+most applications.  However, applications may override default trust
+verification if additional checking of the signing key is desired.
+Applications may call {@link
+org.apache.tsik.messaging.XmlTransportSecurity#setTrustVerifier} to supply a custom
+trust verifier for the transport.  Applications may also override the {@link
+org.apache.tsik.messaging.MessageProvider#getDefaultTrustVerifier} method, as
+described <a href="#provider">below</a>. </p>
+
+<h3><a name="validate">Enabling Schema Validation</a></h3>
+
+<p> <em>Note:</em> Schema validation is not supported yet.</a>.</p>
+
+<p> Schema validation of request and response messages may optionally be
+performed by the transport.  Schema validation can be enabled temporarily
+during debugging, or permanently if extra reliability and error reporting is
+desired.  Note that schema validation does require extra processing. </p>
+
+<p> By default, schema validation is disabled.  To enable schema validation,
+call {@link
+org.apache.tsik.messaging.AbstractTransport#setRequestSchemaValidation} and/or
+{@link org.apache.tsik.messaging.AbstractTransport#setResponseSchemaValidation}.
+</p>
+
+<p> The schema documents used to validate request and response messages are
+supplied transparently by the message provider.  These schema documents are
+specific to the web service.  To use different schema documents, the
+application must supply a custom message provider (see <a
+href="#provider">below</a>) and override the {@link
+org.apache.tsik.messaging.MessageProvider#getSchemaDocuments} method. </p>
+
+<h3><a name="debug">Troubleshooting and Debugging</a></h3>
+
+<p> When a message is sent over a transport, the exceptions and errors that can
+occur are defined by the web service.  For example, a service that accepts a
+single transaction per request typically throws an exception if an error is
+returned in the response message.  On the other hand, a service that accepts
+multiple transactions per request typically returns error information in the
+response rather than throwing an exception; this is important since some
+transactions may fail while others succeed. </p>
+
+<p> When an exception is thrown during message processing, it is normally a a
+subclass of {@link org.apache.tsik.messaging.XmlMessageException}.  This exception
+class allows retrieving the underlying XML document that was being processed
+via the {@link org.apache.tsik.messaging.XmlMessageException#getXML} method.
+Printing the contents of this document can prove useful for determining the
+cause of the error. </p>
+
+<p> In addition, logging of all request and response message can be enabled
+by calling {@link org.apache.tsik.messaging.AbstractTransport#setLogOutput}.
+The messages printed will include SOAP enveloping and signatures. </p>
+
+<h3><a name="custom">Customizing Transport Behavior</a></h3>
+
+<p> {@link org.apache.tsik.messaging.AbstractTransport} is the base class for all
+transports in the messaging package.  It uses the standard {@link
+java.net.URLConnection} class to send XML messages over HTTP/HTTPS.  To
+customize HTTP/HTTPS behavior (e.g., to set custom HTTP headers) a subclass of
+the desired transport should be defined.  In this subclass the {@link
+org.apache.tsik.messaging.AbstractTransport#beforeConnect} and/or {@link
+org.apache.tsik.messaging.AbstractTransport#afterConnect} methods can be overriden
+to access the {@link java.net.URLConnection} object. </p>
+
+<p> It is also possible to get and set SOAP headers when using {@link
+org.apache.tsik.messaging.XmlTransportSoap}.  See the {@link
+org.apache.tsik.messaging.XmlTransportSoap} class for details. </p>
+
+<p> See {@link org.apache.tsik.messaging.AbstractTransport} for information on
+overriding other aspects of transport behavior. </p>
+
+<h3><a name="provider">Customizing the Message Provider</a></h3>
+
+<p> Normally the web service API transparently supplies the message provider
+class, which is always a subclass of {@link
+org.apache.tsik.messaging.MessageProvider}.  The transport obtains the message
+provider object by calling {@link
+org.apache.tsik.messaging.XmlRequest#getProvider}. </p>
+
+<p> Typically the message provider class in the web service API, say
+ABCProvider, has two static methods named <code>getDefaultProvider</code> and
+<code>setDefaultProvider</code>.  When an <code>XmlRequest</code> is
+constructed, the web service API calls
+<code>ABCProvider.getDefaultProvider</code> and then passes the provider to
+<code>XmlRequest.setProvider</code>.  <code>XmlRequest.getProvider</code> then
+returns the provider when it is needed by the transport. </p>
+
+<p> To use a different message provider class, the application should construct
+the custom provider and then do one of the following: </p>
+<ol>
+<li> Call XmlRequest.setProvider after constructing a request message.  Use
+this technique to replace the provider for selected request messages. </li>
+<li> Call ABCProvider.setDefaultProvider before constructing a request. Use
+this technique to replace the provider for all request messages. </li>
+</ol>
+
+<p> To customize the message provider the application should supply a subclass
+of the web service API's default message provider, overriding only the methods
+necessary.  Examples of overriding methods to supply custom behavior are: </p>
+<ul>
+<li> {@link org.apache.tsik.messaging.MessageProvider#getDefaultTrustVerifier} can
+be overridden to return a custom trust verifier.  For example, a verifier could
+be returned that trusts a different set of certificates. </li>
+<li> {@link org.apache.tsik.messaging.MessageProvider#getSchemaDocuments} can be
+overridden to return a different set of schema documents used for message
+validation. </li>
+<li> {@link org.apache.tsik.messaging.MessageProvider#getXML} and {@link
+org.apache.tsik.messaging.MessageProvider#makeResponse} can be overridden to 
+change the way that message objects are translated to and from their XML
+representation. </li>
+</ul>
+
+<h3><a name="impl">Implementing a Web Service API with the Messaging
+Framework</a></h3>
+
+<p> A web service API provides the interface between a client application and
+a web service.  It hides the XML details of the service's request and response
+messages, and provides request and response objects in their place.  This
+section describes the requirements for creating a new web service API based on
+the messaging framework. </p>
+
+<p> A web service API provides the following classes. </p>
+<ol>
+<li> One or more request classes must be provided for each of the web service's
+different request messages.  This class must implement {@link
+org.apache.tsik.messaging.XmlRequest}, and usually does so by extending {@link
+org.apache.tsik.messaging.AbstractRequest}. </li>
+<li> One or more response classes must be provided for each of the web
+service's different response messages.  This class must implement {@link
+org.apache.tsik.messaging.XmlResponse}, and usually does so by extending {@link
+org.apache.tsik.messaging.AbstractResponse}. </li>
+<li> A message provider class must be provided which extends {@link
+org.apache.tsik.messaging.MessageProvider}.</li>
+<li> Optionally, one or more exception classes may be provided to supply
+additional information about errors that occur during message processing.
+These classes must extend {@link org.apache.tsik.messaging.XmlMessageException}.
+</li>
+<li> Optionally, a specialized transport class may be provided to perform
+specialized transport behavior; however, this will restrict applications from
+using the standard transport classes.  This class must implement {@link
+org.apache.tsik.messaging.XmlTransport} and should preferrably extend one of the
+transport classes in the messaging package. </li>
+</ol>
+
+<p> The expected behavior of each of these classes is described in the
+documentation for the interface it implements or the base class it extends:
+</p>
+<ul>
+<li> {@link org.apache.tsik.messaging.XmlRequest} </li>
+<li> {@link org.apache.tsik.messaging.XmlResponse} </li>
+<li> {@link org.apache.tsik.messaging.MessageProvider} </li>
+<li> {@link org.apache.tsik.messaging.XmlTransport} </li>
+<li> {@link org.apache.tsik.messaging.XmlTransportSecurity} </li>
+<li> {@link org.apache.tsik.messaging.AbstractTransport} </li>
+</ul>
+
+<p> Depending on the web service, different message privacy and signature
+techniques may be needed.  For example, a service may require message privacy
+via a secure transport such as HTTPS, signatures may be contained in the SOAP
+envelope or in the message body, etc.  For details, see {@link
+org.apache.tsik.messaging.XmlTransportSecurity}, {@link
+org.apache.tsik.messaging.AbstractTransport} and its subclasses in the messaging
+package. </p>
+
+<p> Translating request and response objects to/from their XML representation
+is one of the primary functions of the web service API.  There are two
+alternatives for implementing this within the messaging framework: </p>
+<ol>
+<li> The {@link org.apache.tsik.messaging.XmlRequest#getXML} and {@link
+org.apache.tsik.messaging.XmlRequest#makeResponse} methods can be implemented to
+perform the translation.  These methods are called automatically by {@link
+org.apache.tsik.messaging.AbstractTransport#sendRequest}. </li>
+<li> The {@link org.apache.tsik.messaging.MessageProvider#getXML} and {@link
+org.apache.tsik.messaging.MessageProvider#makeResponse} can be implemented to
+perform the translation.  These methods are called automatically by the default
+implementations of {@link org.apache.tsik.messaging.AbstractRequest} and {@link
+org.apache.tsik.messaging.AbstractResponse}. </li>
+</ol>
+
+<p> Option 1 is the most straightforward to implement; however, it is limited
+to a single XML representation of each request and response class.  Option 2
+allows multiple XML representations of each request and response class, since
+multiple message providers can be implemented.  For the greatest flexibility
+and control over XML schema versioning, option 2 is recommended. </p>
+
+</body>
+</html>

Propchange: incubator/tsik/trunk/src/org/apache/tsik/messaging/package.html
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/src/org/apache/tsik/messaging/tools/SendXML.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/src/org/apache/tsik/messaging/tools/SendXML.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/src/org/apache/tsik/messaging/tools/SendXML.java (added)
+++ incubator/tsik/trunk/src/org/apache/tsik/messaging/tools/SendXML.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,171 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.messaging.tools;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import org.apache.tsik.domutil.DOMWriteCursor;
+import org.apache.tsik.messaging.AbstractTransport;
+import org.apache.tsik.messaging.ServiceFailureException;
+import org.apache.tsik.messaging.SimpleRequest;
+import org.apache.tsik.messaging.SoapMessage;
+import org.apache.tsik.messaging.XmlResponse;
+import org.apache.tsik.messaging.XmlTransportNaked;
+import org.apache.tsik.resource.ResourceFactory;
+import org.apache.tsik.resource.XMLResource;
+import org.w3c.dom.Document;
+
+/**
+ * Sends XML.over HTTP.
+ *
+ * <p>Sends XML with optionally adding a SOAP envelope, setting the
+ * SOAP Action or type headers.</p>
+ *
+ */
+public class SendXML
+{
+    static byte[] rawData;
+    static XMLResource xmlres = ResourceFactory.getXMLResource();
+    static String contentType = "application/xml";
+
+    public static void main(String argv[]) throws Exception
+    {
+	URL url = null;
+	String soapAction = null;
+        boolean addSoap = false;
+        boolean raw = false;
+        for (int i = 0; i < argv.length; i += 1) {
+            if ("-help".equals(argv[i]) || "-h".equals(argv[i])) {
+                usage();
+            } else if ("-addsoap".equals(argv[i])) {
+                addSoap = true;
+            } else if ("-raw".equals(argv[i])) {
+                raw = true;
+            } else if ("-soapaction".equals(argv[i])) {
+		i += 1;
+		if (i == argv.length) usage();
+		soapAction = argv[i];
+		addSoap = true;
+            } else if ("-type".equals(argv[i])) {
+		i += 1;
+		if (i == argv.length) usage();
+		contentType = argv[i];
+                if ("NULL".equals(contentType)) contentType = null;
+		addSoap = true;
+            } else if (url == null) {
+                url = new URL(argv[i]);
+            } else {
+                usage();
+            }
+        }
+	if (url == null) usage();
+
+        Document doc = null;
+        if (raw) {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            while (true) {
+                int c = System.in.read();
+                if (c < 0) break;
+                baos.write(c);
+            }
+            rawData = baos.toByteArray();
+            DOMWriteCursor c = new DOMWriteCursor();
+            c.addUnder(null, null, "NotUsed");
+            doc = c.getDocument();
+        } else {
+            doc = xmlres.parseXML(System.in, false);
+            if (addSoap) {
+                SoapMessage msg = new SoapMessage(doc);
+                doc = msg.getDocument();
+            }
+        }
+	
+	AbstractTransport transport = new Transport(url);
+
+	if (soapAction != null) {
+	    transport.setHTTPRequestHeader("SOAPAction", soapAction);
+	}
+	try {
+	    SimpleRequest request = new SimpleRequest(doc);
+	    XmlResponse response = transport.sendRequest(request);
+	    xmlres.publish(response.getXML(), System.out);
+	} catch (ServiceFailureException e) {
+	    System.out.println("HTTP error response");
+	    if (e.getDocument() != null) {
+		xmlres.publish(e.getDocument(), System.out);
+	    } else {
+		System.out.println(new String(e.getData()));
+	    }
+	}
+    }
+
+    public static void usage()
+    {
+        System.err.println(
+        "usage: " + SendXML.class.getName() + " [options] URL < XML_FILE\n" +
+        "   [-addsoap]           # add soap envelope\n" +
+        "   [-soapaction ACTION] # add soap envelope and set action header\n" +
+        "   [-type CONTENT_TYPE  # content-type header, NULL means null\n" +
+        "   [-raw]               # don't parse, just send the file");
+        System.exit(2);
+    }
+
+    private static class Transport extends XmlTransportNaked
+    {
+        private Transport(URL url)
+        {
+            super(url);
+        }
+
+        protected void publishRequest(URLConnection conn, Document request)
+            throws IOException
+        {
+            conn.setRequestProperty("Accept", "application/xml, text/xml");
+            if (contentType != null) {
+                conn.setRequestProperty("Content-Type", contentType);
+            }
+            if (rawData != null) {
+                conn.setRequestProperty("Content-Length",
+                        String.valueOf(rawData.length));
+                System.err.println("Sending: " +
+                        conn.getRequestProperty("Content-Type") + ' ' +
+                        rawData.length);
+                conn.connect();
+                OutputStream out = conn.getOutputStream();
+                out.write(rawData);
+                out.close();
+            } else {
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                xmlres.publish(request, baos);
+                conn.setRequestProperty("Content-Length",
+                        String.valueOf(baos.size()));
+                System.err.println("Sending: " +
+                        conn.getRequestProperty("Content-Type") + ' ' +
+                        String.valueOf(baos.size()));
+                conn.connect();
+                OutputStream out = conn.getOutputStream();
+                baos.writeTo(out);
+                out.close();
+            }
+        }
+    }
+}

Propchange: incubator/tsik/trunk/src/org/apache/tsik/messaging/tools/SendXML.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/src/org/apache/tsik/messaging/tools/package.html
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/src/org/apache/tsik/messaging/tools/package.html?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/src/org/apache/tsik/messaging/tools/package.html (added)
+++ incubator/tsik/trunk/src/org/apache/tsik/messaging/tools/package.html Mon Aug  8 12:58:58 2005
@@ -0,0 +1,8 @@
+<html>
+<!-- $Id: package.html,v 1.1 2002/08/30 14:53:20 mark Exp $ -->
+<body>
+
+Handy tools for message related tasks.
+
+</body>
+</html>

Propchange: incubator/tsik/trunk/src/org/apache/tsik/messaging/tools/package.html
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/src/org/apache/tsik/package.html
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/src/org/apache/tsik/package.html?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/src/org/apache/tsik/package.html (added)
+++ incubator/tsik/trunk/src/org/apache/tsik/package.html Mon Aug  8 12:58:58 2005
@@ -0,0 +1,8 @@
+<html>
+<!-- $Id: package.html,v 1.1 2002/08/30 14:53:20 mark Exp $ -->
+<body>
+
+<p>This API defines the version interface that will be implemented by the 
+Version class in all the other packages.</p>
+</body>
+</html>

Propchange: incubator/tsik/trunk/src/org/apache/tsik/package.html
------------------------------------------------------------------------------
    svn:executable = 



---------------------------------------------------------------------
To unsubscribe, e-mail: tsik-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tsik-dev-help@ws.apache.org