Skip to content

WATE-10581: Migrated .net restful custom processing sample #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

CustomProcessingSample/.vs/CustomProcessingSample/v16/.suo

CustomProcessingSample/CustomProcessingSample.csproj.user

CustomProcessingSample/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache

*.cache

*.CopyComplete

CustomProcessingSample/obj/Debug/

CustomProcessingSample/bin/Debug/CustomProcessingSample.dll
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AC6604D5-C586-469D-A88F-70ED93DD1C12}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CustomProcessingSample</RootNamespace>
<AssemblyName>CustomProcessingSample</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WindwardCustomProcessing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=29796a63fd10f2a1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\WindwardCustomProcessing.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CustomProcessor.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="bin\Debug\CustomProcessingSample.pdb" />
<Content Include="bin\Debug\WindwardCustomProcessing.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Folder Include="bin\Release\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31624.102
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomProcessingSample", "CustomProcessingSample.csproj", "{AC6604D5-C586-469D-A88F-70ED93DD1C12}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AC6604D5-C586-469D-A88F-70ED93DD1C12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC6604D5-C586-469D-A88F-70ED93DD1C12}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC6604D5-C586-469D-A88F-70ED93DD1C12}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC6604D5-C586-469D-A88F-70ED93DD1C12}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B6987CF3-60F8-4D06-9584-E5C2627B732B}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

using System.Threading.Tasks;
using WindwardCustomProcessing;

namespace CustomProcessingSample
{
public class CustomProcessor : IDocumentPostProcessor
{
//This is the only method that needs to be defined in the IDocumentPostProcessor.
//You can implement any other helper methods, but this is the method the RESTful engine will call.
public Task<CustomDocument> Process(CustomDocument document)
{
//Setting the document data to an empty byte array
document.Data = new byte[0];
return Task.FromResult(document);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CustomProcessingSample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomProcessingSample")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ac6604d5-c586-469d-a88f-70ed93dd1c12")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Fluent .NET RESTful Custom Processing Sample
This is a sample project to see how the custom processing works in the Legacy .NET RESTful engine.
In this sample, we are removing the data from the document, so when you get the document after processing, "Data" should be an empty byte array.

## Usage
1. Clone or download this repository
2. Open the CustomProcessingSample solution in Microsoft Visual Studio
3. Ensure you have the WindwardCustomProcessing.dll file from your .NET RESTful Engine (located in the bin folder)
4. Place the WindwardCustomProcessing.dll in the sample project and add a reference to it in Visual Studio
1. We have a WindwardCustomProcessing.dll provided by default in the bin/Debug folder for your convinience
5. Build the solution
6. After building the solution navigate to the "obj/Debug" directory for the project, there you will find the "CustomProcessingSample.dll" file. Move this file to your RESTful Engine bin folder:
```
C:\inetpub\wwwroot\RESTfulEngine\bin
```
7. Copy the path to the file
8. Next we will add the following to our web.config file for the RESTful engine:
```
<appSettings>
<add key="postProcessor" value="C:\inetpub\wwwroot\RESTfulEngine\bin\CustomProcessingSample.dll!CustomProcessingSample.CustomProcessor" />
</appSetings>
```
9. Now, start up your RESTful engine and run a report. When you get the report the "Data" will be empty

## Documentation
You can view a full tutorial on how to accomplish this in our documentation [here](https://fluent.apryse.com/documentation/engine-guide/Fluent%20RESTful%20Engines/NetRESTCustomProc).