Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » can't load a wsdl from url using org.eclipse.emf.ecore.resource.impl.ResourceSetImpl
can't load a wsdl from url using org.eclipse.emf.ecore.resource.impl.ResourceSetImpl [message #491831] Fri, 16 October 2009 06:09 Go to next message
grid.qian  is currently offline grid.qian Friend
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 #491832 is a reply to message #491831] Fri, 16 October 2009 06:21 Go to previous messageGo to next message
grid.qian  is currently offline grid.qian Friend
Messages: 47
Registered: July 2009
Member
And there are two errors:
Package with uri 'http://schemas.xmlsoap.org/wsdl/' not found. (http://127.0.0.1:8080/b/Test?wsdl, 1, 226)
Class 'definitions' is not found or is abstract. (http://127.0.0.1:8080/b/Test?wsdl, 1, 226)
Re: can't load a wsdl from url using org.eclipse.emf.ecore.resource.impl.ResourceSetImpl [message #491834 is a reply to message #491831] Fri, 16 October 2009 06:24 Go to previous messageGo to next message
grid.qian  is currently offline grid.qian Friend
Messages: 47
Registered: July 2009
Member
the wsdl is like:
<definitions name="TestService" targetNamespace="http://test/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://test/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<types>
<xs:schema targetNamespace="http://test/" version="1.0" xmlns:tns="http://test/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="readStr" type="tns:readStr"/>
<xs:element name="readStrResponse" type="tns:readStrResponse"/>
<xs:complexType name="readStr">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="readStrResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
<message name="Test_readStrResponse">
<part element="tns:readStrResponse" name="readStrResponse"/>
</message>
<message name="Test_readStr">
<part element="tns:readStr" name="readStr"/>
</message>
<portType name="Test">
<operation name="readStr" parameterOrder="readStr">
<input message="tns:Test_readStr"/>
<output message="tns:Test_readStrResponse"/>
</operation>
</portType>
<binding name="TestBinding" type="tns:Test">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="readStr">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="TestService">
<port binding="tns:TestBinding" name="TestPort">
<soap:address location="http://localhost:8080/b/Test"/>
</port>
</service>
</definitions>
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 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
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/
Re: can't load a wsdl from url using org.eclipse.emf.ecore.resource.impl.ResourceSetImpl [message #492343 is a reply to message #491844] Tue, 20 October 2009 06:12 Go to previous messageGo to next message
grid.qian  is currently offline grid.qian Friend
Messages: 47
Registered: July 2009
Member
Thanks a lot, Ed!
my comment as below

>> 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.

These two methods are from org.eclipse.emf.ecore.resource.impl.ResourceSetImpl

>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.

For my scene, should be
Resource resource = createResource(URI.createURI(*.wsdl))
resource.setURI(myURL);
Then load the file. Right?
What is the *.wsdl? just 'wsdl' or 'hello.wsdl' or something else?
Re: can't load a wsdl from url using org.eclipse.emf.ecore.resource.impl.ResourceSetImpl [message #492346 is a reply to message #492343] Tue, 20 October 2009 06:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Grid,


Comments below.

grid.qian wrote:
> Thanks a lot, Ed!
> my comment as below
>
>>> 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.
>
> These two methods are from
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl
I overlooked the part where you extended the ResourceSetImpl; not sure
why you needed to do that...
>
>> 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.
>
> For my scene, should be Resource resource =
> createResource(URI.createURI(*.wsdl))
> resource.setURI(myURL);
> Then load the file. Right?
> What is the *.wsdl? just 'wsdl' or 'hello.wsdl' or something else?
It's literally anything that ends with .wsdl file extension.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: can't load a wsdl from url using org.eclipse.emf.ecore.resource.impl.ResourceSetImpl [message #492347 is a reply to message #492343] Tue, 20 October 2009 06:40 Go to previous messageGo to next message
grid.qian  is currently offline grid.qian Friend
Messages: 47
Registered: July 2009
Member
Ok, got it!
Should be URI.createURI("*.wsdl");
Re: can't load a wsdl from url using org.eclipse.emf.ecore.resource.impl.ResourceSetImpl [message #492608 is a reply to message #492346] Wed, 21 October 2009 03:21 Go to previous message
grid.qian  is currently offline grid.qian Friend
Messages: 47
Registered: July 2009
Member
Not me to extend the resourceimpl, it is eclipse bpel editor. When I use it, I found this issue in its codes, so fix it.
Previous Topic:Ecore UML Profile, adding Ecore annotation
Next Topic:EMF Serialization: Forcing the serialization of default attribute values
Goto Forum:
  


Current Time: Thu Apr 25 03:32:14 GMT 2024

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

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

Back to the top