Various WS updates

git-svn-id: https://brutex.net/svn/xservices/trunk@85 e7e49efb-446e-492e-b9ec-fcafc1997a86
tag-20130205r
Brian Rosenberger 2012-04-20 18:09:37 +00:00
parent 671a25ee09
commit 373d73f3d8
13 changed files with 336 additions and 197 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?><book xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0"> <?xml version="1.0" encoding="UTF-8"?><book xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0">
<title>Brutex XServices Documentation</title> <title>Brutex XServices Documentation</title>
<bookinfo> <bookinfo>
<date>February, 16th 2010</date> <date>Januar 2012</date>
<author> <author>
<firstname>Brian</firstname> <firstname>Brian</firstname>
<surname>Rosenberger</surname> <surname>Rosenberger</surname>
@ -9,7 +9,7 @@
</author> </author>
<corpname>Brutex Network</corpname> <corpname>Brutex Network</corpname>
<copyright> <copyright>
<year>2011</year> <year>2012</year>
</copyright> </copyright>
<legalnotice> <legalnotice>
<para> <para>
@ -20,66 +20,29 @@
</para> </para>
</legalnotice> </legalnotice>
<legalnotice> <legalnotice>
<para>
<literallayout>
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.
</literallayout></para>
<para>Apache Tomcat and Apache Ant are trademarks of the Apache <para>Apache Tomcat and Apache Ant are trademarks of the Apache
Software Foundation.</para> Software Foundation.</para>
</legalnotice> </legalnotice>
<abstract xml:base="common/abstract.xml"> <abstract xml:base="common/abstract.xml">
<title>Abstract</title> <title>Abstract</title>
<para>In complex IT environments it is necessary to integrate <para>In complex IT environments it is often necessary to integrate different information systems with each other, exchange data between software tools and automate actions based on events arising from user interaction. Web Services is a popular way to make remote functions available to a broad range of clients. A WebService is independent from platforms and programming languages. XML Messages are exchanged through common protocols like TCP/IP or SMTP, processed and returned (request/ response paradigm).</para>
different information systems with each other, exchange data <para>Because of their nature, WebServices are a great technology to overcome system boundaries and to "orchestrate" your IT environment. They make up the basis for SOA and are the pieces that assemble automated business processes.</para>
between <para>XServices is a collection of pre-build WebServices with the intention to avoid duplicate work and "re-inventing the wheel". The historical base for XServices is the 'XBridgeNG' software, which provided a set of Apache Ant Tasks with quite the same intention. The available WebService operations are most likely the "most wanted" ones, some of the for sure are "must have". This collection may overlap with other libraries. In summary the current version contains 8 WebServices with over 50 operations.</para>
tools and automate actions and function calls depending </abstract>
on events
arising from user interaction. To meet the requirements
of
integration building usually means to implement APIs and to
create
tool-to-tool bridges. Web Services can help to clean up
bridges into
interfaces as well as to abstract functions from
their underlying
platform and implementation.</para>
<para>These are the major goals of the loosely coupled
integration
strategy which is in turn one essential idea of a
service-oriented
architecture (SOA).</para>
<para>provide a low level set of functions and web services.
These can
be orchestrated into services and used in business
processes which
make up the execution part of a SOA
environment.</para>
<para>is an add-on to XBridgeNG 2.0. It runs standalone or in
combination with XBridgeNG. Pure XBridgeNG has two
components:</para>
<para>
<itemizedlist>
<listitem>
<para>XML Schema for item based data types (e.g. tickets
from a bug
tracker system or a database record)</para>
</listitem>
<listitem>
<para>Set of Apache Ant tasks to function as a bridge
between the
XBridgeNG XML format at legacy 3rd party
software (e.g. HP Quality
Center, Serena TeamTrack,
...)</para>
</listitem>
<listitem>
<para>The add Web Services (SOAP) wrapper around Apache Ant
tasks
(since XBridgeNG 2.0)</para>
</listitem>
</itemizedlist>
</para>
<para>The current focus is on file-based operations. do not
contain an
integration server or a process execution
engine.</para>
</abstract>
</bookinfo> </bookinfo>
<chapter id="installation"> <chapter id="installation">
<beginpage/> <beginpage/>
@ -3826,6 +3789,15 @@
<title>FileServices</title> <title>FileServices</title>
<para>The FileServces bundles various file operations. Its WSDL is located at <para>The FileServces bundles various file operations. Its WSDL is located at
http://server:port/XServices/FileService?wsdl</para> http://server:port/XServices/FileService?wsdl</para>
</section>
<section id="mailservices" version="5.0" xml:base="MailServices.xml" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>MailServices</title>
<para>The MailService contains mail send and receive operations. Its WSDL is located at
http://server:port/XServices/MailService?wsdl</para>
<section version="5.0" xml:base="MailServices/sendMailSimple.xml" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>sendMailSimple</title>
<para>Send email.</para>
</section>
</section> </section>
<section id="miscservices" version="5.0" xml:base="MiscServices.xml" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude"> <section id="miscservices" version="5.0" xml:base="MiscServices.xml" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>MiscServices</title> <title>MiscServices</title>
@ -3896,6 +3868,15 @@
</soap:Envelope> </soap:Envelope>
]]></screen> ]]></screen>
</para> </para>
</section>
<section version="5.0" xml:base="MiscServices/sleep.xml" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>sleep</title>
<para>Delays the response by the given minutes/ seconds. Please note,
that it may take more time to perform the server roundtrip (network
delays, parsing, etc.). Also you may have a network timeout set up in
Tomcat or your client that prevents this web service to respond
correctly.
</para>
</section> </section>
</section> </section>
</chapter> </chapter>

