class VKOVAifXmlStr implements AifXmlSerializable
{
str xmlStr;
#define.MyDataObjectNS('http://schemas.contoso.com/samples/VKOVAifXmlStr')
#define.MyDataObjectRoot('VKOVAifXmlStr')
}
/// <summary>
/// Deserializes the xml to initialize the object.
/// </summary>
/// <param name="xml">
/// The xml to deserialize.
/// </param>
void deserialize(AifXml xml)
{
XmlTextReader xmlReader;
;
xmlReader = XmlTextReader::newXml(xml);
// turn off Whitespace handling to avoid extra reads
xmlReader.whitespaceHandling(XmlWhitespaceHandling::None);
xmlReader.moveToContent();
while ((xmlReader.nodeType() != XmlNodeType::Element) && !xmlReader.eof())
{
xmlReader.read();
}
xmlReader.readStartElement3(#MyDataObjectRoot, #MyDataObjectNS);
if (!xmlReader.eof() && xmlReader.isStartElement())
{
xmlStr = xmlReader.readElementString3('xml', #MyDataObjectNS);
}
xmlReader.readEndElement();
xmlReader.close();
}
public void fillXML(XmlTextWriter xmlTextWriter)
{
xmlTextWriter.writeElementString('xml', xmlStr);
}
/// <summary>
/// Returns the name of the root element of the xml document.
/// </summary>
/// <returns>
/// The name of the root element of the xml document.
/// </returns>
public AifDocumentName getRootName()
{
return #MyDataObjectRoot;
}
/// <summary>
/// Gets the schema of the xml document.
/// </summary>
/// <returns>
/// The xml schema that describes the document.
/// </returns>
AifXml getSchema()
{
str schema =
@'<?xml version="1.0"?>
<xsd:schema xmlns="http://schemas.contoso.com/samples/VKOVAifXmlStr"
targetNamespace="http://schemas.contoso.com/samples/VKOVAifXmlStr"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:complexType name="VKOVAifXmlStrType">
<xsd:sequence>
<xsd:element name="xml" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="VKOVAifXmlStr" type="VKOVAifXmlStrType"/>
</xsd:schema>'
;
return schema;
}
public void new()
{
xmlStr = @'<?xml version="1.0" encoding="UTF-8"?>
<Message>
<Activity>
<Id>ConfigurableProducts</Id>
<Language>EN-US</Language>
</Activity>
<Data>
</Data>
</Message>';
}
public str parmXml(str _xml = xmlStr)
{
xmlStr = _xml;
return xmlStr;
}
public str parmXmlAdd(str _xml = '')
{
if (_xml)
{
xmlStr = _xml + xmlStr;
}
return xmlStr;
}
/// <summary>
/// Serializes an object into xml.
/// </summary>
/// <returns>
/// The xml that represents this object instance.
/// </returns>
AifXml serialize()
{
str xml;
XmlTextWriter xmlTextWriter;
;
#Aif
xmlTextWriter = XmlTextWriter::newXml();
// turn off indentation to reduce file size
xmlTextWriter.formatting(XmlFormatting::None);
// initialize XML document
xmlTextWriter.writeStartDocument();
// write root element
xmlTextWriter.writeStartElement2(#MyDataObjectRoot, #MyDataObjectNS);
// write custom data
this.fillXML(xmlTextWriter);
// serialize XML document into XML string
xmlTextWriter.writeEndDocument();
xml = xmlTextWriter.writeToString();
xmlTextWriter.close();
return xml;
}
RunOn property of class should be set to Server
class VKOVAifXmlStrService
{
}
[SysEntryPointAttribute(true)]
public VKOVAifXmlStr makeRequest(str _xmlStr)
{
VKOVAifXmlStr xmlTest = new VKOVAifXmlStr();
xmlTest.parmXmlAdd(_xmlStr);
return xmlTest;
}
1. Create new one with name VKOVCustomServicesXml.
2. Right click and New Service Node Reference
3. Select VKOVAifXmlStrService as Service property and name
4. Deploy Service group
Check service Inbound ports: System administration -> Setup -> Services and Application Integration Framework -> Inbound ports
You also can use SoapUIIf you found value in what I share, I've set up a Buy Me a Coffee page as a way to show your support.
Buy Me a CoffeeNo comments. Be the first one to comment on this post.
DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics 365 FO.
Authors are allowed to set their own "buy me a coffee" link.
Join us.