XML Tutorial
Xpath tutorial, xslt tutorial, xquery tutorial, xsd data types, web services.
- SOAP stands for S imple O bject A ccess P rotocol
- SOAP is an application communication protocol
- SOAP is a format for sending and receiving messages
- SOAP is platform independent
- SOAP is based on XML
- SOAP is a W3C recommendation
It is important for web applications to be able to communicate over the Internet.
The best way to communicate between applications is over HTTP, because HTTP is supported by all Internet browsers and servers. SOAP was created to accomplish this.
SOAP provides a way to communicate between applications running on different operating systems, with different technologies and programming languages.

SOAP Building Blocks
A SOAP message is an ordinary XML document containing the following elements:
- An Envelope element that identifies the XML document as a SOAP message
- A Header element that contains header information
- A Body element that contains call and response information
- A Fault element containing errors and status information
All the elements above are declared in the default namespace for the SOAP envelope:
http://www.w3.org/2003/05/soap-envelope/
and the default namespace for SOAP encoding and data types is:
http://www.w3.org/2003/05/soap-encoding
Syntax Rules
Here are some important syntax rules:
- A SOAP message MUST be encoded using XML
- A SOAP message MUST use the SOAP Envelope namespace
- A SOAP message must NOT contain a DTD reference
- A SOAP message must NOT contain XML Processing Instructions
Advertisement
Skeleton SOAP Message
The soap envelope element.
The required SOAP Envelope element is the root element of a SOAP message. This element defines the XML document as a SOAP message.
The xmlns:soap Namespace
Notice the xmlns:soap namespace in the example above. It should always have the value of: "http://www.w3.org/2003/05/soap-envelope/".
The namespace defines the Envelope as a SOAP Envelope.
If a different namespace is used, the application generates an error and discards the message.
The encodingStyle Attribute
The encodingStyle attribute is used to define the data types used in the document. This attribute may appear on any SOAP element, and applies to the element's contents and all child elements.
A SOAP message has no default encoding.
The SOAP Header Element
The optional SOAP Header element contains application-specific information (like authentication, payment, etc) about the SOAP message.
If the Header element is present, it must be the first child element of the Envelope element.
Note: All immediate child elements of the Header element must be namespace-qualified.
The example above contains a header with a "Trans" element, a "mustUnderstand" attribute with a value of 1, and a value of 234.
SOAP defines three attributes in the default namespace. These attributes are: mustUnderstand, actor, and encodingStyle.
The attributes defined in the SOAP Header defines how a recipient should process the SOAP message.
The mustUnderstand Attribute
The SOAP mustUnderstand attribute can be used to indicate whether a header entry is mandatory or optional for the recipient to process.
If you add mustUnderstand="1" to a child element of the Header element it indicates that the receiver processing the Header must recognize the element. If the receiver does not recognize the element it will fail when processing the Header.
The actor Attribute
A SOAP message may travel from a sender to a receiver by passing different endpoints along the message path. However, not all parts of a SOAP message may be intended for the ultimate endpoint, instead, it may be intended for one or more of the endpoints on the message path.
The SOAP actor attribute is used to address the Header element to a specific endpoint.
The encodingStyle attribute is used to define the data types used in the document. This attribute may appear on any SOAP element, and it will apply to that element's contents and all child elements.
The SOAP Body Element
The required SOAP Body element contains the actual SOAP message intended for the ultimate endpoint of the message.
Immediate child elements of the SOAP Body element may be namespace-qualified.
The example above requests the price of apples. Note that the m:GetPrice and the Item elements above are application-specific elements. They are not a part of the SOAP namespace.
A SOAP response could look something like this:
The SOAP Fault Element
The optional SOAP Fault element is used to indicate error messages.
The SOAP Fault element holds errors and status information for a SOAP message.
If a Fault element is present, it must appear as a child element of the Body element. A Fault element can only appear once in a SOAP message.
The SOAP Fault element has the following sub elements:
SOAP Fault Codes
The faultcode values defined below must be used in the faultcode element when describing faults:
The HTTP Protocol
HTTP communicates over TCP/IP. An HTTP client connects to an HTTP server using TCP. After establishing a connection, the client can send an HTTP request message to the server:
The server then processes the request and sends an HTTP response back to the client. The response contains a status code that indicates the status of the request:
In the example above, the server returned a status code of 200. This is the standard success code for HTTP.
If the server could not decode the request, it could have returned something like this:
SOAP Binding
The SOAP specification defines the structure of the SOAP messages, not how they are exchanged. This gap is filled by what is called "SOAP Bindings". SOAP bindings are mechanisms which allow SOAP messages to be effectively exchanged using a transport protocol.
Most SOAP implementations provide bindings for common transport protocols, such as HTTP or SMTP.
HTTP is synchronous and widely used. A SOAP HTTP request specifies at least two HTTP headers: Content-Type and Content-Length.
SMTP is asynchronous and is used in last resort or particular cases.
Java implementations of SOAP usually provide a specific binding for the JMS (Java Messaging System) protocol.
Content-Type
The Content-Type header for a SOAP request and response defines the MIME type for the message and the character encoding (optional) used for the XML body of the request or response.
Content-Length
The Content-Length header for a SOAP request and response specifies the number of bytes in the body of the request or response.
A SOAP Example
In the example below, a GetStockPrice request is sent to a server. The request has a StockName parameter, and a Price parameter that will be returned in the response. The namespace for the function is defined in "http://www.example.org/stock".
A SOAP request:
The soap response:.

