Foros de discusión

Create portlet with web service (build-wsdd problem)

Petr Vašek, modificado hace 11 años.

Create portlet with web service (build-wsdd problem)

Junior Member Mensajes: 68 Fecha de incorporación: 26/06/12 Mensajes recientes
Hi , i tried create portlet vith web service by example:

http://www.liferay.com/community/wiki/-/wiki/Main/Creating+Liferay+6+plugin+web+service

But when i tried run build-wsdd , ant throw this log:

[java] 10:00:54,506 WARN [Types:1704] The class cz.ictb.algoportal.main.model.algoOrganization does not contain a default constructor, which is a requirement for a bean class. The class cannot be converted into an xml schema type. An xml schema anyType will be used to define this class in the wsdl file.

I think that problem is on line with message"The class cz.ictb.algoportal.main.model.algoOrganization does not contain a default constructor" , but i dont wkno how solve this?


Please help ...

Thnak you
Linus Sphinx, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Junior Member Mensajes: 99 Fecha de incorporación: 12/08/10 Mensajes recientes
Curious, what number step are you getting to when this happens?
thumbnail
Jay Patel, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Regular Member Mensajes: 118 Fecha de incorporación: 24/02/10 Mensajes recientes
Hi Petr,

Would you please attach your service.xml?

-Jay.
Petr Vašek, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Junior Member Mensajes: 68 Fecha de incorporación: 26/06/12 Mensajes recientes
Thank you very much for yours posts guys. I am desperate.

In tutorial "http://www.liferay.com/community/wiki/-/wiki/Main/Creating+Liferay+6+plugin+web+service" number of step is 22.

An this is my service.xml


<!--?xml version="1.0" encoding="UTF-8"?-->

<service-builder package-path="com.liferay.test">
	<author>kapil</author>
	<namespace>Test</namespace>

	<entity name="Employee" local-service="true" remote-service="true">
		<column name="id" type="long" primary="true" />
		<column name="name" type="String" />
		
		<finder name="Name" return-type="Collection">
			<finder-column name="name" />
		</finder>
	</entity>
</service-builder>


i will very grateful for any idea.

Thak you guys
thumbnail
David H Nebinger, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
This doesn't contain any reference to the algoOrganization thing mentioned from your first post, nor does the package path match the one from the service.xml.

Either you've posted the wrong service.xml file, or you have other code mixed in that you haven't accounted for (and is probably the source of the error).
Petr Vašek, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Junior Member Mensajes: 68 Fecha de incorporación: 26/06/12 Mensajes recientes
I am so sorry mr. Nebinger ,, i tried everithing. First i tried create my structure and next i tried create portelt exactly step by step by tuturial, but warn message during build-wsdd Ant opration is same. (only error during posting):

he class com.liferay.test.model.Employee does not contain a default constructor

Some days i crashed on this problem emoticon

I give attachment my portlet, anyone please help.

Petr

PS: Mr. Nebinger i read "Liferay in Action" and "Portlet in Action" but according them my way is coorect. emoticon

Archivos adjuntos:

Petr Vašek, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Junior Member Mensajes: 68 Fecha de incorporación: 26/06/12 Mensajes recientes
More this is my build-wsdd log in atachment...

Archivos adjuntos:

thumbnail
David H Nebinger, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
Your EmployeeLocalServiceImpl is definitely messed up... Your EmployeeLocalServiceImpl should not be calling EmployeeUtil directly. All of the methods that you need to access are either inherited or available in the employeePersistence member variable.

Basically you've got two sets of classes when using Service Builder. You have the service classes, compiled and put into the service jar, which represent the API for your service.

Then you have the implementation classes. These classes implement the service details, and have full visibility to the internals of the implementation.

Inside of the implementation classes, you should not be reaching out to the service layer when the implementation is visible.

For example, your create() method in EmployeeLocalServiceImpl looks like this:

	public Employee create(Employee model) throws SystemException{
		long id = CounterLocalServiceUtil.increment(Employee.class.getName());
		model.setId(id);
		Employee newModel = EmployeeUtil.create(model.getId());

		newModel.setName(model.getName());
		EmployeeUtil.update(newModel, true);
		return newModel;
	}


This is totally the wrong way to have done it, as EmployeeUtil is in the service jar and there's no reason to go that route.

