-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNewPythonFormatPluginTemplate.txt
37 lines (27 loc) · 1.62 KB
/
NewPythonFormatPluginTemplate.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from IronWASP import *
from System import *
import clr
#Inherit from the base FormatPlugin class
class <Plugin Name>(FormatPlugin):
#Override the ToXmlFromRequest method of the base class with custom functionlity. Convert RequestBody in to Xml String and return it
def ToXmlFromRequest(self, req):
return self.ToXml(req.BodyArray)
#Override the ToXmlFromResponse method of the base class with custom functionlity. Convert ResponseBody in to Xml String and return it
def ToXmlFromResponse(self, res):
return self.ToXml(res.BodyArray)
#Override the ToXml method of the base class with custom functionlity. Convert ByteArray in to Xml String and return it
def ToXml(self, object_array):
#Override the ToRequestFromXml method of the base class with custom functionlity. Update Request based on Xml String input and return it
def ToRequestFromXml(self, req, xml):
req.BodyArray = self.ToObject(xml)
return req
#Override the ToResponseFromXml method of the base class with custom functionlity. Update Response based on Xml String input and return it
def ToResponseFromXml(self, res, xml):
res.BodyArray = self.ToObject(xml)
return res
#Override the ToObject method of the base class with custom functionlity. Convert the XmlString in to an Object and return it as ByteArray
def ToObject(self, xml_string):
p = <Plugin Class Name>()
p.Name = "Name of the Plugin inside Iron. Pick a short name without spaces and special characters like 'DoublePipeSeperator','CustomResponseBody' etc. Name must be unique across all plugins"
p.Description = "Short Description of the Plugin, displayed in the Plugins section"
FormatPlugin.Add(p)