View File

@ -7,7 +7,7 @@
xmlns:xi="http://www.w3.org/2001/XInclude"> xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Brutex XServices Documentation</title> <title>Brutex XServices Documentation</title>
<bookinfo> <bookinfo>
<date>February, 16th 2010</date> <date>Januar 2012</date>
<author> <author>
<firstname>Brian</firstname> <firstname>Brian</firstname>
<surname>Rosenberger</surname> <surname>Rosenberger</surname>
@ -15,7 +15,7 @@
</author> </author>
<corpname>Brutex Network</corpname> <corpname>Brutex Network</corpname>
<copyright> <copyright>
<year>2011</year> <year>2012</year>
</copyright> </copyright>
<legalnotice> <legalnotice>
<para> <para>
@ -26,6 +26,20 @@
</para> </para>
</legalnotice> </legalnotice>
<legalnotice> <legalnotice>
<para>
<literallayout>
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.
</literallayout></para>
<para>Apache Tomcat and Apache Ant are trademarks of the Apache <para>Apache Tomcat and Apache Ant are trademarks of the Apache
Software Foundation.</para> Software Foundation.</para>
</legalnotice> </legalnotice>
@ -35,7 +49,7 @@
<beginpage /> <beginpage />
<title>Getting started</title> <title>Getting started</title>
<para>This chapter describes the installation process.</para> <para>This chapter describes the installation process.</para>
<xi:include href="common/installation.xml"/> <xi:include href="common/installation.xml" />
</chapter> </chapter>
<chapter id="services"> <chapter id="services">
<beginpage /> <beginpage />
@ -45,6 +59,7 @@
<xi:include href="DateServices.xml" /> <xi:include href="DateServices.xml" />
<xi:include href="ExecuteServices.xml" /> <xi:include href="ExecuteServices.xml" />
<xi:include href="FileServices.xml" /> <xi:include href="FileServices.xml" />
<xi:include href="MailServices.xml" />
<xi:include href="MiscServices.xml" /> <xi:include href="MiscServices.xml" />
</chapter> </chapter>

9
doc/MailServices.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<section xmlns="http://docbook.org/ns/docbook" version="5.0"
xmlns:xi="http://www.w3.org/2001/XInclude"
id="mailservices">
<title>MailServices</title>
<para>The MailService contains mail send and receive operations. Its WSDL is located at
http://server:port/XServices/MailService?wsdl</para>
<xi:include href="MailServices/sendMailSimple.xml" />
</section>

View File

@ -0,0 +1,10 @@
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE section [
<!ENTITY % myent SYSTEM "../entities.ent">
%myent;
]>
<section xmlns="http://docbook.org/ns/docbook" version="5.0"
xmlns:xi="http://www.w3.org/2001/XInclude">
<title>sendMailSimple</title>
<para>Send email.</para>
</section>

View File

