Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF, WSDL and SOAP
EMF, WSDL and SOAP [message #418265] Wed, 09 April 2008 11:19 Go to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Hi,

I'm trying to use EMF for managing SOAP requests. The basic idea is to model all
the data defined in various WSDL+XSD files with Ecore and then assemble and
serialize dynamic Ecore objects to create the required XML for the SOAP. The
hypothesis is that it is easier to manage Ecore objects than XML directly.

A SOAP message is essentially built using two parts, a SOAP envelope and the
content (of the soap:Body element) that represents the specific operation to
request/invoke. The SOAP envelope is described in an XML Schema
(http://schemas.xmlsoap.org/soap/envelope/), while the available operations and
related types are described in a WSDL file (internal schema) and possibly
external XML Schemas.

What I did, as a first experiment, was to generate an Ecore model for the WSDL
internal schema and external schemas, make a Dynamic instance model (xmi file)
for a specific operation and see what (kind of XML) it was serialized as. I
reasoned that since the model was generated from an XML Schema, it would
serialize to "proper" XML, according to the XML Schema. However, although the
Ecore model included annotations that specified that certain attributes should
serialize as elements, they still showed up as XML attributes.

So, my first questions is: Is there a way to make sure serialization of dynamic
instances (and no generated Java code) result in XML that is according to the
original XML Schema?

The structure of a specific SOAP request is actually defined by a combination of
the SOAP schema, WSDL internal schema, additional WSDL declarations (operation
and message structure) and external schemas. Hence, I believe I have to generate
(or build by hand) a new, complete Ecore model that weaves together elements
from all these files (SOAP XSD, WSDL and other XSD), and among others.

My second question is: Does this seem to be a reasonable approach?
Third question: Are there any tools available for make this easier?

In an ideal world, I would go from Ecore models for both the domain data
(classes only), and a service model (classes and annotated operations), and
generate the WSDL file and XML Schemas.

Fourth question (which I believe have been asked before): Has anybody done this
or similar things, and have experience (and code) to share?

Regards,

Hallvard Trætteberg
Re: EMF, WSDL and SOAP [message #418270 is a reply to message #418265] Wed, 09 April 2008 11:47 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080907090306080309050401
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hallvard,

Comments below.

Hallvard Tr


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF, WSDL and SOAP [message #418277 is a reply to message #418270] Wed, 09 April 2008 13:45 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Ed Merks wrote:

> Comments below.

I expected you to jump in :-)

>> ... However, although the Ecore model included annotations
>> that specified that certain attributes should serialize as elements,
>> they still showed up as XML attributes.
> It's important to use an XMLResourceImpl with the right options. Have a
> look at any of the generated XyzResourceFactoryImpls for how to do that.
> Probably you've found this article already, but if not, it
> will be useful: Binding XML to Java
> < http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava>

I have. I was hoping there was an easy way to do this without generating Java
code, e.g. from within the reflective editor. For me it makes sense to use the
XML-related annotations by default, also in the reflective editor. Perhaps this
editor could be extended to allow the user to edit some of the serialization
options?

> I'm not sure about that. I think the soap schema has wildcards that will
> allow any model's content to be nested under it. EMF also supports
> reading arbitrary DOM so you might not even have to model the envelope
> (unless of course you want to manipulate the envelope with EMF).

It's correct that the SOAP schema allows *anything*, but I would like to use EMF
(as you suggest) and possibly Javascript with EMF extensions, so I e.g. may
write Body.getCityTime = create(time.GetCityTimeType); I'm not sure that will
work if Body is just defined to take wildcards.

>> In an ideal world, I would go from Ecore models for both the domain
>> data (classes only), and a service model (classes and annotated
>> operations), and generate the WSDL file and XML Schemas.
> Thiago is working on http://wiki.eclipse.org/Servus which seem directly
> related; I expect he'll start actively working on this and make code
> available in CVS May some time.

I noticed that project. May is a bit late, I have this narrow time window for
making a prototype...

> Yes, please someone share your experience. It seems to me that someone
> posting on the WTP newsgroup a while back with some advice for someone
> who'd asked a similar question to yours...

I'll search for it.

My plan is now to generate Java code for the SOAP envelope and WSDL models
(Ecore generated from XML Schema) and write some simple Eclipse actions for
1) generating a WSDL file from an annotated Ecore model that defines services
using classes and operations (XML Schemas can already be generated from an Ecore
domain model).
2) helper classes for creating SOAP XML for the operations in a WSDL model

Initially, this will just be a hack for more easily using EMF in the context of
BPMN modeling with Intalio's tools. Later I hope to be able to use EMF (and
Javascript) to actually implement the WSDL services and deploy on a server, to
support a BPMN process. If I get the time, that is, these time windows for
prototyping keep getting narrower all the time...

