emf recursive wsdl imports [message #415246] |
Fri, 07 December 2007 00:56 |
Eclipse User |
|
|
|
Originally posted by: norman.barker.gmail.com
Hi,
I am trying (in code) to import the WSDL files here
http://www.oasis-open.org/committees/regrep/documents/3.0/se rvices/ebXMLRegistryServices.wsdl
I have made a local copy and made sure they validate, but my code doesn't
seem to load <import location="ebXMLRegistryBindings.wsdl"
namespace="urn:oasis:names:tc:ebxml-regrep:wsdl:registry:bindings:3.0 "/>
and subsequent wsdl imports and the schema imports since the only schema
in the model is the top level wsdl. The top level wsdl has to import to
other wsdls before it gets to the XML schemas.
Currently I have the code
SDOXSDEcoreBuilder ecoreBuilder = getEcoreBuilder();
ResourceSet resourceSet = ecoreBuilder.createResourceSet();
Resource model =
resourceSet.createResource(URI.createURI(schemaLocation != null ?
schemaLocation : "null.xsd"));
((XSDResourceImpl)model).load(inputSource, null);
where schemaLocation is pointed to my local copy of
ebXMLRegistryBindings.wsdl
Is there a way to do an import of WSDLs in this manner?
thanks,
Norman
|
|
|
Re: emf recursive wsdl imports [message #415255 is a reply to message #415246] |
Fri, 07 December 2007 14:14 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------010405020909060005020608
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Norman,
It's very important when schemas contain relative schema locations (ones
that don't start with a scheme, i.e., http: or file:) that the document
containing the schema location is loaded with an absolute URI, i.e, one
with a scheme. So you should be loading the imported schema with
http://www.oasis-open.org/committees/regrep/documents/3.0/se rvices/ebXMLRegistryBindings.wsdl
Also keep in mind that the XSDResourceImpl will only deal directly with
<xsd:schema> elements and will do nothing with <wsdl:imports> so those
will require manual processing and when doing so you'll need to be
careful to resolve the relative location against the absolute location
of the containing document.
This utility from XSDConstants might help:
/**
* Resolve the namespace and schema location relative to the base
schema location.
* For example, the expression
*<pre>
* resolveSchemaLocation
* ("http://www.example.com/A/a.xsd",
* "http://www.example.com/B",
* "../B/b.xsd");
*</pre>
* would yield
*<pre>
* "http://www.example.com/B/b.xsd"
*</pre>
* When no namespace schema location is provided, the namespace
itself will be used.
* @param baseSchemaLocationURI the location of the schema
containing the reference, i.e., {@link
org.eclipse.xsd.XSDSchema#getSchemaLocation}.
* @param namespaceURI the namespace being resolved, i.e., {@link
org.eclipse.xsd.XSDImport#getNamespace}.
* @param schemaLocationURI the suggested location of the
namespace being resolved, i.e., {@link
org.eclipse.xsd.XSDImport#getSchemaLocation}.
* @return the resolved schema location.
*/
public static String resolveSchemaLocation(String
baseSchemaLocationURI, String namespaceURI, String schemaLocationURI)
Norman Barker wrote:
> Hi,
>
> I am trying (in code) to import the WSDL files here
> http://www.oasis-open.org/committees/regrep/documents/3.0/se rvices/ebXMLRegistryServices.wsdl
>
> I have made a local copy and made sure they validate, but my code
> doesn't seem to load <import location="ebXMLRegistryBindings.wsdl"
> namespace="urn:oasis:names:tc:ebxml-regrep:wsdl:registry:bindings:3.0 "/>
> and subsequent wsdl imports and the schema imports since the only
> schema in the model is the top level wsdl. The top level wsdl has to
> import to other wsdls before it gets to the XML schemas.
>
> Currently I have the code
>
> SDOXSDEcoreBuilder ecoreBuilder = getEcoreBuilder();
> ResourceSet resourceSet = ecoreBuilder.createResourceSet();
>
> Resource model =
> resourceSet.createResource(URI.createURI(schemaLocation != null ?
> schemaLocation : "null.xsd"));
>
> ((XSDResourceImpl)model).load(inputSource, null);
>
>
> where schemaLocation is pointed to my local copy of
> ebXMLRegistryBindings.wsdl
>
> Is there a way to do an import of WSDLs in this manner?
>
> thanks,
>
> Norman
>
--------------010405020909060005020608
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">
Norman,<br>
<br>
It's very important when schemas contain relative schema locations
(ones that don't start with a scheme, i.e., http: or file:) that the
document containing the schema location is loaded with an absolute URI,
i.e, one with a scheme.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03026 seconds