[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.m2m] Re: [ATL] uml2wsdl
|
- From: unique <hr_mi@xxxxxxx>
- Date: Thu, 08 May 2008 10:27:48 +0800
- Newsgroups: eclipse.modeling.m2m
- Organization: EclipseCorner
- User-agent: Thunderbird 1.5.0.14 (Windows/20071210)
William Piers 写道:
> Hello,
>
> unique a écrit :
>> Hi everybody,
>>
>> I want to make a transformation from uml to wsdl , now my problem is
>> that it doesn't make a nesting.
>>
>> My code is as following :
>> ------------------------------------------------------------------------------------
>> --@atlcompiler atl2006
>>
>> module onlinesale_merge2wsdl; -- Module Template
>> create OUT : WSDL from IN :UML;
>>
>> ---------------------
>> helper context UML!Class def: hasStereotype(stereotype :
>> String) : Boolean =
>> self.getAppliedStereotypes()->exists (c | c.name = stereotype);
>> ---------------------
>>
>> helper context UML!Package def : getElementbyStereotypeName(stereotype :
>> String) : Set(UML!Class)=
>> self.packedElement->select(c|c.oclIsKindOf(UML!Class) and
>> c.hasStereotype(stereotype));
>>
>> ---------------------
>> helper context UML!Class def : getAttr() : Sequence(UML!Property)=
>> self.ownedAttribute->collect();
>> ---------------------
>>
>> rule Definition{
>> from c : UML!Package(c.oclIsTypeOf(UML!Package) and
>> c.name='Class Package')
>>
>> to d :WSDL!Definition(
>> targetNamespace <-'edu.xidian.ictt.webservices.bpelmodeling.wsdl',
>> eTypes <- c.getElementbyStereotypeName('Data'),
>> eMessages <- c.getElementbyStereotypeName('Message'),
>> ePortTypes <- c.getElementbySterotypeName('PortType')
>> )
>>
>> ----------------------
>> rule Class2Message{
>> from u : UML!Class(
>> u.hasStereotype('Message')
>> )
>> to t : WSDL!Message(
>> qName <- u.name,
>> eParts <- u.getAttr()
>> )
>> }
>>
>> ------------------------------------------------------------------------------
>>
>> But I just get the result as following :
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <wsdl:Definition xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>> xmlns:wsdl="http://www.eclipse.org/wsdl/2003/WSDL"/>
>>
>
> The transformation may have fail. Do you check the error log ?
>
> Best regards,
>
> William
>
>>
>> I can't find where it is wrong . Who can help me ??
>>
>>
>> Best regrads
Hi William ,
Thanks for your attention. Now I rework my code as followiong:
-------------------------------------------------------------------------
--@atlcompiler atl2006
module onlinesale_merge2wsdl; -- Module Template
create OUT : WSDL from IN : UML;
------------------------------------------------------------------
helper context UML!Class def: hasStereotype(stereotype : String)
:Boolean =
self.getAppliedStereotypes()->collect(e|e.name)->includes(stereotype);
------------------------------------------------------------------
-----------------------------------------------------------------
helper context UML!Package def : getClassbyStereotypeName(stereotype :
String) : Set(UML!Class)=
self.packagedElement->select(c|c.oclIsKindOf(UML!Class) and
c.hasStereotype(stereotype));
-----------------------------------------------------------------
helper context UML!Class def : getAttr() : Sequence(UML!Property)=
self.ownedAttribute->collect();
-----------------------------------------------------------------
rule Definition{
from c : UML!Package(
c.name='Class Package'
)
to d :WSDL!Definition(
targetNamespace <- 'edu.xidian.ictt.webservices.bpelmodeling.wsdl',
eTypes <- type
),
type : WSDL!Types(
schema <- schem
),
schem : WSDL!XSDSchema(
targetNamespace <- 'edu.xidian.ictt.webservices.bpelmodeling.xsd',
elementDeclarations <- c.getClassbyStereotypeName('Data')
)
}
------------------------------------------------------
Now I have the following result:
----------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:wsdl="http://www.eclipse.org/wsdl/2003/WSDL"
xmlns:xsd="http://www.eclipse.org/xsd/2002/XSD">
<wsdl:Definition/>
<wsdl:Types/>
<xsd:XSDSchema/>
</xmi:XMI>
----------------------------------------------------------------------
But the correct result should be as following :
-------------------------------------------
<wsdl:Definition>
<wsdl:Types>
<wsdl:XSDSchema/>
</wsdl:Types>
</wsdl:Defintion>
--------------------------------------------
It still have no nesting. And it is also have no error log.
Would you please check my code ??
Best regards