COLOR PICKER

Report Error
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
Thank You For Helping Us!
Your message has been sent to W3Schools.
Top Tutorials
Top references, top examples, get certified.
- Skip to main content
- Skip to search
- Skip to select language
- Get MDN Plus
- English (US)
XML introduction
XML (Extensible Markup Language) is a markup language similar to HTML , but without predefined tags to use. Instead, you define your own tags designed specifically for your needs. This is a powerful way to store data in a format that can be stored, searched, and shared. Most importantly, since the fundamental format of XML is standardized, if you share or transmit XML across systems or platforms, either locally or over the internet, the recipient can still parse the data due to the standardized XML syntax.
There are many languages based on XML, including XHTML , MathML , SVG , RSS , and RDF . You can also define your own.
Structure of an XML document
The whole structure of XML and XML-based languages is built on tag s.
XML declaration
XML - declaration is not a tag. It is used for the transmission of the meta-data of a document.
Used version XML in this document.
Used encoding in this document.
"Correct" XML (valid and well-formed)
Correct design rules.
For an XML document to be correct, the following conditions must be fulfilled:
- Document must be well-formed.
- Document must conform to all XML syntax rules.
- Document must conform to semantic rules, which are usually set in an XML schema or a DTD ( Document Type Definition ) .
Now let's look at a corrected version of that same document:
A document that contains an undefined tag is invalid. For example, if we never defined the <warning> tag, the document above wouldn't be valid.
Most browsers offer a debugger that can identify poorly-formed XML documents.
Like HTML, XML offers methods (called entities) for referring to some special reserved characters (such as a greater than sign which is used for tags). There are five of these characters that you should know:
Even though there are only 5 declared entities, more can be added using the document's Document Type Definition . For example, to create a new &warning; entity, you can do this:
You can also use numeric character references to specify special characters; for example, © is the "©" symbol.
Displaying XML
XML is usually used for descriptive purposes, but there are ways to display XML data. If you don't define a specific way for the XML to be rendered, the raw XML is displayed in the browser.
One way to style XML output is to specify CSS to apply to the document using the xml-stylesheet processing instruction.
There is also another more powerful way to display XML: the Extensible Stylesheet Language Transformations ( XSLT ) which can be used to transform XML into other languages such as HTML. This makes XML incredibly versatile.
Recommendations
This article is obviously only a very brief introduction to what XML is, with a few small examples and references to get you started. For more details about XML, you should look around on the Web for more in-depth articles.
Learning the HyperText Markup Language ( HTML ) will help you better understand XML.
- Extensible Markup Language (XML) @ W3.org
- Using XML: A List Apart
Message Header Analyzer
- No suggested jump to results
- Notifications

