Hi Colm

I managed to combine the snippet you provide into my code and now my code is 
working. I basically replaced 'utPort' with 'operationsPort' in my code.
Many thanks!

One remaining thing: is there a way to change the URL of the service end-point 
(which supports the same API)?

thx
aman


You can set the basic auth credentials in an AuthorizationPolicy object,
and set it on the HTTPConduit associated with your endpoint client. Here is
a test that does it:

https://github.com/apache/cxf/blob/d22aff30192d828b71a2fa7f9ffdc31c9f29324b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/basicauth/BasicAuthTest.java#L95

        Client client = ClientProxy.getClient(utPort);
        HTTPConduit http = (HTTPConduit) client.getConduit();
        AuthorizationPolicy authorizationPolicy = new AuthorizationPolicy();
        authorizationPolicy.setUserName("Alice");
        authorizationPolicy.setPassword("ecilA");
        authorizationPolicy.setAuthorizationType("Basic");
http.setAuthorization(authorizationPolicy);

Colm.

On Wed, Jul 10, 2019 at 2:28 PM SHAIKH, AMAN (AMAN) <
[email protected]> wrote:

>
> Hi Colm,
>
> Here's the relevant code snippet:
>
>         AttributeBindings attributeBindings = new AttributeBindings()
>         AttributeBinding attributeBinding1 = new AttributeBinding()
>         attributeBinding1.setName("validateBeforePreactivationForLTE")
>         attributeBinding1.setType(BindingType.SIMPLE_VALUE)
>         attributeBinding1.setValue("false")
>         attributeBindings.getAttributeBinding().add(attributeBinding1)
>         AttributeBinding attributeBinding2 = new AttributeBinding()
>         attributeBinding2.setName("serviceAffectingAllowed")
>         attributeBinding2.setType(BindingType.SIMPLE_VALUE)
>         attributeBinding2.setValue("true")
>         attributeBindings.getAttributeBinding().add(attributeBinding2)
>         AttributeBinding attributeBinding3 = new AttributeBinding()
>         attributeBinding3.setName("DN")
>         attributeBinding3.setType(BindingType.SIMPLE_VALUE)
>         attributeBinding3.setValue(distinguishedName)
>         attributeBindings.getAttributeBinding().add(attributeBinding3)
>         AttributeBinding attributeBinding4 = new AttributeBinding()
>         attributeBinding4.setName("parameterValuesByNames")
>         attributeBinding4.setType(BindingType.SIMPLE_VALUE)
>         attributeBinding4.setValue("administrativeState=" +
>             "${desiredState.getValue()}")
>         attributeBindings.getAttributeBinding().add(attributeBinding4)
>         String name = desiredState.toString() + '_' + distinguishedName
>         Operation operation = new Operation()
>         operation.setAttributeBindings(attributeBindings)
>         operation.setExecutionName(name)
>         operation.setDefName("Provision_Mass_Modification")
>
>         StartOperationRequest operationRequest = new
> StartOperationRequest()
>         operationRequest.setOperation(operation)
>
>         OpenCmOperationsServiceSOAP operationsService = new
> OpenCmOperationsServiceSOAP()
>         OpenCmOperationsPortType operationsPort =
> operationsService.getOpenCmOperationsPort()
>         StartOperationResponse operationResponse =
> operationsPort.startOperation(operationRequest)
>
>         jobid = operationResponse.getResult().getExecutionId()
>
> The above invocation fails since it does not have right credentials. Hence
> my question about being able to specify username and password.
>
>
> Could you provide a code snippet (or sample project) of what you are trying
> to do?
>
> Colm.
>
> On Wed, Jul 3, 2019 at 8:17 PM SHAIKH, AMAN (AMAN) <
> [email protected]>
> wrote:
>
> >
> >
> > Hi Colm
> >
> > The username/password is to be used for HTTP basic authentication.
> >
> > aman
> >
> > What is the username/password to be used for exactly? HTTP Basic
> > authentication? WS-Security?
> >
> > Colm.
> >
> > On Tue, Jun 25, 2019 at 12:55 AM SHAIKH, AMAN (AMAN) <
> > [email protected]<mailto:[email protected]>> wrote:
> >
> > > Hi
> > >
> > > I've used soap2wsdl to generate a JAR file from WSDL. In my code, when
> I
> > > issue a web-service request, I would like to change the URL of the
> server
> > > (hosting the web-service), user-name and password. How do I go about
> > doing
> > > it?
> > >
> > > thx
> > > aman
> > >
> > > Aman Shaikh
> > > Principal Inventive Scientist
> > > Advanced Technology and Systems, AT&T
> > > Voice: +1-908-901-2074 (W)
> > >
> > >
> >
> > --
> > Colm O hEigeartaigh
> >
> > Talend Community Coder
> > http://coders.talend.com
> >
> >
> > Aman Shaikh
> > Principal Inventive Scientist
> > Advanced Technology and Systems, AT&T
> > Voice: +1-908-901-2074 (W)
> >
> >
>
> --
> Colm O hEigeartaigh
>
> Talend Community Coder
> http://coders.talend.com
>
>
> Aman Shaikh
> Principal Inventive Scientist
> Advanced Technology and Systems, AT&T
> Voice: +1-908-901-2074 (W)
>
>


Aman Shaikh
Principal Inventive Scientist
Advanced Technology and Systems, AT&T
Voice: +1-908-901-2074 (W)

Reply via email to