You want to add custom header information to a SOAP request.
The SOAP 1.2 specification covers headers at length, and they are
a popular choice for storing all manners of data concerning message
exchanges within a SOA. There are also a number of SOAP headers that can
be defined to comply with the specification when you need to use certain
kinds of behavior. Some of the headers defined by the specification
relay. So, it’s important to understand how to use
Any user-defined header can also be defined by service clients and providers. Headers can be used to indicate vendor extensions (typically beginning with “X-”), or processing instructions such as what parts of an infoset can be cached, security codes, or other bits of meta-data.
There are a few basic ways to do work with SOAP headers. You can use the SAAJ API, which ensures portability, and add the headers to your code on invocation. That’s what we’ll examine here.
In this example, you’ll create a web service, examine the schema and WSDL that define it, and then write the client program to contact it. We’ll walk through every step to make sure that it’s clear how all of the parts get wired together.
The first thing you’ll do is create a web service. It will specify some header value that it wants clients to provide as a SOAP header, which it can then read on the server side and ...