Name already in use
Dotnet-api-docs / xml / system.servicemodel.channels / messageheader.xml.
- Go to file T
- Go to line L
- Copy permalink
- Open with Desktop
- View git blame
- Reference in new issue
- United States
- United Kingdom
- Java, XML, and Web services
- RELATED STORIES
- 10 steps to SOA
- SPONSORED BY Advertiser Name Here Sponsored item title goes here as designed
- Enterprise service buses hit the road
- Building SOA your way
XML messaging, Part 1
Write a simple xml message broker for custom xml messages.
By Dirk Reinshagen
JavaWorld |
XML messaging represents a rapidly growing, dynamic area of IT, a situation that makes it exciting and tiresome at the same time. As B2B exchanges and other forms of inter-business electronic communication grow, XML messaging will be more widely deployed than ever.
Read the whole "XML Messaging" series:
- Part 1: Write a simple XML message broker for custom XML messages
- Part 2: XML messaging the SOAP way
- Part 3: JAXM and ebXML set the new standard for XML messaging
In this article, we'll first explore XML messaging and why it is useful. Then we'll delve into specific XML messaging features, including message routing, transformation, and brokering. Finally, we'll finish up with a simple example of an XML broker. After you read and understand the concepts, you should clearly understand which scenarios lend themselves to implementing an XML messaging solution.
What is XML messaging?
To start our exploration, we need to understand the basic premise of XML messaging and what the term messaging implies. For purposes of this article, I define message as follows:
A collection of data fields sent or received together between software applications. A message contains a header (which stores control information about the message) and a payload (the actual content of message).
Messaging uses messages to communicate with different systems to perform some kind of function. We refer to the communication as being message-oriented because we would send and receive messages to perform the operation, in contrast to an RPC (Remote Procedure Call)-oriented communication. A simple analogy may help: think of messaging as email for applications. Indeed, messaging possesses many of the attributes of individuals sending email messages to one another.
In the past, when you were using or working on a message-oriented system, it meant that you were using some kind of MOM (message-oriented middleware) product like Tibco's Rendezvous, IBM's MQSeries, or a JMS provider to send messages in an asynchronous (one-way) fashion. Messaging today doesn't necessarily mean that you are using a MOM product, and it doesn't necessarily mean that you are communicating asynchronously. Rather, messaging can be either synchronous (two-way) or asynchronous and use many different protocols such as HTTP or SMTP, as well as MOM products.
Why XML messaging?
Why would you want to develop a system using messaging? What makes messaging a useful design technique and what are the benefits? As mentioned earlier, we can chose from two alternatives when requiring two applications to talk to each other over a network: RPC or message-oriented. Using an RPC-based approach (RMI falls into this category) means that the client (or caller) of the procedure call knows the procedure it wants to invoke and knows the parameters it wishes to pass to the procedure. Also, the caller wishes to wait while the called server (the application) completes the request.
In the second approach -- message-oriented -- the caller does not necessarily know the exact procedure that will be invoked, but instead creates a message of a specific format known to both the client and the server. The client creates the message and then sends it to the server over the network. Therefore, the client does not depend on the server or the server's procedures, but is dependent on the message format. Also, the communication likely takes place in an asynchronous fashion, meaning that the client will send off a request but will not wait (block) for the response. This enables the client to continue to function even if the server becomes unavailable (crashes, for example). This design, where the client is more independent of the server, is considered to be more loosely coupled.
When evaluating whether to use a message-oriented design it is important to understand the pros and cons of such a system. The pros include:
- Loose coupling
- Easier message routing and transformation
- More flexible payload (can include binary attachments, for example)
- Can use several messages together to invoke a given procedure
In general, a message-oriented approach proves more flexible than an RPC approach.
Now here are some cons:
- It requires more work to develop a client/server interaction using a message-oriented approach compared with an RPC approach like RMI because developing a client/server interaction via a message represents another level of indirection from RPC. Complexity is added through the creation of the message on the client side (versus a procedure invocation in an RPC approach) and on the server side with message-processing code. Because of its added complexity, a message-oriented design can be more difficult to understand and debug.
- There is a risk of losing type information for the programming language in which the message was sent. For example, double in Java may not translate as a double in the message.
- In most cases the transactional context in which the message was created does not propagate to the messaging server.
Considering the pros and cons, when should you use a message-oriented approach? The most common scenario occurs when the client/server communication takes place over the Internet and the client and server belong to different companies. In this scenario it could be fairly difficult to have the two companies agree on the procedure interface. Also, it's possible that the companies might not want to use the same programming language. In another example, the companies involved may want to use an asynchronous communication model so that neither will depend on the other's application being up and running.
Another attractive messaging scenario occurs when you're developing an event-based system in which events are created and then consumed by interested parties. Most GUIs are event-based. For instance, they might create a mouse click event in which interested parties listen for the event and perform some action based on it. In this scenario, using a messaging approach allows you to remove the dependency between an event (or action in a system) and the system's reaction to the event that is performed on the server.
Now that we understand a bit about messaging, we're ready to add XML to the equation. The addition of XML to messaging means that we are able to make use of a flexible data formatting language for our messages. In messaging, both the client and the server need to agree on a message format. XML makes this easier by deciding many data formatting issues and with the addition of other XML standards such as Rosetta Net. No additional work is required to come up with a message format.
What does an XML message broker do?
A message broker acts as the server in a message-oriented system. Message broker software performs operations on messages it receives. These operations include:
Header processing
Security checks and encryption/decryption, error and exception handling, transformation.
Header processing is usually one of the first functions performed in the message upon its receipt within an XML broker. Header processing involves examining the header fields of incoming messages and performing some functions. Header processing could include adding a tracking number to an incoming message or ensuring that all of the header fields necessary to process the message exist. In the example XML message below, the message broker could check the to header field to ensure that this is the proper destination for this message.
From a security perspective, a message broker can perform several different operations, but most likely you'll want to accomplish the "big three" of security: authentication, authorization, and encryption. First, once it determines that the message contains data that can be used to authenticate, the message broker will authenticate messages against a security database or directory. Second, the message broker will authorize operations that can be performed with this type of message and an authorized principal. Finally, the message that arrives at the message broker may be encrypted using some encryption scheme. It will be the broker's responsibility to decrypt the message in order to process it further.
Error and exception handling is another important piece of functionality performed by the message broker. Generally, the message will respond to the client (assuming a synchronous invocation) with an error message, caused when the message sent to the broker does not contain sufficient or accurate information. Another cause for errors or exceptions would occur when servicing the request (actually invoking a procedure/method based on the payload of the message).
Message routing is branching logic for messages. It occurs at two different levels in a message. The first, header-level routing, determines if an incoming message is bound for this application or needs to be resent to another application. The second, payload routing, determines which procedure or method to invoke once the broker determines that the message is bound for this application. Together these two types of routing enable a rich set of functionality when dealing with messages.
Invocation means to actually call or invoke a method with the data (payload) contained in the incoming message. This could produce a result that is then returned through the broker back to the client. What is invoked could be anything, including an EJB Session bean, class method, and so on.
Transformation converts or maps the message to some other format. With XML, XSLT is commonly used to perform transformation functionality.
An example XML message
Below you'll find an XML message used in the sample application that follows. Notice the header and body portions. This example is a "saveInvoice" type of message, in which the body contains an invoice that needs to be saved.
You may wonder whether there is an advantage to developing a custom XML message. Why not use one of the existing message standards like ebXML or SOAP to encapsulate the payload (the invoice)? There are a couple of reasons. The first is to demonstrate some of the contents needed in a message without all of the complexity of explaining a full-blown industry standard. Second, although the existing standards fill most needs, there still will be scenarios in which using a custom message will better fit the needs of a situation, much like the tradeoffs between using a higher-level protocol like HTTP or SMTP and using raw sockets.
A prototype XML broker implementation
Having discussed the reasons for using a messaging design in your application, we will now proceed to a prototype XML messaging broker implementation.
Why should you develop a custom message broker implementation instead of using an existing one? Well, because many of the implementations for XML messaging products are new, so it's important to know what goes into a basic implementation. Also, it's possible that because XML message brokers are somewhat immature products, you'll need to develop your own to get the features you want.
The basic broker presented here can service two types of messages: a request to create an invoice, which it stores on the filesystem, and a client code component, which just reads the XML message from a file and sends it.
The broker comprises three main parts: a listener piece that receives incoming messages on some transport (in this example there will only be an HTTP implementation provided); the main broker piece, which will decide what to do with an incoming message; and the invocation piece that will actually perform some logic based on the incoming message. Let's look at each in more detail.
Receive the message from the transport
A message will first encounter the broker's listener portion. Most XML message brokers provide support for many different transports (protocols) such as HTTP, SMTP, JMS (a particular vendor's implementation), and so on. Our broker allows for this by isolating the transport portion. The piece shown below simply receives the message on a given transport, places the incoming message into a string variable, and calls the broker singleton:
- Web Development
- Messaging Apps
- Programming Languages
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Message Header. Create Header Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a new message header.
CreateHeader(String, String, Object)
Creates a new message header with the specified data.
The local name of the header XML element.
The namespace URI of the header XML element.
The content of the header to be created.
A new MessageHeader object with the specified data.
CreateHeader(String, String, Object, Boolean)
A value that indicates whether the header must be understood.
CreateHeader(String, String, Object, XmlObjectSerializer)
Creates a header from an object to be serialized using the XmlFormatter.
An XmlObjectSerializer that is used to serialize the header.
CreateHeader(String, String, Object, Boolean, String)
The targeted recipient of the message header.
CreateHeader(String, String, Object, XmlObjectSerializer, Boolean)
Createheader(string, string, object, boolean, string, boolean).
A value that indicates whether the header should be relayed.
CreateHeader(String, String, Object, XmlObjectSerializer, Boolean, String)
Createheader(string, string, object, xmlobjectserializer, boolean, string, boolean), additional resources.
The SetHeader EIP is used for setting a message header.
The Set Header eip supports 2 options, which are listed below.
Using Set Header
The following example shows how to set a header in a Camel route:
And the same example using XML:
In the example the header value is a constant .
Any of the Camel languages can be used, such as Simple .
And in XML:
Header can be set using fluent syntax.
See JSONPath for another example.
Setting a header from another header
You can also set a header with the value from another header.
In the example we set the header foo with the value from an existing header named bar.
- Stack Overflow Public questions & answers
- Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
- Talent Build your employer brand
- Advertising Reach developers & technologists worldwide
- About the company
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Add namespaces and prefixes to soap message header during serialization
I am trying to generate an xml file with the following structure :
The xml i get is:
The classes i have are :
The problem is that when i declare the namespaces with the class XmlSerializerNamespaces like this :
I get both of the namespaces in the root element, and no namespace in the element Security . And also how do i manage to add also the two other namespaces at Security element : xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:mustunderstand="1" Have tried different ways i found while searching these days but none of them seems to work.
- serialization

