camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sayed_india <sayed.abdulis...@gmail.com>
Subject Re: HTTP Basic Authentication
Date Sat, 06 Sep 2014 13:43:41 GMT
Hello,
I tried with the code shared ,seems working fine at server end for CXF-SOAP
as tested through SOAPUI tool.
Please share the code for CXF REST Service.

However I need a Java client to call the service.

Tried many options but gives me errors.

Please send me a sample Java main client to test the authentication.

My CXF end point declaration:
------------------------------------
<bean id="securityInterceptor"
class="com.test.BasicAuthAuthorizationInterceptor">
		<property name="users"><map><entry key="user-id" value="test"
/></map></property>

</bean>
	<cxf:cxfEndpoint id="ReportIncidentEndpoint"
                  
address="http://localhost:9050/service/EmployeeDetailsService"
                   serviceClass="in.ns.com.EmployeeDetailsPort"
                   wsdlURL="META-INF/wsdl/webservice.wsdl" > 
                    <cxf:inInterceptors><ref
bean="securityInterceptor"/></cxf:inInterceptors>
                      </cxf:cxfEndpoint>
                      

</beans>
-----------------
java client:
------------------

public static void main(String[] args) throws Exception {
 
	URL url = new URL(WS_URL);
        QName qname = new QName("http://com.ns.in",
"EmployeeDetailsPortService");
 
        Service service = Service.create(url, qname);
        EmployeeDetailsPort hello =
service.getPort(EmployeeDetailsPort.class);
        BindingProvider port
=(BindingProvider)service.getPort(EmployeeDetailsPort.class);
        		 port.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
"user-id");
        		port.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"test");

System.out.println(hello.employeeDetailsOpr( new FindEmpRequest("123")));

Error:Exception in thread "main"
com.sun.xml.internal.ws.model.RuntimeModelerException: A WebService
annotation is not present on class: in.ns.com.EmployeeDetailsPort


Thanks and regards,
Sayed
        		



--
View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5756117.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message