Urgent - Creating a WSDL Model from string [message #221800] |
Thu, 25 September 2008 03:28  |
Eclipse User |
|
|
|
Hello all,
I am trying to create a WSDL model from the string and i used the
below method
WSDLReader newWSDLReader;
newWSDLReader = WSDLFactory.newInstance().newWSDLReader();
return (newWSDLReader.readWSDL(null, new InputSource(new
StringReader(contents))));
but the Definition object obtained this way is returning the schema
sections as DOM elements and not as the ecore XSD Model.
But when i create using the below method
private Definition readService(final IFile file){
final String wsdlURL = file.getLocationURI().getPath();
final ResourceSet resourceSet = new ResourceSetImpl();
WSDLResourceImpl wsdlr =
(WSDLResourceImpl)
resourceSet.getResource(URI.createFileURI(wsdlURL),true);
return wsdlr.getDefinition();
}
i get the definition object with schema sections as
XSDSchemaExtensibilityElement
Can anyone help me finding the reason or it would be great if you could
tell
me, how get the defintion model which would be same as the resource
approach
but with the String contents of WSDLs
Thanks and regards,
Keshav Veerapaneni.
|
|
|
Re: Urgent - Creating a WSDL Model from string [message #221816 is a reply to message #221800] |
Thu, 25 September 2008 07:12   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------080909010901020105000404
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Keshavrao,
Does WSDLResourceImpl have methods like XSDResourceImpl does for loading
from an InputSource?
public final void load(InputSource inputSource, Map<?, ?> options)
throws IOException
Failing that, EMF has added support for "new
URIConverter.ReadableInputStream(<xml-string>)" which wraps a string or
reader to make it work like an InputStream. And XSDResourceImpl has
specialized support to unwrap such a stream so that it can efficiently
process the characters directly.
protected void doLoad(InputStream inputStream, Map<?, ?> options)
throws IOException
{
InputSource inputSource =
inputStream instanceof URIConverter.ReadableInputStream ?
new
InputSource(((URIConverter.ReadableInputStream)inputStream). asReader())
:
new InputSource(inputStream);
if (getURI() != null)
{
String id = getURI().toString();
inputSource.setPublicId(id);
inputSource.setSystemId(id);
}
doLoad(inputSource, options);
}
WSDLResourceImpl should support the same type of thing, but even if it
doesn't this approach should still work, albeit less efficiently than
unwrapping the stream.
Keshavrao wrote:
> Hello all,
> I am trying to create a WSDL model from the string and i used
> the below method
>
> WSDLReader newWSDLReader;
>
> newWSDLReader = WSDLFactory.newInstance().newWSDLReader();
> return (newWSDLReader.readWSDL(null, new InputSource(new
> StringReader(contents))));
>
> but the Definition object obtained this way is returning the schema
> sections as DOM elements and not as the ecore XSD Model.
>
> But when i create using the below method
> private Definition readService(final IFile file){
> final String wsdlURL = file.getLocationURI().getPath();
>
> final ResourceSet resourceSet = new ResourceSetImpl();
> WSDLResourceImpl wsdlr = (WSDLResourceImpl)
> resourceSet.getResource(URI.createFileURI(wsdlURL),true);
>
> return wsdlr.getDefinition();
> }
>
> i get the definition object with schema sections as
> XSDSchemaExtensibilityElement
>
> Can anyone help me finding the reason or it would be great if you
> could tell
> me, how get the defintion model which would be same as the resource
> approach
> but with the String contents of WSDLs
>
> Thanks and regards,
> Keshav Veerapaneni.
>
--------------080909010901020105000404
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Keshavrao,<br>
<br>
Does WSDLResourceImpl have methods like XSDResourceImpl does for
loading from an InputSource?<br>
<br>
|
|
|
Re: Urgent - Creating a WSDL Model from string [message #221833 is a reply to message #221800] |
Thu, 25 September 2008 14:23  |
Eclipse User |
|
|
|
Originally posted by: valentinbaciu.hotmail.com
How about trying to create the WSDL4J WSDLFactory like this:
WSDLFactory factory = WSDLPlugin.INSTANCE.createWSDL4JFactory();
This factory should give you a WSDL reader that uses the WSDL EMF model to
load a Definition. The model should be configured with the extensibility
element factory that creates XSDSchemaExtensibilityElement when it
encounters an inline schema.
Regards, Valentin
"Keshavrao " <keshavrao.veerapaneni@sap.com> wrote in message
news:41eb3605474822c90649faa527f402d7$1@www.eclipse.org...
> Hello all,
> I am trying to create a WSDL model from the string and i used the
> below method
>
> WSDLReader newWSDLReader;
>
> newWSDLReader = WSDLFactory.newInstance().newWSDLReader();
> return (newWSDLReader.readWSDL(null, new InputSource(new
> StringReader(contents))));
>
> but the Definition object obtained this way is returning the schema
> sections as DOM elements and not as the ecore XSD Model.
>
> But when i create using the below method
> private Definition readService(final IFile file){
> final String wsdlURL = file.getLocationURI().getPath();
>
> final ResourceSet resourceSet = new ResourceSetImpl();
> WSDLResourceImpl wsdlr = (WSDLResourceImpl)
> resourceSet.getResource(URI.createFileURI(wsdlURL),true);
>
> return wsdlr.getDefinition();
> }
>
> i get the definition object with schema sections as
> XSDSchemaExtensibilityElement
>
> Can anyone help me finding the reason or it would be great if you could
> tell
> me, how get the defintion model which would be same as the resource
> approach
> but with the String contents of WSDLs
>
> Thanks and regards,
> Keshav Veerapaneni.
>
|
|
|
Powered by
FUDForum. Page generated in 0.06576 seconds