How the client is created. If it is through Dispatch. You can do the
following way.
resourceDispatch.getRequestContext().put(Header.HEADER_LIST,
getCustomerHeader());
public Collection<Header> getCustomerHeader() throws Exception {
SoapHeader sh_client_id=null;
SoapHeader sh_dev_pass=null;
SoapHeader sh_dev_email=null;
try {
Document d = createXMLDocument();
Element dev_email =
d.createElement("developer_email");
dev_email.setTextContent("......");
sh_dev_email = new SoapHeader(new
QName("http://www.google.com/api/adsense/v2", "AccountServiceService"),
dev_email);
Element dev_pass =
d.createElement("developer_password");
dev_pass.setTextContent("......");
sh_dev_pass = new SoapHeader(new
QName("http://www.google.com/api/adsense/v2", "AccountServiceService"),
dev_pass);
Element client_id = d.createElement("client_id");
client_id.setTextContent("......");
sh_client_id = new SoapHeader(new
QName("http://www.google.com/api/adsense/v2", "AccountServiceService"),
client_id);
}catch(Exception e) {
throw new Exception(e.getMessage(), new
Throwable(e));
}
List<Header> lshd = new ArrayList<Header>();
lshd.add(sh_dev_email);
lshd.add(sh_dev_pass);
lshd.add(sh_client_id);
return lshd;
}
Regards
Raman
-----Original Message-----
From: Anand R [mailto:[email protected]]
Sent: Friday, February 18, 2011 3:58 PM
To: [email protected]
Subject: Query - Setting a custom HTTP request header
Hi,
Is there a way to set a custom HTTP request header from a CXF client?
Thanks and regards,
Anand R
DISCLAIMER:
"The information in this e-mail and any attachment is intended only for
the person to whom it is addressed and may contain confidential and/or
privileged material. If you have received this e-mail in error, kindly
contact the sender and destroy all copies of the original communication.
IBS makes no warranty, express or implied, nor guarantees the accuracy,
adequacy or completeness of the information contained in this email or
any
attachment and is not liable for any errors, defects, omissions, viruses
or for resultant loss or damage, if any, direct or indirect."