1

Hello I have my application on weblogic 12C and I need consume a WSDL but I have that add the UsernamToken on security header.

I am tying the next:

gt.com.pro.wsdl.SMSServiceService service = new gt.com.pro.wsdl.SMSServiceService();
    gt.com.pro.wsdl.SMSServicePortType port = service.getSMSServiceHTTPPort();
    AddressingFeature feature = new AddressingFeature(true, false);
    port = service.getSMSServiceHTTPPort(feature);
    ObjectFactory objectFactory = new ObjectFactory();
    DatatypeFactory dttFact = DatatypeFactory.newInstance();
    List<CredentialProvider> credenciales = new ArrayList();
    credenciales.add(new ClientUNTCredentialProvider(usuario.getBytes(), clave.getBytes()));
    Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
    rc.put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST, credenciales);

the problem here is relative simple. And is that the weblogic server 12c (12.1.3) doesn't find the class WSSecurityContext on the package:

 import weblogic.xml.crypto.wss.WSSecurityContext;

1 Answer 1

0

Are you using SOAP Message? Then you can put the user name password in your handler chain. Here your headerhandler object will be of the request object type.

List<Handler> handlerChain = new ArrayList<Handler>();
handlerChain.add(headerHandler);
Binding binding = bindingProvider.getBinding();
binding.setHandlerChain(handlerChain);

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.