This discussion is archived
2 Replies Latest reply: Jan 23, 2013 8:54 PM by 955097 RSS

Set username/password using in Java client proxy for a JAX-WS webservice

955097 Newbie
Currently Being Moderated
Hi, i am invoking one deployed EBS webservice , while trying to run that client program me

i am getting error WSSE security, where can i set Uname pwd , through java program me

++Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Missing <wsse:Security> in SOAP Header


Thanks Regards
Raj

Edited by: 952094 on Jan 23, 2013 1:42 PM
  • 1. Re: Set username/password using in Java client proxy for a JAX-WS webservice
    user696 Explorer
    Currently Being Moderated
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Map;

    import javax.xml.ws.BindingProvider;
    import weblogic.wsee.security.unt.ClientUNTCredentialProvider;

    import weblogic.xml.crypto.wss.WSSecurityContext;
    import weblogic.xml.crypto.wss.provider.CredentialProvider;

    you can add username for weblogic client using

    // Create list of credential providers

    List credProviders = new ArrayList();

    // Create user name token provider

    ClientUNTCredentialProvider unt = new ClientUNTCredentialProvider("weblogic", "weblogic");
    credProviders.add(unt);

    credProviders.add(cp);

    // Finally add the credential providers to the request context

    Map<string, object=""> requestContext = ((BindingProvider)brokerService).getRequestContext();

    requestContext.put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST, credProviders);
  • 2. Re: Set username/password using in Java client proxy for a JAX-WS webservice
    955097 Newbie
    Currently Being Moderated
    You are not got my point
    this is my security header , i have include this By handlers or something like that into header part of my soap Request Headerpart

    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" mustUnderstand="1">
    <wsse:UsernameToken>
    <wsse:Username>sysadmin</wsse:Username>
    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">sysadmin</wsse:Password>
    </wsse:UsernameToken>
    </wsse:Security>

    Thanks Regards
    Raj

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points