@ -7,4 +7,5 @@
http://server:port/XServices/MiscService?wsdl</para> http://server:port/XServices/MiscService?wsdl</para>
<xi:include href="MiscServices/generateUUID.xml" /> <xi:include href="MiscServices/generateUUID.xml" />
<xi:include href="MiscServices/getHostinfo.xml" /> <xi:include href="MiscServices/getHostinfo.xml" />
<xi:include href="MiscServices/sleep.xml" />
</section> </section>

View File

@ -0,0 +1,15 @@
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE section [
<!ENTITY % myent SYSTEM "../entities.ent">
%myent;
]>
<section xmlns="http://docbook.org/ns/docbook" version="5.0"
xmlns:xi="http://www.w3.org/2001/XInclude">
<title>sleep</title>
<para>Delays the response by the given minutes/ seconds. Please note,
that it may take more time to perform the server roundtrip (network
delays, parsing, etc.). Also you may have a network timeout set up in
Tomcat or your client that prevents this web service to respond
correctly.
</para>
</section>

View File

@ -1,59 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<abstract> <abstract>
<title>Abstract</title> <title>Abstract</title>
<para>In complex IT environments it is necessary to integrate <para>In complex IT environments it is often necessary to integrate different information systems with each other, exchange data between software tools and automate actions based on events arising from user interaction. Web Services is a popular way to make remote functions available to a broad range of clients. A WebService is independent from platforms and programming languages. XML Messages are exchanged through common protocols like TCP/IP or SMTP, processed and returned (request/ response paradigm).</para>
different information systems with each other, exchange data <para>Because of their nature, WebServices are a great technology to overcome system boundaries and to "orchestrate" your IT environment. They make up the basis for SOA and are the pieces that assemble automated business processes.</para>
between <para>XServices is a collection of pre-build WebServices with the intention to avoid duplicate work and "re-inventing the wheel". The historical base for XServices is the 'XBridgeNG' software, which provided a set of Apache Ant Tasks with quite the same intention. The available WebService operations are most likely the "most wanted" ones, some of the for sure are "must have". This collection may overlap with other libraries. In summary the current version contains 8 WebServices with over 50 operations.</para>
tools and automate actions and function calls depending </abstract>
on events
arising from user interaction. To meet the requirements
of
integration building usually means to implement APIs and to
create
tool-to-tool bridges. Web Services can help to clean up
bridges into
interfaces as well as to abstract functions from
their underlying
platform and implementation.</para>
<para>These are the major goals of the loosely coupled
integration
strategy which is in turn one essential idea of a
service-oriented
architecture (SOA).</para>
<para>provide a low level set of functions and web services.
These can
be orchestrated into services and used in business
processes which
make up the execution part of a SOA
environment.</para>
<para>is an add-on to XBridgeNG 2.0. It runs standalone or in
combination with XBridgeNG. Pure XBridgeNG has two
components:</para>
<para>
<itemizedlist>
<listitem>
<para>XML Schema for item based data types (e.g. tickets
from a bug
tracker system or a database record)</para>
</listitem>
<listitem>
<para>Set of Apache Ant tasks to function as a bridge
between the
XBridgeNG XML format at legacy 3rd party
software (e.g. HP Quality
Center, Serena TeamTrack,
...)</para>
</listitem>
<listitem>
<para>The add Web Services (SOAP) wrapper around Apache Ant
tasks
(since XBridgeNG 2.0)</para>
</listitem>
</itemizedlist>
</para>
<para>The current focus is on file-based operations. do not
contain an
integration server or a process execution
engine.</para>
</abstract>

View File

