Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Using JET on WSDL and XSD(Using JET on WSDL and XSD)
Using JET on WSDL and XSD [message #535281] Fri, 21 May 2010 19:59 Go to next message
Herat Acharya is currently offline Herat AcharyaFriend
Messages: 7
Registered: May 2010
Junior Member
Hi,
I have a WSDL and its corresponding XSD.
I have to create a JET transformation project on it. While i know some amount of basics of Jet on XMLs , its tough to find a resource of JET on WSDLs on the net. Can any one point me to the correct resource so that i can learn this.

Thanks

[Updated on: Fri, 21 May 2010 20:30]

Report message to a moderator

Re: JET [message #535823 is a reply to message #535281] Tue, 25 May 2010 19:54 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Herat:

If you have Web Tools installed, JET will automatically load a WSDL file
using the Web Tools WSDL EMF Model:

http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .wst.wsdl.doc.isv/reference/api/org/eclipse/wst/wsdl/package -summary.html

You should also look at the EMF model for XSD's which is used by the
WSDL EMF Model:

http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .xsd.doc/references/javadoc/overview-summary.html

The JET XPath engine can navigate these modesl much like any EMF-based
model. (EReference features are treated like XML child elements,
EAttribute features are treated like XML attributes.)

However, from experience, this model has methods that are not declared
in the Ecore meta-model for WSDL. As a result, some things that look
like they might be normal EMF features are invisible to the XPath
engine. To get at those, you'll have to drop into Java.

An example:

A WSDL file loads with a Service object at the root, so you could access
that object like this:

<c:setVariable var="service" select="/Service"/>

You can access things like QName in an XPath expression:

<c:get select="$service/@qName"/>

And, you can get the ports in an expression like:

<c:iterate select="$service/ePorts" var="port">
..
</c:iterate>

Some things, however, confuse the XPath engine. Service has a method
getDocumentationElement() which is defined in EMF as an EAttribute. So,
an XPath expression such as

<c:get select="$service/@documentationElement"/>

tries to return the string value of the org.w3c.dom.Element object - I'm
not sure it does what you'd expect.

As a workaround, you can pick up the object in Java code...

<%@jet imports="org.eclipse.wst.wsdl.*"%>
<%@jet imports="org.eclipse.jet.XPathContextExtender"%>
....

<%-- assuming $service is an XPath variable refering to a Service object
--%>
<%
Service service =
(Service)XPathContextExtender.getInstance(context).resolveAs Single( "$service");
%>

You can then access the service variable the way you like in Java
scriptlets or expressions. Also, you could find appropriate objects that
JET can reflect on, and set JET variables for these:

<%-- assuming the above 'service' variable is defined in Java --%>
<%
context.setVariable("docElement", service.getDocumentationElement());
%>

Then, JET tags can access $docElement in XPath expressions:
<c:get select="string-length($docElement)"/>

Although all of the above can seem painful, the WSDL EMF Model is worth
using. It does all the work to resolve XML schema elements/types.

Hope this helps,

Paul

On 2010-05-21 3:59 PM, Herat Acharya wrote:
> Hi,
> I have a WSDL and its corresponding XSD. I have to create a JET
> transformation project on it. While i know some amount of basics of Jet
> on XMLs , its tough to find a resource of JET on WSDLs on the net. Can
> any one point me to the correct resource so that i can learn this.
>
> Thanks
Re: Using JET on WSDL and XSD [message #543559 is a reply to message #535281] Tue, 29 June 2010 18:53 Go to previous message
Andy Zhang is currently offline Andy ZhangFriend
Messages: 1
Registered: June 2010
Junior Member
Hi Paul,

Regarding message #535281, I want to load WSDL/XSD to resolve namespace and schema types. I am not sure how to load the resource and reference its content. Currently I am loading the files through type="xml". Can you please show me some example code snippet to load wsdl and referenence its EMF content? Thanks very much!
Previous Topic:xtend code optimization
Next Topic:[acceleo] Can we know the Generated List file of mainFile
Goto Forum:
  


Current Time: Tue Apr 16 08:15:57 GMT 2024

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

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

Back to the top