Forums de discussion

Accessing Liferay WebServices

thumbnail
Raju oukanti, modifié il y a 10 années.

Accessing Liferay WebServices

Regular Member Publications: 143 Date d'inscription: 21/02/12 Publications récentes
Hi All,

Please can any one suggest me how to access the liferay web services through wsdl file. Actually i am using the following wsdl file to acess the liferay web services.
http://10169:test@127.0.0.1:1010/tunnel-web/secure/axis/Portal_EmailAddressService?wsdl .

When iam acessing the services iam getting the following error

ERROR [EmailAddressServiceSoap:103] com.liferay.portal.security.auth.PrincipalException: PermissionChecker not initialized
com.liferay.portal.security.auth.PrincipalException: PermissionChecker not initialized
at com.liferay.portal.service.base.PrincipalBean.getPermissionChecker(PrincipalBean.java:81)
at com.liferay.portal.service.impl.EmailAddressServiceImpl.getEmailAddress(EmailAddressServiceImpl.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at com.liferay.portal.dao.jdbc.aop.DynamicDataSourceTransactionInterceptor.invoke(DynamicDataSourceTransactionInterceptor.java:44)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy23.getEmailAddress(Unknown Source)
at com.liferay.portal.service.EmailAddressServiceUtil.getEmailAddress(EmailAddressServiceUtil.java:56)
at com.liferay.portal.service.http.EmailAddressServiceSoap.getEmailAddress(EmailAddressServiceSoap.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


Please help me ASAP.

Thanks,
Raju
thumbnail
Antoine Comble, modifié il y a 10 années.

RE: Accessing Liferay WebServices

Regular Member Publications: 232 Date d'inscription: 07/09/12 Publications récentes
Hi Raju,

Are you sure 10169 is login of user and test is his password ?

The url should be :

http://LOGIN:PASSWORD@127.0.0.1:1010/tunnel-web/secure/axis/Portal_EmailAddressService?wsdl


Hope this help you,

Antoine
thumbnail
Raju oukanti, modifié il y a 10 années.

RE: Accessing Liferay WebServices

Regular Member Publications: 143 Date d'inscription: 21/02/12 Publications récentes
Hi Comble,

Thank you for giving quick replay to me.I am using the same url what you suggested to me.But still i am getting the same 'permission checker not intialized ' error.Could you please suggest any other alternative solution.

Thanks,
Raju
thumbnail
Antoine Comble, modifié il y a 10 années.

RE: Accessing Liferay WebServices

Regular Member Publications: 232 Date d'inscription: 07/09/12 Publications récentes
Hi,

Are you sure your user is administrator of your portal ?

Regards,

Antoine
thumbnail
Raju oukanti, modifié il y a 10 années.

RE: Accessing Liferay WebServices

Regular Member Publications: 143 Date d'inscription: 21/02/12 Publications récentes
Hi Comble,

Yes he is the administrator user.

Thanks,
Raju
thumbnail
Antoine Comble, modifié il y a 10 années.

RE: Accessing Liferay WebServices

Regular Member Publications: 232 Date d'inscription: 07/09/12 Publications récentes
Hi,

Try adding it in your portal-ext.properties :

axis.servlet.hosts.allowed=127.0.0.1,YOUR_PUBLIC_IP
axis.servlet.https.required=false


If it not woks yet, try this in a main java class :

public Test {
 public static void main(final String[] args) {
                // Portal_EmailAddressService
		final EmailAddressServiceSoapServiceLocator locatorMail = new EmailAddressServiceSoapServiceLocator();
		EmailAddressServiceSoap serviceEmailAddress = locatorMail.getPortal_EmailAddressService(getURL(liferayUrl, "Portal_EmailAddressService"));
		((Portal_EmailAddressServiceSoapBindingStub) serviceEmailAddress).setUsername(liferayAdminLogin);
		((Portal_EmailAddressServiceSoapBindingStub) serviceEmailAddress).setPassword(liferayAdminPassword);

               // serviceEmailAddress services are available
 }

/**
	 * Get URL for serviceName Liferay service.
	 * 
	 * @param server
	 * @param serviceName
	 * @return
	 * @throws MalformedURLException
	 */
	protected static URL getURL(final String server, final String serviceName) throws MalformedURLException {
		final StringBuilder sb = new StringBuilder();
		sb.append(server);
		sb.append("/api/secure/axis/");
		sb.append(serviceName);
		return new URL(sb.toString());
	}

}
thumbnail
Raju oukanti, modifié il y a 10 années.

RE: Accessing Liferay WebServices

Regular Member Publications: 143 Date d'inscription: 21/02/12 Publications récentes
Hi Comble,

Thank you very much. What ever the code given by you is working fine in my local system.Whenever i want to access remotely it is not working.Please can you suggest how can i access the web services remotely ASAP.


Thanks,

Raju
thumbnail
Antoine Comble, modifié il y a 10 années.

RE: Accessing Liferay WebServices

Regular Member Publications: 232 Date d'inscription: 07/09/12 Publications récentes
Hi Raju,

Normally, if the user can connect with java code to your webservices, the url http://localhost:1010/api/secure/axis/Portal_EmailAddressService?wsdl should be shown the wsdl of Portal_EmailAddressService webservice.

Hope it will work,

Antoine