I get both of the namespaces in the root element
This is semantically equivalent to the XML you're trying to generate. You can't control this with XmlSerializer - the first thing it will do is write all the namespace bindings in the root element. You shouldn't have any reason to be concerened about this, however.
And also how do i manage to add also the two other namespaces at Security element : xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:mustunderstand="1"
There are two things here: one is a namespace binding, and one is an attribute. If you add the attribute correctly, the namespace binding will be added in the root along with the others:
This gives the output below, which is equivalent to your expected output:
See this fiddle for a working demo.
Your Answer
Sign up or log in, post as a guest.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct .
Not the answer you're looking for? Browse other questions tagged c# xml serialization soap or ask your own question .
- The Overflow Blog
- For those who just don’t Git it (Ep. 573)
- How to use marketing techniques to build a better resume
- Featured on Meta
- AI/ML Tool examples part 3 - Title-Drafting Assistant
- We are graduating the updated button styling for vote arrows
- Temporary policy: ChatGPT is banned
- The [connect] tag is being burninated
- Stack Overflow will be testing a title-drafting assistant, and we’d like your...
- We are graduating the "Related questions using Machine Learning" experiment
Hot Network Questions
- Better way to specifying arguments for multivariable function
- "That Christ deny’d divorce to his own", what does Milton mean here in this phrase from "The Doctrine & Discipline of Divorce"?
- When a journalist writes "shareholders wiped out" what does this actually mean?
- Is colour alone enough to convey warning?
- For a finite set A of positive reals, prove that the set A + A - A contains at least as many positive as negative elements
- How would one protect one self from a suit while skiing?
- Can hypothesis-publishing make one liable for defamation?
- Why don't my hover tanks fly?
- How to create a radial transparency gradient on a cylinder for a laser render?
- Equivalent of sequence convergence in Hilbert space
- Can you use the Seeming spell to appear invisible?
- How would D&D 5e spellcasters investigate an anonymous attack?
- Extra calls to state_getRuntimeVersion with polkadot.js
- What are some examples of LaTeX commands which accept three or more arguments?
- How is a CAN bus like an AND gate?
- How NOT to join insider program
- The Enlarge spell only effects one creature or object and its wording is ambiguous. What happens to a creature's armor or clothing if it grows?
- Story about a girl whose mother has a marsupial pouch
- What does Mrs Weston mean by "do not beat me" in "Emma"?
- How many students in this Math circle and can they together explain the solution of all of the 20 problems?
- Can we have laws of physics without any laws of conservation?
- Received an ultimatum from PhD advisor to leave that broke me completely
- LeftMouse focus window without moving cursor
- Why are there two inverses to exponentiation?
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .
- Ask a Question
- Write a Blog Post
- Login / Sign-up
Technical Articles

