On Tue May 5 2009 4:33:37 pm a...@work wrote:
> I tried putting the soap header using
> requestContext.put("Header.HEADER_LIST", headerList) also tried -exsh but
> each time, this is the Payload I see in my logs
It's not:
requestContext.put("Header.HEADER_LIST", headerList)
It should be:
requestContext.put(Header.HEADER_LIST, headerList)
Basically, remove the quotes and import the Header class. (actually,
SoapHeader.HEADER_LIST should work as well since Header is the superclass)
Dan
>
> Payload: <soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><EncryptV
>alue
> xmlns="http://tempuri.org/"><Value>626948725</Value></EncryptValue></soap:B
>ody></soap:Envelope>
>
> How do I get the
> <soap:Header>
> <SecureHeader xmlns="http://tempuri.org/service">
> <UserName>username</UserName>
> <Password>password</Password>
> </SecureHeader>
> </soap:Header>
>
> in my Payload?
>
> Here's the code I used in client
>
> SecureHeader sh = new SecureHeader();
> sh.setUserName("user");
> sh.setPassword("pass");
>
> JAXBElement<SecureHeader> job = new JAXBElement<SecureHeader>(
> new QName("http://tempuri.org/", "SecureHeader"),
> SecureHeader.class, null, sh);
>
> SoapHeader hdr = new SoapHeader(
> new QName("http://tempuri.org/", "MyService"),
> job,
> new JAXBDataBinding(sh.getClass()));
>
> List<SoapHeader> holder = new ArrayList<SoapHeader>();
> holder.add(hdr);
>
> // Set request context property.
> java.util.Map<String, Object> requestContext =
> ((javax.xml.ws.BindingProvider)port).getRequestContext();
>
> requestContext.put("Header.HEADER_LIST", holder);
--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog