can't load a wsdl from url using org.eclipse.emf.ecore.resource.impl.ResourceSetImpl [message #491831] |
Fri, 16 October 2009 06:09 |
grid.qian Messages: 47 Registered: July 2009 |
Member |
|
|
Hi all,
I try to use the resourcesetimpl to load a wsdl from a url like localhost:8080/Hello/hello?wsdl.
I write my class extend resourcesetimpl class, and write:
Resource resource = demandCreateResource(uri,kind);
demandLoadHelper(resource);
kind = wsdl
url= localhost:8080/Hello/hello?wsdl
But I can't load the wsdl.
I look into the resourcesetimpl code, I found when
run
Resource.Factory resourceFactory = getResourceFactoryRegistry().getFactory(uri, contentType);
the emf will analyse the uri, if the uri end with .wsdl, it is ok and get a wsdlresourcefactory, but if not end with .wsdl, it is bad and get a xmiresourcefactory.
Then when run demandLoadHelper(resource); there is a error and can't load the wsdl.
Who can tell me how to load the wsdl from the url like localhost:8080/Hello/hello?wsdl
Thanks!
Grid
|
|
|
|
|
Re: can't load a wsdl from url using org.eclipse.emf.ecore.resource.impl.ResourceSetImpl [message #491844 is a reply to message #491831] |
Fri, 16 October 2009 07:17 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Grid,
Comments below.
grid.qian wrote:
> Hi all,
>
> I try to use the resourcesetimpl to load a wsdl from a url like
> localhost:8080/Hello/hello?wsdl.
So it has no file extension.
> I write my class extend resourcesetimpl class, and write:
> Resource resource = demandCreateResource(uri,kind);
Not sure what that method does.
> demandLoadHelper(resource);
Not sure about this one either.
> kind = wsdl
> url= localhost:8080/Hello/hello?wsdl
> But I can't load the wsdl.
Given it doesn't have an extension certainly extension based factory
lookup isn't going to find a good mtach.
> I look into the resourcesetimpl code, I found when run
> Resource.Factory resourceFactory =
> getResourceFactoryRegistry().getFactory(uri, contentType);
> the emf will analyse the uri, if the uri end with .wsdl, it is ok and
> get a wsdlresourcefactory, but if not end with .wsdl, it is bad and
> get a xmiresourcefactory.
Yes, and given that WSDL, as far as I know, isn't doing content type
based registration, like XSD does:
<extension point="org.eclipse.core.contenttype.contentTypes">
<content-type
base-type="org.eclipse.core.runtime.xml"
file-extensions="xsd"
id="org.eclipse.xsd"
name="%_UI_XSD_content_type"
priority="normal">
<describer
class=" org.eclipse.core.runtime.content.XMLRootElementContentDescri ber2 ">
<parameter name="element"
value="{http://www.w3.org/2001/XMLSchema}schema"/>
<parameter name="element"
value="{http://www.w3.org/2000/10/XMLSchema}schema"/>
<parameter name="element"
value="{http://www.w3.org/1999/XMLSchema}schema"/>
</describer>
</content-type>
</extension>
I don't think even the createResource(uri, <content-type>) will help.
You could use something like createResource(URI.createURI(*.wsdl)) and
then use setURI afterwards to set it to the real uri before you call
load explicitly.
> Then when run demandLoadHelper(resource); there is a error and can't
> load the wsdl.
> Who can tell me how to load the wsdl from the url like
> localhost:8080/Hello/hello?wsdl
>
> Thanks!
> Grid
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02942 seconds