Instead, your create method should be:

public Employee create(Employee model) throws SystemException {
    long id = CounterLocalServiceUtil.increment(Employee.class.getName());

    Employee newModel = createEmployee(id);

    newModel.setName(model.getName());

    return update(newModel, true);
}


Since the EmployeeLocalServiceImpl class has visibility on existing methods and the employeePersistence member variable, there is no reason to go through EmployeeUtil.

Finally, it is sometimes a good idea to invoke the 'clean' task when you're making changes to the service.xml or the implementation classes. It ensures that any old cruft is removed from the build...
Petr Vašek, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Junior Member Mensajes: 68 Fecha de incorporación: 26/06/12 Mensajes recientes
Thank you very much Mr. Nebinger, immediately i will try. And can i question. Does it exist some class diagram or description how work service structure?

Thank you again.
MICHAIL MOUDATSOS, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Regular Member Mensajes: 110 Fecha de incorporación: 4/10/11 Mensajes recientes
David H Nebinger:
Inside of the implementation classes, you should not be reaching out to the service layer when the implementation is visible.
...
Since the EmployeeLocalServiceImpl class has visibility on existing methods and the employeePersistence member variable, there is no reason to go through EmployeeUtil.

Does the above hold for the EntityServiceImpl class, as well? From your answer I can only assume that in such a class it is advisable to use the EntityLocalServiceUtil methods versus the EntityUtil methods. Is this assumption correct?

Of course, some of the EntityLocalServiceUtil methods may have been, in turn, implemented in EntityLocalServiceImpl

thank you in advance

EDIT:
Note that in 6.0.6 plugins sdk the error stated by the thread creator, i.e., [java] 14:44:58,325 WARN [Types:1704] The class mypackagae.path.model.Entity does not contain a default constructor, which is a requirement for a bean class. The class cannot be converted into an xml schema type. An xml schema anyType will be used to define this class in the wsdl file. is thrown at build-wsdd, even when you have two empty methods that use Entity either as a method parameter or as a return value type. So, even though the answers given are correct, they re not the right answer to the primary question about the error message.

I still had to do the correction mentioned in this wiki or as an alternative that allows me to rebuild services freely without re-correcting the generated Soap class, I explicitly made my EntityServiceUtil functions to take and return respectively an EntitySoap object rather than an Entity object. This is quick n' dirty and helps only if these methods are destined to be used as web services and only as such, otherwise it's an ugly solution - I know

example:
public EntitySoap update(EntitySoap entity) throws NoSuchEntityException, SystemException
{
	return EntitySoap.toSoapModel(EntityLocalServiceUtil.updateEntity(EntityModelImpl.toModel(entity), true));
}
Pedro Almeida, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Junior Member Mensajes: 41 Fecha de incorporación: 30/07/12 Mensajes recientes
I have been trying to accomplish this as well without sucess. Never does the service show up when I do http://127.0.0.1:8080/api/axis, and I have followed the guide linked from here and the proposed corrections.

Does anyone know if there is an updated, corrected how-to? For 6.1.

Thanks.
thumbnail
Hari Dobbala, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Junior Member Mensajes: 29 Fecha de incorporación: 18/11/12 Mensajes recientes
Hi all,

I am also facing the same problem while building wsdd on liferay 6.1 by following this link to create the wsdd. Below is the exception I am getting while building wsdd.

