You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Kiren Pillay <ki...@gmail.com> on 2016/05/25 13:32:21 UTC
Add Soap Headers Inband
Hi
I would like to add Soap credentials inband with by soap request using a
cxf-codegen classes.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ws="http://ws.xxxx.com">
<soapenv:Header xmlns:svsec="http://xxx.com">
<svsec:username>spbadmin</svsec:username>
<svsec:password>sandvine</svsec:password>
</soapenv:Header >
<soapenv:Body>
I'm using the following code as detailed in your FAQ, but the parameters
are not being sent on the wire.
SubscriberServices subscriberServicesPort = managerServices
.getSubscriberServicesPort();
BindingProvider provider = (BindingProvider) subscriberServicesPort;
Map<String, Object> requestContext = provider.getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
"http://localhost:8443");
LookupSubscriberRequest request = new LookupSubscriberRequest();
SubscriberKey subKey = new SubscriberKey();
subKey.setName(login);
try {
Header username = new Header(new QName(
"http://services.sandvine.com", "username"), "spbadmin",
new JAXBDataBinding(String.class));
Header password = new Header(new QName(
"http://services.sandvine.com", "password"), "sandvine",
new JAXBDataBinding(String.class));
List<Header> headers =new ArrayList<>();
headers.add(username);
headers.add(password);
requestContext.put(Header.HEADER_LIST, headers);
LookupSubscriberResponse lookupSubscriber =
subscriberServicesPort
.lookupSubscriber(request);
Regards
Kiren