SAP Integration Suite- Deep dive into Content Modifier
Introduction:.
Content Modifier is very essential and useful step of Cloud Integration which many of developers might have already tried.In below blog post I will try to cover some of the uses cases which are very helpful for beginners to understand how we can leverage this useful step.
Content Modifier Basics:
As most of you already aware of the fact that Cloud Integration leverages Apache Camel then what concept does Content Modifier represents,lets try to understand some basic characterstics of Content Modifier.
Camel Exchange:
Camel Exchange represents an abstraction for an exchange of messages which involves a input message and its corresponding output or an exception message.

Exchange ID: A unique ID that identifies the exchange.
MEP( Message Exchange Pattern ): Represents pattern of the exchange.
- InOnly when a route handles a one-way message, where the sender doesn’t wait for a reply from the receiver. This represents asynchronous message handling where sender doesnt expect Response.
- InOut is when a route handles a request-response message. The sender expects a reply from the route, which will be stored as an out-message in the exchange. This represents synchronous message handling where sender expect Response ( part of out-message ).
Exception: If an error occurs during message processing, the reason for the error is stored in the Exception field of the exchange.
Properties: A form of temporary storage where process steps can store data.Data stored in property in exist till exchange Exist.
Attachment: Attachment to In-Message or Out-Message which is optional
Content Modifier :
As shown in the above section there are 4 parts to Content Modifier on high level i.e. General,Headers ,Properties and Body.Lets deep dive into each sections to see what are the different possibilities or brief use cases we can leverage this step.

