Class SoapWebServiceDocument
- java.lang.Object
-
- net.webpdf.wsclient.session.documents.AbstractDocument
-
- net.webpdf.wsclient.session.soap.documents.SoapWebServiceDocument
-
- All Implemented Interfaces:
AutoCloseable,Document,SoapDocument
public class SoapWebServiceDocument extends AbstractDocument implements SoapDocument
An instance of
SoapWebServiceDocumentrepresents a document, as it is processed/created by aSoapWebService.Such a
SoapWebServiceDocumentdefines a source for the document, that shall be processed by a calledSoapWebServiceand a target resource for the document produced by that webservice.Be aware: A
SoapDocumentis usingDataHandlers, that might require closing to prevent resource leaks. You should alwaysclose()SoapDocuments.
-
-
Constructor Summary
Constructors Constructor Description SoapWebServiceDocument()Creates a handle for aSoapWebServiceoutput without providing a source document.
This shall always returnnull, in casegetSourceDataHandler()is called and is recommended for webservices, that don't require a source document.SoapWebServiceDocument(@NotNull File source)Manages aSoapDocumentoriginating from the givenFile.SoapWebServiceDocument(@NotNull InputStream source)Manages aSoapDocumentoriginating from the givenInputStream.SoapWebServiceDocument(@NotNull URI source)Manages aSoapDocumentoriginating from the givenURI.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the documentsDataHandlers.@Nullable jakarta.activation.DataHandlergetResult()Returns the resultDataHandler, that represents the current result of aSoapWebServicecall for thisSoapDocument.@Nullable jakarta.activation.DataHandlergetSourceDataHandler()Returns aDataHandlerfor the document's source - may returnnullin case no source document has been selected.voidsetResult(@Nullable jakarta.activation.DataHandler result)Sets the resultDataHandler, that represents the current result of aSoapWebServicecall for thisSoapDocument.voidwriteResult(@NotNull File target)Attempts to write theWebServiceProtocol.SOAPresponse document to the givenFile.voidwriteResult(@NotNull OutputStream target)Attempts to write the responseSoapDocumentto the givenDataHandler.-
Methods inherited from class net.webpdf.wsclient.session.documents.AbstractDocument
getSource, isFileSource
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.webpdf.wsclient.session.documents.Document
getSource, isFileSource
-
-
-
-
Constructor Detail
-
SoapWebServiceDocument
public SoapWebServiceDocument()
Creates a handle for a
SoapWebServiceoutput without providing a source document.
This shall always returnnull, in casegetSourceDataHandler()is called and is recommended for webservices, that don't require a source document. (Such as the URL-Converter.)Be aware: Most webservices require a source document, with few exceptions. Before using this, make sure that this is valid for the
WebServicecall you intend to execute.Be aware: A
SoapDocumentis usingDataHandlers, that might require closing to prevent resource leaks. You should alwaysclose()SoapDocuments.
-
SoapWebServiceDocument
public SoapWebServiceDocument(@NotNull @NotNull InputStream source) throws ResultExceptionManages a
SoapDocumentoriginating from the givenInputStream.Be aware: A
SoapDocumentis usingDataHandlers, that might require closing to prevent resource leaks. You should alwaysclose()SoapDocuments.- Parameters:
source- TheURItheSoapDocumentis originating from.- Throws:
ResultException- Shall be thrown in case loading the source document failed.
-
SoapWebServiceDocument
public SoapWebServiceDocument(@NotNull @NotNull URI source) throws ResultExceptionManages a
SoapDocumentoriginating from the givenURI.Be aware: A
SoapDocumentis usingDataHandlers, that might require closing to prevent resource leaks. You should alwaysclose()SoapDocuments.- Parameters:
source- TheURItheSoapDocumentis originating from.- Throws:
ResultException- Shall be thrown in case loading the source document failed.
-
SoapWebServiceDocument
public SoapWebServiceDocument(@NotNull @NotNull File source) throws ResultExceptionManages a
SoapDocumentoriginating from the givenFile.Be aware: A
SoapDocumentis usingDataHandlers, that might require closing to prevent resource leaks. You should alwaysclose()SoapDocuments.- Parameters:
source- TheFiletheSoapDocumentis originating from.- Throws:
ResultException- Shall be thrown in case loading the source document failed.
-
-
Method Detail
-
getSourceDataHandler
@Nullable public @Nullable jakarta.activation.DataHandler getSourceDataHandler()
Returns aDataHandlerfor the document's source - may returnnullin case no source document has been selected.- Specified by:
getSourceDataHandlerin interfaceSoapDocument- Returns:
- A
DataHandlerfor the document's source.
-
setResult
public void setResult(@Nullable @Nullable jakarta.activation.DataHandler result)Sets the resultDataHandler, that represents the current result of aSoapWebServicecall for thisSoapDocument.- Specified by:
setResultin interfaceSoapDocument- Parameters:
result- The resultDataHandler, that represents the current result of aSoapWebServicecall.
-
getResult
@Nullable public @Nullable jakarta.activation.DataHandler getResult()
Returns the resultDataHandler, that represents the current result of aSoapWebServicecall for thisSoapDocument. (May returnnull, should such a result not exist.)- Specified by:
getResultin interfaceSoapDocument- Returns:
- The result
DataHandler, that represents the current result of aSoapWebServicecall.
-
writeResult
public void writeResult(@NotNull @NotNull OutputStream target) throws ResultExceptionAttempts to write the responseSoapDocumentto the givenDataHandler.- Specified by:
writeResultin interfaceSoapDocument- Parameters:
target- TheOutputStreamthe responseSoapDocumentshall be written to.- Throws:
ResultException- Shall be thrown, should writing the result document fail.
-
writeResult
public void writeResult(@NotNull @NotNull File target) throws ResultExceptionAttempts to write theWebServiceProtocol.SOAPresponse document to the givenFile.- Specified by:
writeResultin interfaceSoapDocument- Parameters:
target- The targetFiletheWebServiceProtocol.SOAPresponse document shall be written to.- Throws:
ResultException- Shall be thrown, should writing the result document fail.
-
close
public void close() throws ResultExceptionCloses the documentsDataHandlers.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSoapDocument- Throws:
ResultException- Shall be thrown, when closing the underlyingDataHandlers failed.
-
-