You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Alexandre Jaquet <al...@gmail.com> on 2009/12/09 06:57:20 UTC

username and password of webservices

Hi,

We actually store the username and the password for calling external
webservice and then use it like this way on our cxf config file

    <jaxws:client id="ZWsCustomerCreate"
        serviceClass="xxx.customer.create.ZWsCustomerCreate"

        address="${webservice.sap.Z_WS_CUSTOMER_CREATE.url}">
        <jaxws:inInterceptors>
            <bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />
        </jaxws:inInterceptors>
        <jaxws:outInterceptors>
            <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"
/>
        </jaxws:outInterceptors>
    </jaxws:client>

    <http:conduit name="*Z_WS_ACC_DOCUMENT_POSTPort.http-conduit">
        <http:authorization>

<sec:UserName>${webservice.sap.Z_WS_ACC_DOCUMENT_POST.username}</sec:UserName>

<sec:Password>${webservice.sap.Z_WS_ACC_DOCUMENT_POST.password}</sec:Password>
        </http:authorization>
.........

Is there any way to remove the variable from the config file or encrypt it
in a Java class ?

${webservice.sap.Z_WS_ACC_DOCUMENT_POST.username}

Thanks in advance.

Re: username and password of webservices

Posted by Alexandre Jaquet <al...@gmail.com>.
Hi,

I finally founded this

        try {
            JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
            factory.setServiceClass(PensionWebService.class);
            factory.setAddress("
http://localhost:8080/xxxx/services/pensionWeb?wsdl");
            factory.setUsername("xxx");
            factory.setPassword("yyyy");
            PensionWebService client = (PensionWebService) factory.create();

Thanks for your reply

Best regards

Alexandre

2009/12/9 Eamonn Dwyer <ea...@hotmail.com>

>
>
> Hi Alexandre
>
> does this work for you? ...
>
>      HTTPConduit httpConduit = (HTTPConduit)
> ClientProxy.getClient(port).getConduit();
>      AuthorizationPolicy ap = new AuthorizationPolicy();
>      ap.setUserName("Myname");
>      ap.setPassword("Mypassword");
>      httpConduit.setAuthorization(ap);
>
> Regards
> Eamonn
>
> > Date: Wed, 9 Dec 2009 06:57:20 +0100
> > Subject: username and password of webservices
> > From: alexjaquet@gmail.com
> > To: users@cxf.apache.org
> >
> > Hi,
> >
> > We actually store the username and the password for calling external
> > webservice and then use it like this way on our cxf config file
> >
> >     <jaxws:client id="ZWsCustomerCreate"
> >         serviceClass="xxx.customer.create.ZWsCustomerCreate"
> >
> >         address="${webservice.sap.Z_WS_CUSTOMER_CREATE.url}">
> >         <jaxws:inInterceptors>
> >             <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"
> />
> >         </jaxws:inInterceptors>
> >         <jaxws:outInterceptors>
> >             <bean
> class="org.apache.cxf.interceptor.LoggingOutInterceptor"
> > />
> >         </jaxws:outInterceptors>
> >     </jaxws:client>
> >
> >     <http:conduit name="*Z_WS_ACC_DOCUMENT_POSTPort.http-conduit">
> >         <http:authorization>
> >
> >
> <sec:UserName>${webservice.sap.Z_WS_ACC_DOCUMENT_POST.username}</sec:UserName>
> >
> >
> <sec:Password>${webservice.sap.Z_WS_ACC_DOCUMENT_POST.password}</sec:Password>
> >         </http:authorization>
> > .........
> >
> > Is there any way to remove the variable from the config file or encrypt
> it
> > in a Java class ?
> >
> > ${webservice.sap.Z_WS_ACC_DOCUMENT_POST.username}
> >
> > Thanks in advance.
>
> _________________________________________________________________
> New Windows 7: Simplify what you do everyday. Find the right PC for you.
> http://windows.microsoft.com/shop

RE: username and password of webservices

Posted by Eamonn Dwyer <ea...@hotmail.com>.

Hi Alexandre

does this work for you? ...

      HTTPConduit httpConduit = (HTTPConduit) ClientProxy.getClient(port).getConduit();
      AuthorizationPolicy ap = new AuthorizationPolicy();
      ap.setUserName("Myname");
      ap.setPassword("Mypassword");
      httpConduit.setAuthorization(ap);

Regards
Eamonn

> Date: Wed, 9 Dec 2009 06:57:20 +0100
> Subject: username and password of webservices
> From: alexjaquet@gmail.com
> To: users@cxf.apache.org
> 
> Hi,
> 
> We actually store the username and the password for calling external
> webservice and then use it like this way on our cxf config file
> 
>     <jaxws:client id="ZWsCustomerCreate"
>         serviceClass="xxx.customer.create.ZWsCustomerCreate"
> 
>         address="${webservice.sap.Z_WS_CUSTOMER_CREATE.url}">
>         <jaxws:inInterceptors>
>             <bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />
>         </jaxws:inInterceptors>
>         <jaxws:outInterceptors>
>             <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"
> />
>         </jaxws:outInterceptors>
>     </jaxws:client>
> 
>     <http:conduit name="*Z_WS_ACC_DOCUMENT_POSTPort.http-conduit">
>         <http:authorization>
> 
> <sec:UserName>${webservice.sap.Z_WS_ACC_DOCUMENT_POST.username}</sec:UserName>
> 
> <sec:Password>${webservice.sap.Z_WS_ACC_DOCUMENT_POST.password}</sec:Password>
>         </http:authorization>
> .........
> 
> Is there any way to remove the variable from the config file or encrypt it
> in a Java class ?
> 
> ${webservice.sap.Z_WS_ACC_DOCUMENT_POST.username}
> 
> Thanks in advance.
 		 	   		  
_________________________________________________________________
New Windows 7: Simplify what you do everyday. Find the right PC for you.
http://windows.microsoft.com/shop