Subversion Repositories XServices

Rev

Rev 85 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
85 brianR 1
/*
2
 *   Copyright 2012 Brian Rosenberger (Brutex Network)
3
 *
4
 *   Licensed under the Apache License, Version 2.0 (the "License");
5
 *   you may not use this file except in compliance with the License.
6
 *   You may obtain a copy of the License at
7
 *
8
 *       http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *   Unless required by applicable law or agreed to in writing, software
11
 *   distributed under the License is distributed on an "AS IS" BASIS,
12
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *   See the License for the specific language governing permissions and
14
 *   limitations under the License.
15
 */
16
package net.brutex.xservices.ws;
17
 
18
import javax.jws.WebMethod;
19
import javax.jws.WebParam;
20
import javax.jws.WebService;
21
import javax.xml.bind.annotation.XmlElement;
22
 
23
import net.brutex.xservices.types.HostConnection;
24
import net.brutex.xservices.types.MailMimeType;
25
import net.brutex.xservices.types.ReturnCode;
26
import net.brutex.xservices.types.ant.FileSetResource;
27
import net.brutex.xservices.util.BrutexNamespaces;
28
 
29
import org.apache.cxf.annotations.WSDLDocumentation;
30
 
31
/**
32
 * Bundles various method for sending and receiving mails
33
 *
34
 * @author Brian Rosenberger, bru@brutex.de
35
 * @since 2.0.0
36
 */
37
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
38
@WSDLDocumentation("Various mail service operations.")
39
public interface MailService {
40
 
41
    final String PARAM_SMTPHOST = "mailhost";
42
    final String PARAM_SENDER = "from";
43
    final String PARAM_RECEIVER = "to";
44
    final String PARAM_SUBJECT = "subject";
45
    final String PARAM_MESSAGE = "message";
46
    final String PARAM_ATTACHMENTS = "attachments";
47
 
48
    /**
49
     * Simple mail send operation with sender, single receiver, subject and message.
50
     *
51
     * @param mailhost	connection details for the SMTP server to use
52
     * @param from		mail address to be used as sender
53
     * @param tolist	mail address of the receiver
54
     * @param subject	subject of the mail
55
     * @param message	mail body
56
     * @return ReturnCode
57
     */
58
    @WebMethod(operationName = "sendMailSimple")
59
    @WSDLDocumentation(value = "Send an email (simple).")
60
    public ReturnCode sendMailSimple(
61
    		@WebParam(name = PARAM_SMTPHOST) @XmlElement(required=true, nillable=false) HostConnection mailhost,
62
            @WebParam(name = PARAM_SENDER) @XmlElement(required=true) String from,
63
            @WebParam(name = PARAM_RECEIVER) @XmlElement(required=true, nillable=false) String tolist,
64
            @WebParam(name = PARAM_SUBJECT) String subject,
65
            @WebParam(name = PARAM_MESSAGE) String message);
66
 
67
    /**
68
     * Simple mail send operation with sender, single receiver, subject and message
69
     * including support for file attachments.
70
     *
71
     * @param mailhost	connection details for the SMTP server to use
72
     * @param from		mail address to be used as sender
73
     * @param tolist	mail address of the receiver
74
     * @param subject	subject of the mail
75
     * @param message	mail body
76
     * @param res		attachments
77
     * @return ReturnCode
78
     */
79
    @WebMethod(operationName = "sendMailSimpleWithAttachment")
80
    @WSDLDocumentation(value = "Send an email with attachment (simple).")
81
    public ReturnCode sendMailSimpleWithAttachment(
82
    		@WebParam(name = PARAM_SMTPHOST) @XmlElement(required=true, nillable=false) HostConnection mailhost,
83
            @WebParam(name = PARAM_SENDER) @XmlElement(required=true, nillable=false) String from,
84
            @WebParam(name = PARAM_RECEIVER) @XmlElement(required=true, nillable=false) String tolist,
85
            @WebParam(name = PARAM_SUBJECT) String subject,
86
            @WebParam(name = PARAM_MESSAGE) String message,
87
            @WebParam(name = PARAM_ATTACHMENTS) FileSetResource res);
88
 
89
    /**
90
     * Send email with a lot of options
91
     *
92
     * @param mailhost	connection details for the SMTP server to use
93
     * @param from		mail address to be used as sender
94
     * @param tolist	mail address of the receiver
95
     * @param cclist	mail carbon copy receiver
96
     * @param bcclist	mail blind carbon copy receiver
97
     * @param subject	subject of the mail
98
     * @param mimetype	message MIME type (i.e. text/plain)
99
     * @param charset	character set to use (i.e. utf-8, iso-8859-15)
100
     * @param message	mail body
101
     * @param res		attachments
102
     * @param ssl		use SSL
103
     * @param tls		use TLS
104
     * @return ReturnCode
105
     */
106
    @WebMethod(operationName = "sendMail")
107
    @WSDLDocumentation(value = "Send an email (advanced).")
108
    public ReturnCode sendMail(
109
    		@WebParam(name = PARAM_SMTPHOST) @XmlElement(required=true, nillable=false) HostConnection mailhost,
110
            @WebParam(name = PARAM_SENDER) @XmlElement(required=true, nillable=false) String from,
111
            @WebParam(name = PARAM_RECEIVER) @XmlElement(required=true, nillable=false) String tolist,
112
            @WebParam(name = "cc") String cclist,
113
            @WebParam(name = "bcc") String bcclist,
114
            @WebParam(name = PARAM_SUBJECT) String subject,
115
            @WebParam(name = "mimetype") MailMimeType mimetype,
116
            @WebParam(name = "charset") String charset,
117
            @WebParam(name = PARAM_MESSAGE) String message,
118
            @WebParam(name = PARAM_ATTACHMENTS) FileSetResource res,
119
            @WebParam(name = "useSSL") boolean ssl,
120
            @WebParam(name = "useStartTLS") boolean tls);
121
 
122
 
123
}