Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » org.eclipse.wst.wsdl.util.WSDLResourceImpl
org.eclipse.wst.wsdl.util.WSDLResourceImpl [message #171574] Mon, 19 June 2006 13:12 Go to next message
Sven Krause is currently offline Sven KrauseFriend
Messages: 119
Registered: July 2009
Senior Member
Hi,

using WTP1.5 lists the WSDLResourceImpl within the API. Unfortunately is
the package not exported with the plugin. Is is possible to use the WTP
to parse WSDL's to get the used XSD description ?

Thanks in advance
Sven
Re: org.eclipse.wst.wsdl.util.WSDLResourceImpl [message #171593 is a reply to message #171574] Mon, 19 June 2006 14:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: valentinbaciu.hotmail.com

Hi Sven,

You should be able to use the class you mentioned even though it is listed
as internal (it has not yet been made API, possibly in the future).
For getting at the inline or imported schemas, have a look at the
org.eclipse.wst.wsdl.Types interface. It allows you to list all schema
objects (see Eclipse XSD http://www.eclipse.org/xsd/) or to list schemas for
a given namespace. You can always find examples on how to use the API by
looking at the unit tests plugin org.eclipse.wst.wsdl.tests.

I hope this helps. Regards,
Valentin

"Sven Krause" <no.spam@public-files.de> wrote in message
news:e767r6$4rq$1@utils.eclipse.org...
> Hi,
>
> using WTP1.5 lists the WSDLResourceImpl within the API. Unfortunately is
> the package not exported with the plugin. Is is possible to use the WTP
> to parse WSDL's to get the used XSD description ?
>
> Thanks in advance
> Sven
Re: org.eclipse.wst.wsdl.util.WSDLResourceImpl [message #171618 is a reply to message #171593] Mon, 19 June 2006 20:43 Go to previous messageGo to next message
David Williams is currently offline David WilliamsFriend
Messages: 722
Registered: July 2009
Senior Member
Just from the name, WSDLResourceImpl, I doubt this will ever be API, per
se,
so, if Valentin's other suggestions don't help you find an API way to do
what
you want, be sure to open a bug/feature request detailing the exact use
case ...
I suspect the function you want could be made API, but that particular Impl
would probably stay "hidden".
Re: org.eclipse.wst.wsdl.util.WSDLResourceImpl [message #171626 is a reply to message #171618] Mon, 19 June 2006 22:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: valentinbaciu.hotmail.com

Thanks for the clarification David. You're right, no class with Impl in it's
name should be API in the pure sense, there should be an interface for it
and some factory to create the proper implementation.

My previous post was wrong in another way though: this class already is
"API" in that it is being exported by the plug-in. The plug-in also provides
a factory which will create the resource implementation of the proper type
based on the file extension. The factory needs to be registered with an EMF
resource set. This pattern is common to generated EMF models. As I said,
there are examples in the tests plug-in but I have extracted something as a
concrete example:

import java.io.IOException;
import java.util.List;
import java.util.Map;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.wst.wsdl.Definition;
import org.eclipse.wst.wsdl.Types;
import org.eclipse.wst.wsdl.internal.util.WSDLResourceFactoryImpl;
import org.eclipse.wst.wsdl.util.WSDLResourceImpl;
import org.eclipse.xsd.XSDSchema;

public class Test {
public static void main(String[] args) {
ResourceSet resourceSet = new ResourceSetImpl();
Resource.Factory.Registry registry =
resourceSet.getResourceFactoryRegistry();
Map extensionToFactoryMap = registry.getExtensionToFactoryMap();
extensionToFactoryMap.put("wsdl", new WSDLResourceFactoryImpl());

String fileName = "your file name here"; //$NON-NLS-1$
URI uri = URI.createFileURI(fileName);

// You can avoid this cast, but will have to cast anyway later to get the
Definition out the resource contents
WSDLResourceImpl wsdlResource = (WSDLResourceImpl)
resourceSet.createResource(uri);

try {
wsdlResource.load(null);
Definition definition = wsdlResource.getDefinition();

Types types = definition.getETypes();

List schemas = types.getSchemas("the schema namespace here");
//$NON-NLS-1$

XSDSchema schema = (XSDSchema) schemas.get(0);

// Do stuff with the schema.
} catch (IOException e) {
e.printStackTrace();
}
}
}

I hope this helps.
Valentin


"David Williams" <david_williams@us.ibm.com> wrote in message
news:op.tbeuh4edac05ss@dmw2t23.raleigh.ibm.com...
>
> Just from the name, WSDLResourceImpl, I doubt this will ever be API, per
> se,
> so, if Valentin's other suggestions don't help you find an API way to do
> what
> you want, be sure to open a bug/feature request detailing the exact use
> case ...
> I suspect the function you want could be made API, but that particular
Impl
> would probably stay "hidden".
>
>
Re: org.eclipse.wst.wsdl.util.WSDLResourceImpl [message #171633 is a reply to message #171626] Mon, 19 June 2006 22:22 Go to previous messageGo to next message
David Williams is currently offline David WilliamsFriend
Messages: 722
Registered: July 2009
Senior Member
On Mon, 19 Jun 2006 18:06:16 -0400, Valentin Baciu
<valentinbaciu@hotmail.com> wrote:

> this class already is "API" in that it is being exported by the plug-in

Just to clarify a bit more ... I think Valentin means here that it is
visible, not that
it is an official API.

And, I just wanted to say, as an Eclipse Community policy, we should
(almost) always be
exporting every package from our plugins. This is to allow experimentation
and debugging, etc.
But, anyone who uses something like still risks being broken in the next
release, so ...
publically visible yes, API no .. but, please ... contininue your
experimentation :) and
do open bugs/feature requests for future (true) APIs!

Thanks,
Re: org.eclipse.wst.wsdl.util.WSDLResourceImpl [message #171647 is a reply to message #171633] Tue, 20 June 2006 06:43 Go to previous message
Sven Krause is currently offline Sven KrauseFriend
Messages: 119
Registered: July 2009
Senior Member
Thanks David and Valentin,

I also found the way using the Registry to produce the Resource based on
the ResourceSet.
But I guess its still the same issue: I can use the
WSDLResourceFactoryRegistry of the package org.eclipse.wst.wsdl.util and
this package is not marked for export. Additional the way registering
the WSDLResourceFactoryImpl causes some more issues, since Eclipse
already complains that the ResourceFactoryImpl is disaccouraged due to
not marked for export.
Here is my code sniplet:

public Definition load( URI uri ) throws IOException {
try {
ResourceSetImpl resourceSet = new ResourceSetImpl();
Map options = resourceSet.getLoadOptions();
options.put(WSDLResourceImpl.TRACK_LOCATION, Boolean.TRUE);
options.put(WSDLResourceImpl.CONTINUE_ON_LOAD_ERROR,
Boolean.TRUE);

WSDLResourceFactoryRegistry registry = new
WSDLResourceFactoryRegistry(Resource.Factory.Registry.INSTAN CE);
resourceSet.setResourceFactoryRegistry(registry);

WSDLResourceImpl resourceImpl = (WSDLResourceImpl)
resourceSet.getResource(uri, true);
resourceImpl.load(options);
Definition definition = resourceImpl.getDefinition();
return definition;
}
catch( IOException e ) {
e.printStackTrace();
throw e;
}
}


David Williams schrieb:
> On Mon, 19 Jun 2006 18:06:16 -0400, Valentin Baciu
> <valentinbaciu@hotmail.com> wrote:
>
>> this class already is "API" in that it is being exported by the plug-in
>
> Just to clarify a bit more ... I think Valentin means here that it is
> visible, not that
> it is an official API.
>
> And, I just wanted to say, as an Eclipse Community policy, we should
> (almost) always be
> exporting every package from our plugins. This is to allow
> experimentation and debugging, etc.
> But, anyone who uses something like still risks being broken in the next
> release, so ...
> publically visible yes, API no .. but, please ... contininue your
> experimentation :) and
> do open bugs/feature requests for future (true) APIs!
>
> Thanks,
>
Previous Topic:Did not see Geronimo afte installing wtp1.0
Next Topic:How do I validate an XML file with another extention than .xml
Goto Forum:
  


Current Time: Tue Mar 19 04:19:10 GMT 2024

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

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

Back to the top