@ -0,0 +1,123 @@
/*
* Copyright 2012 Brian Rosenberger (Brutex Network)
*
* 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 net.brutex.xservices.ws;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlElement;
import net.brutex.xservices.types.HostConnection;
import net.brutex.xservices.types.MailMimeType;
import net.brutex.xservices.types.ReturnCode;
import net.brutex.xservices.types.ant.FileSetResource;
import net.brutex.xservices.util.BrutexNamespaces;
import org.apache.cxf.annotations.WSDLDocumentation;
/**
* Bundles various method for sending and receiving mails
*
* @author Brian Rosenberger, bru@brutex.de
* @since 2.0.0
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
@WSDLDocumentation("Various mail service operations.")
public interface MailService {
final String PARAM_SMTPHOST = "mailhost";
final String PARAM_SENDER = "from";
final String PARAM_RECEIVER = "to";
final String PARAM_SUBJECT = "subject";
final String PARAM_MESSAGE = "message";
final String PARAM_ATTACHMENTS = "attachments";
/**
* Simple mail send operation with sender, single receiver, subject and message.
*
* @param mailhost connection details for the SMTP server to use
* @param from mail address to be used as sender
* @param tolist mail address of the receiver
* @param subject subject of the mail
* @param message mail body
* @return ReturnCode
*/
@WebMethod(operationName = "sendMailSimple")
@WSDLDocumentation(value = "Send an email (simple).")
public ReturnCode sendMailSimple(
@WebParam(name = PARAM_SMTPHOST) @XmlElement(required=true, nillable=false) HostConnection mailhost,
@WebParam(name = PARAM_SENDER) @XmlElement(required=true) String from,
@WebParam(name = PARAM_RECEIVER) @XmlElement(required=true, nillable=false) String tolist,
@WebParam(name = PARAM_SUBJECT) String subject,
@WebParam(name = PARAM_MESSAGE) String message);
/**
* Simple mail send operation with sender, single receiver, subject and message
* including support for file attachments.
*
* @param mailhost connection details for the SMTP server to use
* @param from mail address to be used as sender
* @param tolist mail address of the receiver
* @param subject subject of the mail
* @param message mail body
* @param res attachments
* @return ReturnCode
*/
@WebMethod(operationName = "sendMailSimpleWithAttachment")
@WSDLDocumentation(value = "Send an email with attachment (simple).")
public ReturnCode sendMailSimpleWithAttachment(
@WebParam(name = PARAM_SMTPHOST) @XmlElement(required=true, nillable=false) HostConnection mailhost,
@WebParam(name = PARAM_SENDER) @XmlElement(required=true, nillable=false) String from,
@WebParam(name = PARAM_RECEIVER) @XmlElement(required=true, nillable=false) String tolist,
@WebParam(name = PARAM_SUBJECT) String subject,
@WebParam(name = PARAM_MESSAGE) String message,
@WebParam(name = PARAM_ATTACHMENTS) FileSetResource res);
/**
* Send email with a lot of options
*
* @param mailhost connection details for the SMTP server to use
* @param from mail address to be used as sender
* @param tolist mail address of the receiver
* @param cclist mail carbon copy receiver
* @param bcclist mail blind carbon copy receiver
* @param subject subject of the mail
* @param mimetype message MIME type (i.e. text/plain)
* @param charset character set to use (i.e. utf-8, iso-8859-15)
* @param message mail body
* @param res attachments
* @param ssl use SSL
* @param tls use TLS
* @return ReturnCode
*/
@WebMethod(operationName = "sendMail")
@WSDLDocumentation(value = "Send an email (advanced).")
public ReturnCode sendMail(
@WebParam(name = PARAM_SMTPHOST) @XmlElement(required=true, nillable=false) HostConnection mailhost,
@WebParam(name = PARAM_SENDER) @XmlElement(required=true, nillable=false) String from,
@WebParam(name = PARAM_RECEIVER) @XmlElement(required=true, nillable=false) String tolist,
@WebParam(name = "cc") String cclist,
@WebParam(name = "bcc") String bcclist,
@WebParam(name = PARAM_SUBJECT) String subject,
@WebParam(name = "mimetype") MailMimeType mimetype,
@WebParam(name = "charset") String charset,
@WebParam(name = PARAM_MESSAGE) String message,
@WebParam(name = PARAM_ATTACHMENTS) FileSetResource res,
@WebParam(name = "useSSL") boolean ssl,
@WebParam(name = "useStartTLS") boolean tls);
}

View File