1. General :
Always try to enter some meaning full name that helps you to identify high level action you are going to perform using that Content Modifier.For example SetParamters,RestrctureData,ReadVariable.Also valid name here will help you to easily identify the step details in trace.
2. Message Header:
Headers are important aspect of Message which will get propagated to reciever system or target system.If developers use the headers across their integration flows and don’t like them to be sent out of Cloud Integration, it’s recommended to use properties since those doesnt gets propagated to receiver system.
These headers values can be set with values coming from different input data.
Action can have 2 possible values either Create or Delete. Create will add headers to message and delete will remove the headers from message.Most of the developers use create headers to use it across thier integration process and forget to delete those when its not necessary.Its always important to reset those headers when not required and follow the blog to understand how to do it.
Name of the header that is used for later flow steps.These values can be called using camel expression ${header.<HEADER NAME>}
This field refers different type of values can be assigned to this headers.
- Constant: Any constant value that will be carried across integration process.
- Expression:Values can be called using camel simple expressions like ${header.<HEADER_NAME>} ,${property.<PROPERTY_NAME>.Refer the blog to know more about Camel Simple Expressions.
- Global Variable: We can use Write Variables step type to create a variable at a certain point within the message processing sequence to be used across Integration Flows of cloud integration tenant.To consume the Global variable ( with the scope of tenant ) we can set type as Global Variable and set it to header or property in Content Modifier.
- Header: Pass value from other header to newly created header.
- Local Variable:We can use Write Variables step type to create a variable at a certain point within the message processing sequence within same integration flow.To consume the Local variable ( with the scope of integration flow ) we can set type as Local Variable and set it to header or property in Content Modifier.
- Number Range:It helps to insert unique sequence numbers as part of the inbound or outbound messages.To consume Number Ranges we can set type as Number Ranges and set it to header or property in Content Modifier.
- Property:source value depending on the type either header name,a property name, a variable name or any other type.
- XPath: Set the value of XPath to header. Refer to know different XPath functions supported.
- Data Type: The Data Type column is used only for the types XPath and Expression. The data type can belong to any Java class. Refer to know more about supported datatypes.
- Value: Place holder for source value.Its value depends on the type ( like Header,Property,Local Variable…)
- Default:If you have selected Local Variable or Global Variable as Type, the value specified as Default will be assigned to the header value if the variable is not found at runtime.
3. Exchange Property:
Properties are important aspect of Message which will not get propagated to reciever system or target system.Boundary condition for properties is integration flow.Rest of the configuration remains same as header.
4. Message Body
Body contains actual message or content.There are 2 ways you can set the body value either a constant or using camel simple expressions.If body is kept empty that the body is not changed.
Lets try to document some of the usefull tricks and tips with Content Modifier
Use Case 1 – Dealing with date function
Its very easy to set headers or properties with date values using simple expressions.As per Apache camel simple expression guide below well defines date and date with timezone.
How to add more details into date time patterns:
Refer below table that would help you to get more values as per java.text.SimpleDateFormat
Use Case 2: Using Java string functions with headers and properties
We can use java string functions with headers ,properties and body to set the manipulated values
Beow are the few functions that could be used with Headers,Properties and Body.
Use Case 3 : Handling XPATH expressions
Xpath expressions are very usefull while dealing with XML data and inside content modifier we can achieve transformation to certains level.Refer XPath functions for deep diving more into the same.
Use Case 4: Playing around message content
Usually most of us come across generating CSV file having field header names with spaces.Since XML standards doesnt allow to have spaces in element name its easy to tackle the same using content modifier.Also while concating the data content encoding needs to be carefully considered to avoid any data corruption issues.

Use Case 5: simplify configuration of runtime parameters
Using content modifier most of the user runtime input parameters for iflow can be managed.Here we use Parameter Externalization concept to achieve the same.
Simple Input parameter screen ( configure option in Iflow ):

How content modifier can be used ( most of the parameters are part of content modifier which later used across Integration Process ):

Will be adding more usecases going further please do watch this place more content!
Sriprasad Shivaram Bhat
Assigned Tags

Good one.. got the new java functions with header, properties and Body. Like substring and replace all
- Share Right click and copy the link to share this comment

Nice and Crisp Explanation.

Hi Sriprasad,
I have always found difficult to understand replaceAll.
In your example also, you mentioned ${body.replaceAll(‘\\’,’\+’)}. Here these double slashes and inverted commas, I'm not able to understand. What will replace what here. If you can explain this. It will help.

Amazing blog!
Can we also add Days to the Current date function in property itself?
For eg; I want to add 10 days in the current date, so can I handle this in Content modifier without using any groovy?
Insert/edit link
Enter the destination URL
Or link to existing content

IMAGES
VIDEO
COMMENTS
The XML prolog is optional. If it exists, it must come first in the document. XML documents can contain international characters, like Norwegian øæå or French êèé. To avoid errors, you should specify the encoding used, or save your XML files as UTF-8. UTF-8 is the default character encoding for XML documents.
XML stands for eXtensible Markup Language. XML was designed to store and transport data. XML was designed to be both human- and machine-readable. ... Header. Why Study XML? XML plays an important role in many different IT systems. XML is often used for distributing data over the Internet.
A SOAP message is an ordinary XML document containing the following elements: An Envelope element that identifies the XML document as a SOAP message. A Header element that contains header information. A Body element that contains call and response information. A Fault element containing errors and status information.
1. I have an xml file. I have to add the XMl file to message header of WCF request. I am using OperationContextScope for this. using (OperationContextScope scope = new OperationContextScope (myClient.InnerChannel)) { var samlHeader = CreateSAMLAssertion (); OperationContext.Current.OutgoingMessageHeaders.Add ( // Add smalheader which is a xml ...
XML (Extensible Markup Language) is a markup language similar to HTML, but without predefined tags to use. Instead, you define your own tags designed specifically for your needs. This is a powerful way to store data in a format that can be stored, searched, and shared. Most importantly, since the fundamental format of XML is standardized, if you share or transmit XML across systems or ...
Insert the message header you would like to analyze + - Analyze headers Clear Copy Submit feedback on github. Summary + - Subject: Message Id: Archived at: Creation time: From: ... Source header: Unknown fields: Microsoft Antispam Header + - Bulk Complaint Level: Phishing Confidence Level:
A message header contains optional metadata that describe a message encapsulated by the <xref:System.ServiceModel.Channels.Message> class. A <xref:System.ServiceModel.Channels.Message> can have zero or more headers that are used as an extension mechanism to pass information in messages that are application-specific.
Message headers with a get accessor can only appear in the HTTP response (for example, received message). When these headers are present in the HTTP request (that is, sent message), they are silently ignored. ... If the message is created with the SBMP thick client without a custom xml object serializer, the content type will default to ...
Header processing could include adding a tracking number to an incoming message or ensuring that all of the header fields necessary to process the message exist. In the example XML message below ...
A Message can contain any number of named XML fragments, called headers. Each fragment normally maps to a SOAP header. Each fragment normally maps to a SOAP header. Headers are accessed through the Headers property of type MessageHeaders .
Retrieves a message header in this collection by the specified LocalName, namespace URI and actors of the header element. GetHeader<T>(Int32) Retrieves a message header at a specific position in this collection. GetHeader<T>(Int32, XmlObjectSerializer) Retrieves a message header at a specific position in this collection.
The Inbound Message Format. The inbound XML message in the AxdLedgerJournal scenario should resemble the following XML code. Notice how the whole message is wrapped in an envelope and contains header information about the message unique identifier and the action that the document service performs.
Creates a new message header with the specified data. CreateHeader(String, String, Object, Boolean) Creates a new message header with the specified data. CreateHeader(String, String, Object, XmlObjectSerializer) Creates a header from an object to be serialized using the XmlFormatter. CreateHeader(String, String, Object, Boolean, String)
Required Name of message header to set a new value The simple language can be used to define a dynamic evaluated header name to be used. Otherwise a constant name will be used.
I get both of the namespaces in the root element. This is semantically equivalent to the XML you're trying to generate. You can't control this with XmlSerializer - the first thing it will do is write all the namespace bindings in the root element. You shouldn't have any reason to be concerened about this, however.
Use Case 4: Playing around message content Usually most of us come across generating CSV file having field header names with spaces.Since XML standards doesnt allow to have spaces in element name its easy to tackle the same using content modifier.Also while concating the data content encoding needs to be carefully considered to avoid any data corruption issues.