10:29:32,606 WARN [Types:1704] The class com.liferay.test.model.Employee does not contain a default constructor, which is a requirement for a bean class. The class cannot be converted into an xml schema type. An xml schema anyType will be used to define this class in the wsdl file.
[java] WSDL2Java D:\dlife\tools\liferay-plugins-sdk-6.1.0-ce-ga1-20120106155615760\portlets\TestPlugin\20121217102932150\service.wsdl
[java] Running Wsdl2javaAntTask with parameters:
[java] verbose:false
[java] debug:false
[java] quiet:false
[java] server-side:true
[java] skeletonDjava.io.IOException: Type {http://model.test.liferay.com}Employee is referenced but not defined.
[java] at org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined(SymbolTable.java:665)
[java] at org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:545)
[java] at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:518)
[java] at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:495)
[java] at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
[java] at java.lang.Thread.run(Unknown Source)
[java] Exception in thread "main" WSDL processing error for D:\dlife\tools\liferay-plugins-sdk-6.1.0-ce-ga1-20120106155615760\portlets\TestPlugin\20121217102932150\service.wsdl :
[java] Type {http://model.test.liferay.com}Employee is referenced but not defined.
[java] at org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask.execute(Wsdl2javaAntTask.java:304)
[java] at com.liferay.util.ant.Java2WsddTask.generateWsdd(Java2WsddTask.java:108)
[java] at com.liferay.portal.tools.WSDDBuilder._createServiceWSDD(WSDDBuilder.java:130)
[java] at com.liferay.portal.tools.WSDDBuilder.build(WSDDBuilder.java:93)
[java] at com.liferay.portal.tools.WSDDBuilder.main(WSDDBuilder.java:49)
[java] Caused by: java.io.IOException: Type {http://model.test.liferay.com}Employee is referenced but not defined.
[java] at org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined(SymbolTable.java:665)
[java] at org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:545)
[java] at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:518)
[java] at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:495)
[java] at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
[java] at java.lang.Thread.run(Unknown Source)
[java] eploy:false
----
----

Can any one please tell me how to resolve this problem.

Thanks in advance.
MICHAIL MOUDATSOS, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Regular Member Mensajes: 110 Fecha de incorporación: 4/10/11 Mensajes recientes
Did you guys carefully read my answer?
MICHAIL MOUDATSOS:
or as an alternative that allows me to rebuild services freely without re-correcting the generated Soap class, I explicitly made my EntityServiceUtil functions to take and return respectively an EntitySoap object rather than an Entity object. This is quick n' dirty and helps only if these methods are destined to be used as web services and only as such, otherwise it's an ugly solution - I know

example:
public EntitySoap update(EntitySoap entity) throws NoSuchEntityException, SystemException
{
	return EntitySoap.toSoapModel(EntityLocalServiceUtil.updateEntity(EntityModelImpl.toModel(entity), true));
}
I know it concerns 6.0.6 but I can only assume this works for 6.1 as well...
thumbnail
Hitoshi Ozawa, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
If you're interested, I've attached a sample web service prograim on the following page.
http://www.liferay.com/community/wiki/-/wiki/Main/Web+Service+samples
Petr Vašek, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Junior Member Mensajes: 68 Fecha de incorporación: 26/06/12 Mensajes recientes
Hello Mr. Ozawa,
Really? its will be amazing!
¨this attachment? -> liferay-wstools_6.1.0GA1_20120523.zip
Petr Vašek, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Junior Member Mensajes: 68 Fecha de incorporación: 26/06/12 Mensajes recientes
I am so sorry i dont understend it. Do you have some WAR with source for Liferay deploy? I am novice and I lose a little emoticon but my boss want result emoticon
thumbnail
Hitoshi Ozawa, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
Sorry, it's just a java program and not a portlet. Source code is included which you may look at.

If you can't provide results to your boss, may be he should be hiring me instead. :-)
Petr Vašek, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Junior Member Mensajes: 68 Fecha de incorporación: 26/06/12 Mensajes recientes
emoticon my first smile today ... emoticon , ok i will be fight.
Thank you very much
Petr Vašek, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Junior Member Mensajes: 68 Fecha de incorporación: 26/06/12 Mensajes recientes
Or please , little council on end.

What i need:

I need crate web service (SOAP) through which i call my libs in Lifeeray maybe liferey services to. ? do i go right way? Or i have to use another solution?

Thank you
Petr Vašek, modificado hace 11 años.

RE: Create portlet with web service (build-wsdd problem)

Junior Member Mensajes: 68 Fecha de incorporación: 26/06/12 Mensajes recientes
Just i want heartily thank two. Now my services works and everithing looks ok.

As Mr. Nebinger said the implementation of my XXXLocalServicesImp was that problem. Finally i understand how it works. Once more time i would like to thank you.

For other people who has the same problem, tutorial on page "http://www.liferay.com/community/wiki/-/wiki/Main/Creating+Liferay+6+plugin+web+service" is with mistakes. On last version of service builder isnt necesarry to correct implementation of XXXServiceSoap and methods in XXXLocalServicesImp are all wrong...