@ -30,6 +30,7 @@ import org.apache.cxf.aegis.type.java5.XmlReturnType;
import org.apache.cxf.annotations.WSDLDocumentation; import org.apache.cxf.annotations.WSDLDocumentation;
/** /**
* Bundles various methods
* *
* @author Brian Rosenberger, bru@brutex.de * @author Brian Rosenberger, bru@brutex.de
* @since 0.4.0 * @since 0.4.0
@ -38,9 +39,9 @@ import org.apache.cxf.annotations.WSDLDocumentation;
@WSDLDocumentation("Various service operations.") @WSDLDocumentation("Various service operations.")
public interface MiscService { public interface MiscService {
/** /**
* Get IP address from host name.
*
* @param hostname * @param hostname
* @return ReturnCode * @return ReturnCode
*/ */
@ -49,77 +50,9 @@ public interface MiscService {
public HostinfoType getHostinfo( public HostinfoType getHostinfo(
@WebParam(name = "hostname") @XmlElement(minOccurs="1", nillable=false ) String hostname); @WebParam(name = "hostname") @XmlElement(minOccurs="1", nillable=false ) String hostname);
/**
*
* @param mailhost
* @param from
* @param tolist
* @param subject
* @param message
* @return ReturnCode
*/
@WebMethod(operationName = "sendMailSimple")
@WSDLDocumentation(value = "Send an email (simple).")
public ReturnCode sendMailSimple(
@WebParam(name = "mailhost") @XmlElement(minOccurs="1", nillable=false) HostConnection mailhost,
@WebParam(name = "from") @XmlElement(minOccurs="1", nillable=false) String from,
@WebParam(name = "to") @XmlElement(minOccurs="1", nillable=false) String tolist,
@WebParam(name = "subject") String subject,
@WebParam(name = "message") String message);
/**
*
* @param mailhost
* @param from
* @param tolist
* @param subject
* @param message
* @param res
* @return ReturnCode
*/
@WebMethod(operationName = "sendMailSimpleWithAttachment")
@WSDLDocumentation(value = "Send an email with attachment (simple).")
public ReturnCode sendMailSimpleWithAttachment(
@WebParam(name = "mailhost") @XmlElement(minOccurs="1", nillable=false) HostConnection mailhost,
@WebParam(name = "from") @XmlElement(minOccurs="1", nillable=false) String from,
@WebParam(name = "to") @XmlElement(minOccurs="1", nillable=false) String tolist,
@WebParam(name = "subject") String subject,
@WebParam(name = "message") String message,
@WebParam(name = "attachments") FileSetResource res);
/**
*
* @param mailhost
* @param from
* @param tolist
* @param cclist
* @param bcclist
* @param subject
* @param mimetype
* @param charset
* @param message
* @param res
* @param ssl
* @param tls
* @return ReturnCode
*/
@WebMethod(operationName = "sendMail")
@WSDLDocumentation(value = "Send an email (advanced).")
public ReturnCode sendMail(
@WebParam(name = "mailhost") @XmlElement(minOccurs="1", nillable=false) HostConnection mailhost,
@WebParam(name = "from") @XmlElement(minOccurs="1", nillable=false) String from,
@WebParam(name = "to") @XmlElement(minOccurs="1", nillable=false) String tolist,
@WebParam(name = "cc") String cclist,
@WebParam(name = "bcc") String bcclist,
@WebParam(name = "subject") String subject,
@WebParam(name = "mimetype") MailMimeType mimetype,
@WebParam(name = "charset") String charset,
@WebParam(name = "message") String message,
@WebParam(name = "attachments") FileSetResource res,
@WebParam(name = "useSSL") boolean ssl,
@WebParam(name = "useStartTLS") boolean tls);
/** /**
* Delay execution for a given time.
* *
* @param minutes * @param minutes
* @param seconds * @param seconds

View File

@ -28,8 +28,10 @@ import javax.xml.ws.WebFault;
import net.brutex.xservices.util.BrutexNamespaces; import net.brutex.xservices.util.BrutexNamespaces;
/** /**
* Generic web service fault.
* *
* @author Brian Rosenberger, bru@brutex.de * @author Brian Rosenberger, bru@brutex.de
* since 0.4.0
*/ */
@WebFault(targetNamespace=BrutexNamespaces.WS_XSERVICES) @WebFault(targetNamespace=BrutexNamespaces.WS_XSERVICES)
public class XServicesFault extends Exception { public class XServicesFault extends Exception {

View File

@ -0,0 +1,94 @@
/*
* Copyright 2012 Brian Rosenberger (Brutex Network)
*
* 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 net.brutex.xservices.ws.impl;
import javax.jws.WebService;
import net.brutex.xservices.types.HostConnection;
import net.brutex.xservices.types.MailMimeType;
import net.brutex.xservices.types.ReturnCode;
import net.brutex.xservices.types.ant.FileSetResource;
import net.brutex.xservices.util.BrutexNamespaces;
import net.brutex.xservices.util.RunTask;
import net.brutex.xservices.ws.MailService;
import org.apache.tools.ant.taskdefs.email.EmailTask;
/**
* Implements MailService
*
* @author Brian Rosenberger, bru@brutex.de
*/
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES,
endpointInterface = "net.brutex.xservices.ws.MailService",
serviceName = "MailService")
public class MailServiceImpl implements MailService {
public ReturnCode sendMailSimple(HostConnection mailhost, String from,
String tolist, String subject, String message) {
return sendMail(from, from, tolist, "", "", subject, message,
"text/plain", null, mailhost.hostname, mailhost.port,
mailhost.user, mailhost.password, "utf-8", false, false);
}
public ReturnCode sendMailSimpleWithAttachment(HostConnection mailhost,
String from, String tolist, String subject, String message,
FileSetResource res) {
return sendMail(from, from, tolist, "", "", subject, message,
"text/plain", res, mailhost.hostname, mailhost.port,
mailhost.user, mailhost.password, "utf-8", false, false);
}
public ReturnCode sendMail(HostConnection mailhost, String from,
String tolist, String cclist, String bcclist, String subject,
MailMimeType mimetype, String charset, String message,
FileSetResource res, boolean ssl, boolean tls) {
return sendMail(from, from, tolist, cclist, bcclist, subject, message,
mimetype.value(), res, mailhost.hostname, mailhost.port,
mailhost.user, mailhost.password, charset, tls, ssl);
}
private ReturnCode sendMail(String from, String replyto, String tolist,
String cclist, String bcclist, String subject, String message,
String messagemimetype, FileSetResource attachments,
String mailhost, int mailport, String user, String password,
String charset, boolean tls, boolean ssl) {
EmailTask mail = new EmailTask();
mail.setTaskName("Mail");
RunTask runner = new RunTask(mail);
mail.setFrom(from);
mail.setReplyTo(replyto);
mail.setToList(tolist);
mail.setCcList(cclist);
mail.setBccList(bcclist);
mail.setSubject(subject);
mail.setMessage(message);
mail.setMessageMimeType(messagemimetype);
if (attachments != null) {
mail.addFileset(attachments.getAntResource(mail.getProject()));
}
mail.setMailhost(mailhost);
mail.setMailport(mailport);
mail.setUser(user);
mail.setPassword(password);
mail.setCharset(charset);
mail.setSSL(ssl);
mail.setEnableStartTLS(tls);
return runner.postTask();
}
}

View File

@ -37,10 +37,13 @@ import org.apache.tools.ant.taskdefs.Sleep;
import org.apache.tools.ant.taskdefs.email.EmailTask; import org.apache.tools.ant.taskdefs.email.EmailTask;
/** /**
* Implements the web service
* *
* @author Brian Rosenberger, bru@brutex.de * @author Brian Rosenberger, bru@brutex.de
*/ */
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES, endpointInterface = "net.brutex.xservices.ws.MiscService", serviceName = "MiscService") @WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES,
endpointInterface = "net.brutex.xservices.ws.MiscService",
serviceName = "MiscService")
public class MiscServiceImpl implements MiscService { public class MiscServiceImpl implements MiscService {
public HostinfoType getHostinfo(String hostname) { public HostinfoType getHostinfo(String hostname) {
@ -49,6 +52,7 @@ public class MiscServiceImpl implements MiscService {
RunTask runner = new RunTask(info); RunTask runner = new RunTask(info);
info.setHost(hostname); info.setHost(hostname);
// info.setPrefix(prefix); // info.setPrefix(prefix);
// TODO: Does not work for IP Addresses?
ReturnCode ret = runner.postTask(); ReturnCode ret = runner.postTask();
HostinfoType infotype = new HostinfoType( HostinfoType infotype = new HostinfoType(
ret.getProperty("NAME"), ret.getProperty("NAME"),

View File

@ -47,6 +47,9 @@
implementor="net.brutex.xservices.ws.impl.JobServiceImpl" address="/JobService"> implementor="net.brutex.xservices.ws.impl.JobServiceImpl" address="/JobService">
</jaxws:endpoint> </jaxws:endpoint>
<jaxws:endpoint id="mailservice"
implementor="net.brutex.xservices.ws.impl.MailServiceImpl" address="/MailService">
</jaxws:endpoint>
<jaxws:endpoint id="miscservice" <jaxws:endpoint id="miscservice"
implementor="net.brutex.xservices.ws.impl.MiscServiceImpl" address="/MiscService"> implementor="net.brutex.xservices.ws.impl.MiscServiceImpl" address="/MiscService">