public class EwsServiceXmlWriter extends Object implements IDisposable
Modifier and Type | Field and Description |
---|---|
protected boolean |
requireWSSecurityUtilityNamespace
The requireWSSecurityUtilityNamespace *
|
Constructor and Description |
---|
EwsServiceXmlWriter(ExchangeServiceBase service,
OutputStream stream)
Initializes a new instance.
|
Modifier and Type | Method and Description |
---|---|
static void |
addElement(Element element,
XMLStreamWriter writer) |
void |
dispose()
Performs application-defined tasks associated with freeing, releasing, or
resetting unmanaged resources.
|
void |
flush()
Flushes this instance.
|
XMLStreamWriter |
getInternalWriter()
Gets the internal XML writer.
|
ExchangeServiceBase |
getService()
Gets the service.
|
boolean |
isRequireWSSecurityUtilityNamespace()
Gets a value indicating whether the SOAP message need WSSecurity Utility namespace.
|
boolean |
isTimeZoneHeaderEmitted()
Gets a value indicating whether the time zone SOAP header was emitted
through this writer.
|
void |
setRequireWSSecurityUtilityNamespace(boolean requireWSSecurityUtilityNamespace)
Sets a value indicating whether the SOAP message need WSSecurity Utility namespace.
|
void |
setTimeZoneHeaderEmitted(boolean isTimeZoneHeaderEmitted)
Sets a value indicating whether the time zone SOAP header was emitted
through this writer.
|
protected boolean |
tryConvertObjectToString(Object value,
OutParam<String> str)
Try to convert object to a string.
|
protected void |
writeAttributeString(String localName,
String stringValue)
Writes the attribute value.
|
protected void |
writeAttributeString(String namespacePrefix,
String localName,
String stringValue)
Writes the attribute value.
|
void |
writeAttributeValue(String localName,
boolean alwaysWriteEmptyString,
Object value)
Writes the attribute value.
|
void |
writeAttributeValue(String localName,
Object value)
Writes the attribute value.
|
void |
writeAttributeValue(String namespacePrefix,
String localName,
Object value)
Writes the attribute value.
|
void |
writeBase64ElementValue(byte[] buffer)
Writes the base64-encoded element value.
|
void |
writeBase64ElementValue(InputStream stream)
Writes the base64-encoded element value.
|
void |
writeElementValue(XmlNamespace xmlNamespace,
String localName,
Object value)
Writes the element value.
|
void |
writeElementValue(XmlNamespace xmlNamespace,
String localName,
String displayName,
Object value)
Writes the element value.
|
void |
writeEndElement()
Writes the end element.
|
void |
writeNode(Node xmlNode) |
static void |
writeNode(Node xmlNode,
XMLStreamWriter xmlStreamWriter) |
void |
writeStartDocument()
Write start document.
|
void |
writeStartElement(XmlNamespace xmlNamespace,
String localName)
Writes the start element.
|
static void |
writeToDocument(Document document,
XMLStreamWriter xmlStreamWriter) |
void |
writeValue(String value,
String name)
Writes string value.
|
protected boolean requireWSSecurityUtilityNamespace
public EwsServiceXmlWriter(ExchangeServiceBase service, OutputStream stream) throws XMLStreamException
service
- the servicestream
- the streamXMLStreamException
- the XML stream exceptionprotected boolean tryConvertObjectToString(Object value, OutParam<String> str)
value
- The value.str
- the strpublic void dispose()
dispose
in interface IDisposable
public void flush() throws XMLStreamException
XMLStreamException
- the XML stream exceptionpublic void writeStartElement(XmlNamespace xmlNamespace, String localName) throws XMLStreamException
xmlNamespace
- the XML namespacelocalName
- the local name of the elementXMLStreamException
- the XML stream exceptionpublic void writeEndElement() throws XMLStreamException
XMLStreamException
- the XML stream exceptionpublic void writeAttributeValue(String localName, Object value) throws ServiceXmlSerializationException
localName
- the local name of the attributevalue
- the valueServiceXmlSerializationException
- the service xml serialization exceptionpublic void writeAttributeValue(String localName, boolean alwaysWriteEmptyString, Object value) throws ServiceXmlSerializationException
localName
- the local name of the attribute.alwaysWriteEmptyString
- always emit the empty string as the value.value
- the valueServiceXmlSerializationException
- the service xml serialization exceptionpublic void writeAttributeValue(String namespacePrefix, String localName, Object value) throws ServiceXmlSerializationException
namespacePrefix
- the namespace prefixlocalName
- the local name of the attributevalue
- the valueServiceXmlSerializationException
- the service xml serialization exceptionprotected void writeAttributeString(String localName, String stringValue) throws ServiceXmlSerializationException
localName
- The local name of the attribute.stringValue
- The string value.ServiceXmlSerializationException
- Thrown if string value isn't valid for XMLprotected void writeAttributeString(String namespacePrefix, String localName, String stringValue) throws ServiceXmlSerializationException
namespacePrefix
- The namespace prefix.localName
- The local name of the attribute.stringValue
- The string value.ServiceXmlSerializationException
- Thrown if string value isn't valid for XML.public void writeValue(String value, String name) throws ServiceXmlSerializationException
value
- The value.name
- Element name (used for error handling)ServiceXmlSerializationException
- Thrown if string value isn't valid for XML.public void writeElementValue(XmlNamespace xmlNamespace, String localName, String displayName, Object value) throws XMLStreamException, ServiceXmlSerializationException
xmlNamespace
- the XML namespacelocalName
- the local name of the elementdisplayName
- the name that should appear in the exception message when the value can not be serializedvalue
- the valueXMLStreamException
- the XML stream exceptionServiceXmlSerializationException
- the service xml serialization exceptionpublic void writeNode(Node xmlNode) throws XMLStreamException
XMLStreamException
public static void writeNode(Node xmlNode, XMLStreamWriter xmlStreamWriter) throws XMLStreamException
xmlNode
- XML nodexmlStreamWriter
- XML stream writerXMLStreamException
- the XML stream exceptionpublic static void writeToDocument(Document document, XMLStreamWriter xmlStreamWriter) throws XMLStreamException
document
- XML documentxmlStreamWriter
- XML stream writerXMLStreamException
- the XML stream exceptionpublic static void addElement(Element element, XMLStreamWriter writer) throws XMLStreamException
element
- DOM elementwriter
- XML stream writerXMLStreamException
- the XML stream exceptionpublic void writeElementValue(XmlNamespace xmlNamespace, String localName, Object value) throws XMLStreamException, ServiceXmlSerializationException
xmlNamespace
- the XML namespacelocalName
- the local name of the elementvalue
- the valueXMLStreamException
- the XML stream exceptionServiceXmlSerializationException
- the service xml serialization exceptionpublic void writeBase64ElementValue(byte[] buffer) throws XMLStreamException
buffer
- the bufferXMLStreamException
- the XML stream exceptionpublic void writeBase64ElementValue(InputStream stream) throws IOException, XMLStreamException
stream
- the streamIOException
- signals that an I/O exception has occurredXMLStreamException
- the XML stream exceptionpublic XMLStreamWriter getInternalWriter()
public ExchangeServiceBase getService()
public boolean isRequireWSSecurityUtilityNamespace()
public void setRequireWSSecurityUtilityNamespace(boolean requireWSSecurityUtilityNamespace)
public boolean isTimeZoneHeaderEmitted()
public void setTimeZoneHeaderEmitted(boolean isTimeZoneHeaderEmitted)
isTimeZoneHeaderEmitted
- true if the time zone SOAP header was emitted; otherwise
false.public void writeStartDocument() throws XMLStreamException
XMLStreamException
- the XML stream exceptionCopyright © 2012–2015 Microsoft. All rights reserved.