About Me

Sunday, February 8, 2015

JAX-WS client for authenticate to WSO2 server.

We are going to use AuthenticationAdmin service to generate the JAX-WS client.

1. Open the carbon.xml file and set the value to false in following parameter.

<HideAdminServiceWSDLs>false</HideAdminServiceWSDLs>

2. Start the server and point your browser to,

https://[host or ip]:<port>/services/AuthticationAdmin?wsdl

3. Save the AuthenticationAdmin.wsdl file to new folder (Lets say code-gen)
4 Go to the code-gen directory and execute the following command to generate the client codes.

wsimport -p org.wso2.auth.jaxws.client AuthenticationAdmin.wsdl

5. Now you will end up with following errors.
----------------------------------------------------------------------------------
parsing WSDL...

[ERROR] operation "logout" has an invalid style
line 1090 of file:/home/ajith/Desktop/auth-client-jaxws/AuthenticationAdmin.wsdl

[ERROR] operation "logout" has an invalid style
line 1127 of file:/home/ajith/Desktop/auth-client-jaxws/AuthenticationAdmin.wsdl

[ERROR] operation "logout" has an invalid style
line 1208 of file:/home/ajith/Desktop/auth-client-jaxws/AuthenticationAdmin.wsdl

[ERROR] missing required property "style" of element "operation"
Failed to parse the WSDL.
----------------------------------------------------------------------------------
6.The java2wsdl tool doesn't generate some important elements which are expecting by wsimport tool due to some issues (eg: output element in wsdl operation for void rerun type). So adding the following elements to the missing places(line numbers in above errors) will solve the issue.