Inputs
RelativeFileName – name of the file that has been uploaded into the file service temporary area.
SkipValidation – turns off validation for the load. Not advised unless you know that the file contains valid data.
AttachSourceFile – attach the source file to the upload request object that gets created.
Outputs
UploadResult object.
This upload mechanism requires the input file to contain XML formatted information that falls in line with the SmartPlant Foundation schema.
<Container CompSchema="PBSAuthoringComponent" Scope="Data" SoftwareVersion="04.02.00.04" IObject_ContainerID="AuthPlantData.PBS_Data" IObject_OBID="Auto" IObject_CreationDate="Now" IObject_TerminationDate="9999/12/31-23:59:59:999" IObject_LastUpdatedDate="Now" IObject_CreationUser="superuser" IObject_DomainUID="Auto" IObject_UniqueKey="Auto" IRel_DomainUID1="Auto" IRel_DomainUID2="Auto">
<SPFFunctionalArea>
<IObject UID="AR_EFPLANT-SC-2_114" Name="114" Description="Area 114" Config="PL_EFPLANT-SC-2"/>
<ISPFFunctionalArea/>
<IPBSItem/>
<IPBSItemCollection />
<ISPFSubscribableItem />
</SPFFunctionalArea>
</Container>
Uploading the input XML file
A web method has been added to show where to place the file to be loaded. This works by providing the ClassDef of one of the objects you are creating/updating in the file. The classdef must be passed so the server can identify the type of object and what the file replication options are.
The web method GetInforForFTPFileUpload is used for this purpose. It returns a FileHostsURLs class that always contains a localURL and, if the file service is replicated, returns the remote URL.
Using the URL, a shared function in the SPFCommon.dll can be used to copy the file to the required place.
The client using the web methods will need to reference the dll.
Dim lstrURL As UploadService.FileHostsURLs = lobjUploadService.GetInfoForFTPFileUpload(lblSessionId.Text, "SPFUploadRequest")
txtLocalURL.Text = lstrURL.L
txtRemoteURL.Text = lstrURL.R
'
' Now send the file to the hosts
'
If String.IsNullOrEmpty(txtLocalURL.Text) = False Then
SPF.Utilities.FileUtilities.UploadFile(lblSessionId.Text, _
txtLocalURL.Text, _
txtFilename.Text, _
6000000, False)
End If
If String.IsNullOrEmpty(txtRemoteURL.Text) = False Then
SPF.Utilities.FileUtilities.UploadFile(lblSessionId.Text, _
txtRemoteURL.Text, _
txtFilename.Text, _
6000000, False)
End If
Then send the filename to the UploadFileValidateOpt web method, without the path.
Dim lstrFileNameWOutPath As String = IO.Path.GetFileName(txtFilename.Text)