I guess you'll notice my progress, based on my questions on this forum :-)

Hallvard
Re: EMF, WSDL and SOAP [message #418278 is a reply to message #418277] Wed, 09 April 2008 14:01 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Hallvard,

Comments below.

Hallvard Trætteberg wrote:
> Ed Merks wrote:
>
>> Comments below.
>
> I expected you to jump in :-)
It wasn't a big shock then! :-P
>
>>> ... However, although the Ecore model included annotations that
>>> specified that certain attributes should serialize as elements, they
>>> still showed up as XML attributes.
>> It's important to use an XMLResourceImpl with the right options.
>> Have a look at any of the generated XyzResourceFactoryImpls for how
>> to do that.
>> Probably you've found this article already, but if not, it will be
>> useful: Binding XML to Java
>> < http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava>
>
> I have. I was hoping there was an easy way to do this without
> generating Java code, e.g. from within the reflective editor. For me
> it makes sense to use the XML-related annotations by default, also in
> the reflective editor. Perhaps this editor could be extended to allow
> the user to edit some of the serialization options?
The article does show how the XSDEcoreBuilder does it all dynamically.
Yes, the reflective editor could be a bit smarter and look for
annotations. Now that we have support for content types, I could be
smarter about when to use an XMIResourceImpl too. I hope to find time
to investigate, but there's always so little time and so much to do.
>
>> I'm not sure about that. I think the soap schema has wildcards that
>> will allow any model's content to be nested under it. EMF also
>> supports reading arbitrary DOM so you might not even have to model
>> the envelope (unless of course you want to manipulate the envelope
>> with EMF).
>
> It's correct that the SOAP schema allows *anything*, but I would like
> to use EMF (as you suggest) and possibly Javascript with EMF
> extensions, so I e.g. may write Body.getCityTime =
> create(time.GetCityTimeType); I'm not sure that will work if Body is
> just defined to take wildcards.
The wildcards are very flexible and should allow you to contain your
dynamic or generated objects without creating a model that knows about
all these models.
>
>>> In an ideal world, I would go from Ecore models for both the domain
>>> data (classes only), and a service model (classes and annotated
>>> operations), and generate the WSDL file and XML Schemas.
>> Thiago is working on http://wiki.eclipse.org/Servus which seem
>> directly related; I expect he'll start actively working on this and
>> make code available in CVS May some time.
>
> I noticed that project. May is a bit late, I have this narrow time
> window for making a prototype...
>
>> Yes, please someone share your experience. It seems to me that
>> someone posting on the WTP newsgroup a while back with some advice
>> for someone who'd asked a similar question to yours...
>
> I'll search for it.
>
> My plan is now to generate Java code for the SOAP envelope and WSDL
> models (Ecore generated from XML Schema) and write some simple Eclipse
> actions for
> 1) generating a WSDL file from an annotated Ecore model that defines
> services using classes and operations (XML Schemas can already be
> generated from an Ecore domain model).
> 2) helper classes for creating SOAP XML for the operations in a WSDL
> model
>
> Initially, this will just be a hack for more easily using EMF in the
> context of BPMN modeling with Intalio's tools. Later I hope to be able
> to use EMF (and Javascript) to actually implement the WSDL services
> and deploy on a server, to support a BPMN process. If I get the time,
> that is, these time windows for prototyping keep getting narrower all
> the time...
>
> I guess you'll notice my progress, based on my questions on this forum
> :-)
I'll be happy to help. It would be great if you helped with the wiki...
>
> Hallvard


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to get path of workbench
Next Topic:AdapterFactoryEditingDomain.isReadOnly() in 3.2/2.2 question
Goto Forum:
  


Current Time: Thu Mar 28 22:14:42 GMT 2024

Powered by FUDForum. Page generated in 0.06607 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top