You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Ryan Moquin <fr...@gmail.com> on 2007/12/06 17:17:51 UTC

Question about wsdl:import and xsd:extension

I'm using CXF (this really might be a JAXWS specific question?) to build a
webservice that imports a common wsdl definition to create a standard
interface, the import wsdl has types, a port and a binding.  The wsdl that
is the actual service, includes a service element, some types and an import
to the common wsdl (referencing the binding and port).

Can I extend a type from the imported wsdl if it is abstract, from my wsdl
that imports it?  When I try running wsdl2java, it can't find the extension
base element that is in the imported wsdl, I'm using the correct namespace.
Has anyone tried this or knows where I can look at an example?  I can't seem
to figure out an effective way to search for this type of example.  Really,
all I want is to have a element in my imported wsdl than can have a type in
the importing wsdl as a child element......  maybe I'm approaching this
wrong?

Thanks!

Re: Question about wsdl:import and xsd:extension

Posted by Ryan Moquin <fr...@gmail.com>.
So, how do you reference xsds or wsdls from a wsdl that is being ran through
wsdl2java?  I was looking at the cxf documentation and keep seem to figure
out the appropriate way unless they are in the same directory, which I
wouldn't want.  I would prefer to have them referenced in their containing
jar file to make it easy to plug into servicemix.. but I can't seem to
figure this out or find good examples of how to use the catalog file, or
when it is appropriate to use it.

I'm still using cxf 2.0.2 btw since servicemix hasn't gotten to 2.0.3 ...
not sure if I should try to add it in myself to my deployment.

On Dec 11, 2007 4:40 PM, Daniel Kulp <dk...@apache.org> wrote:

>
> Actually, I just read the original question...  :-(
>
> If the location attribute on the import element is a full resolvable URL
> AND it's not remapped via a catalog, it should be left as is and not
> remapped to the internal wsdl/xsd serving code.    If that's not what's
> happening, I'll definitely need to dig into some code some more to
> figure out why.
>
> If you look in WSDLQueryHandler (rt/core) in the updateSchemaImports
> method, if the location is a valid URL, we just let it be.
>
> Dan
>
>
> On Monday 10 December 2007, Silberman, Nathan wrote:
> > I'm using a 2.1 snapshot
> >
> > -----Original Message-----
> > From: Daniel Kulp [mailto:dkulp@apache.org]
> > Sent: Monday, December 10, 2007 6:09 PM
> > To: cxf-user@incubator.apache.org
> > Cc: Silberman, Nathan
> > Subject: Re: Question about wsdl:import and xsd:extension
> >
> >
> > What version of CXF?   There were some bugs in this area that were
> > fixed
> >
> > for 2.0.3.
> >
> > Dan
> >
> > On Monday 10 December 2007, Silberman, Nathan wrote:
> > > Glen,
> > >
> > > Thanks for the help. The problem I am encountering is that the
> > > ServletController seems unable to find the xsds in that directory.
> > > The
> > >
> > > ServletTransportFactory lists only my services in its destinations
> > > map.
> > >
> > > This code in the ServletController seems to not be able to find the
> > > xsd in the wsdl directory, I believe for the aformentioned reasons.
> > >
> > >        try {
> > >             EndpointInfo ei = new EndpointInfo();
> > >             String address = request.getPathInfo() == null ? "" :
> > > request.getPathInfo();
> > >
> > >             ei.setAddress(address);
> > >             ServletDestination d =
> > > (ServletDestination)transport.getDestinationForPath(ei.getAddress())
> > >;
> > >
> > >             if (d == null) {
> > >                 if (request.getRequestURI().endsWith("/services")
> > >
> > >                     || request.getRequestURI().endsWith("/services/"
> > >                     ||) StringUtils.isEmpty(request.getPathInfo())
> > >                     || "/".equals(request.getPathInfo())) {
> > >
> > >                     updateDests(request);
> > >                     generateServiceList(request, res);
> > >
> > > It seems to be looking for services only. Any thoughts?
> > >
> > > Nathan
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Glen Mazza [mailto:glen.mazza@verizon.net]
> > > Sent: Friday, December 07, 2007 1:28 PM
> > > To: cxf-user@incubator.apache.org
> > > Subject: RE: Question about wsdl:import and xsd:extension
> > >
> > > Am Freitag, den 07.12.2007, 11:02 -0500 schrieb Silberman, Nathan:
> > > > Does CXF have a standard file structure/method for where to place
> > > > the xsds if one abstracts out schemas to external files?
> > >
> > > The standard JAX-WS way I believe (from JSR 109) is that the wsdl
> > > and xsd's go into your WEB-INF/wsdl directory of the WAR supporting
> > > your web service.
> > >
> > > > Since the import I
> > > > have refers to a URI like:
> > > >
> > > > <import namespace="..."
> > > > location="http://mysite.com/schemas/myschema.xsd"/>
> > > >
> > > > I need to alter my web.xml to tell CXF not to route this request
> > > > to the CXFServlet and instead have a regular file serving servlet
> > > > that will server the XSD. Is there any other way to do this?
> > >
> > > Place the XSD's in the wsdl subdirectory as mentioned above?  It
> > > should be accessible that way, just like the wsdl is when it is in
> > > that directory.
> > >
> > > Glen
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer
> > IONA
> > P: 781-902-8727    C: 508-380-7194
> > daniel.kulp@iona.com
> > http://www.dankulp.com/blog
>
>
>
> --
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727    C: 508-380-7194
> daniel.kulp@iona.com
> http://www.dankulp.com/blog
>

Re: Question about wsdl:import and xsd:extension

Posted by Daniel Kulp <dk...@apache.org>.
Actually, I just read the original question...  :-(

If the location attribute on the import element is a full resolvable URL 
AND it's not remapped via a catalog, it should be left as is and not 
remapped to the internal wsdl/xsd serving code.    If that's not what's 
happening, I'll definitely need to dig into some code some more to 
figure out why.   

If you look in WSDLQueryHandler (rt/core) in the updateSchemaImports 
method, if the location is a valid URL, we just let it be.

Dan


On Monday 10 December 2007, Silberman, Nathan wrote:
> I'm using a 2.1 snapshot
>
> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: Monday, December 10, 2007 6:09 PM
> To: cxf-user@incubator.apache.org
> Cc: Silberman, Nathan
> Subject: Re: Question about wsdl:import and xsd:extension
>
>
> What version of CXF?   There were some bugs in this area that were
> fixed
>
> for 2.0.3.
>
> Dan
>
> On Monday 10 December 2007, Silberman, Nathan wrote:
> > Glen,
> >
> > Thanks for the help. The problem I am encountering is that the
> > ServletController seems unable to find the xsds in that directory.
> > The
> >
> > ServletTransportFactory lists only my services in its destinations
> > map.
> >
> > This code in the ServletController seems to not be able to find the
> > xsd in the wsdl directory, I believe for the aformentioned reasons.
> >
> >        try {
> >             EndpointInfo ei = new EndpointInfo();
> >             String address = request.getPathInfo() == null ? "" :
> > request.getPathInfo();
> >
> >             ei.setAddress(address);
> >             ServletDestination d =
> > (ServletDestination)transport.getDestinationForPath(ei.getAddress())
> >;
> >
> >             if (d == null) {
> >                 if (request.getRequestURI().endsWith("/services")
> >
> >                     || request.getRequestURI().endsWith("/services/"
> >                     ||) StringUtils.isEmpty(request.getPathInfo())
> >                     || "/".equals(request.getPathInfo())) {
> >
> >                     updateDests(request);
> >                     generateServiceList(request, res);
> >
> > It seems to be looking for services only. Any thoughts?
> >
> > Nathan
> >
> >
> >
> > -----Original Message-----
> > From: Glen Mazza [mailto:glen.mazza@verizon.net]
> > Sent: Friday, December 07, 2007 1:28 PM
> > To: cxf-user@incubator.apache.org
> > Subject: RE: Question about wsdl:import and xsd:extension
> >
> > Am Freitag, den 07.12.2007, 11:02 -0500 schrieb Silberman, Nathan:
> > > Does CXF have a standard file structure/method for where to place
> > > the xsds if one abstracts out schemas to external files?
> >
> > The standard JAX-WS way I believe (from JSR 109) is that the wsdl
> > and xsd's go into your WEB-INF/wsdl directory of the WAR supporting
> > your web service.
> >
> > > Since the import I
> > > have refers to a URI like:
> > >
> > > <import namespace="..."
> > > location="http://mysite.com/schemas/myschema.xsd"/>
> > >
> > > I need to alter my web.xml to tell CXF not to route this request
> > > to the CXFServlet and instead have a regular file serving servlet
> > > that will server the XSD. Is there any other way to do this?
> >
> > Place the XSD's in the wsdl subdirectory as mentioned above?  It
> > should be accessible that way, just like the wsdl is when it is in
> > that directory.
> >
> > Glen
>
> --
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727    C: 508-380-7194
> daniel.kulp@iona.com
> http://www.dankulp.com/blog



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

RE: Question about wsdl:import and xsd:extension

Posted by "Silberman, Nathan" <NS...@doubleclick.com>.
I'm using a 2.1 snapshot 

-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Monday, December 10, 2007 6:09 PM
To: cxf-user@incubator.apache.org
Cc: Silberman, Nathan
Subject: Re: Question about wsdl:import and xsd:extension


What version of CXF?   There were some bugs in this area that were fixed

for 2.0.3.

Dan


On Monday 10 December 2007, Silberman, Nathan wrote:
> Glen,
>
> Thanks for the help. The problem I am encountering is that the 
> ServletController seems unable to find the xsds in that directory. The

> ServletTransportFactory lists only my services in its destinations 
> map.
>
> This code in the ServletController seems to not be able to find the 
> xsd in the wsdl directory, I believe for the aformentioned reasons.
>
>        try {
>             EndpointInfo ei = new EndpointInfo();
>             String address = request.getPathInfo() == null ? "" :
> request.getPathInfo();
>
>             ei.setAddress(address);
>             ServletDestination d =
> (ServletDestination)transport.getDestinationForPath(ei.getAddress());
>
>             if (d == null) {
>                 if (request.getRequestURI().endsWith("/services")
>
>                     || request.getRequestURI().endsWith("/services/")
>                     || StringUtils.isEmpty(request.getPathInfo())
>                     || "/".equals(request.getPathInfo())) {
>
>                     updateDests(request);
>                     generateServiceList(request, res);
>
> It seems to be looking for services only. Any thoughts?
>
> Nathan
>
>
>
> -----Original Message-----
> From: Glen Mazza [mailto:glen.mazza@verizon.net]
> Sent: Friday, December 07, 2007 1:28 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: Question about wsdl:import and xsd:extension
>
> Am Freitag, den 07.12.2007, 11:02 -0500 schrieb Silberman, Nathan:
> > Does CXF have a standard file structure/method for where to place 
> > the xsds if one abstracts out schemas to external files?
>
> The standard JAX-WS way I believe (from JSR 109) is that the wsdl and 
> xsd's go into your WEB-INF/wsdl directory of the WAR supporting your 
> web service.
>
> > Since the import I
> > have refers to a URI like:
> >
> > <import namespace="..."
> > location="http://mysite.com/schemas/myschema.xsd"/>
> >
> > I need to alter my web.xml to tell CXF not to route this request to 
> > the CXFServlet and instead have a regular file serving servlet that 
> > will server the XSD. Is there any other way to do this?
>
> Place the XSD's in the wsdl subdirectory as mentioned above?  It 
> should be accessible that way, just like the wsdl is when it is in 
> that directory.
>
> Glen



--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: Question about wsdl:import and xsd:extension

Posted by Daniel Kulp <dk...@apache.org>.
What version of CXF?   There were some bugs in this area that were fixed 
for 2.0.3.

Dan


On Monday 10 December 2007, Silberman, Nathan wrote:
> Glen,
>
> Thanks for the help. The problem I am encountering is that the
> ServletController seems unable to find the xsds in that directory. The
> ServletTransportFactory lists only my services in its destinations
> map.
>
> This code in the ServletController seems to not be able to find the
> xsd in the wsdl directory, I believe for the aformentioned reasons.
>
>        try {
>             EndpointInfo ei = new EndpointInfo();
>             String address = request.getPathInfo() == null ? "" :
> request.getPathInfo();
>
>             ei.setAddress(address);
>             ServletDestination d =
> (ServletDestination)transport.getDestinationForPath(ei.getAddress());
>
>             if (d == null) {
>                 if (request.getRequestURI().endsWith("/services")
>
>                     || request.getRequestURI().endsWith("/services/")
>                     || StringUtils.isEmpty(request.getPathInfo())
>                     || "/".equals(request.getPathInfo())) {
>
>                     updateDests(request);
>                     generateServiceList(request, res);
>
> It seems to be looking for services only. Any thoughts?
>
> Nathan
>
>
>
> -----Original Message-----
> From: Glen Mazza [mailto:glen.mazza@verizon.net]
> Sent: Friday, December 07, 2007 1:28 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: Question about wsdl:import and xsd:extension
>
> Am Freitag, den 07.12.2007, 11:02 -0500 schrieb Silberman, Nathan:
> > Does CXF have a standard file structure/method for where to place
> > the xsds if one abstracts out schemas to external files?
>
> The standard JAX-WS way I believe (from JSR 109) is that the wsdl and
> xsd's go into your WEB-INF/wsdl directory of the WAR supporting your
> web service.
>
> > Since the import I
> > have refers to a URI like:
> >
> > <import namespace="..."
> > location="http://mysite.com/schemas/myschema.xsd"/>
> >
> > I need to alter my web.xml to tell CXF not to route this request to
> > the CXFServlet and instead have a regular file serving servlet that
> > will server the XSD. Is there any other way to do this?
>
> Place the XSD's in the wsdl subdirectory as mentioned above?  It
> should be accessible that way, just like the wsdl is when it is in
> that directory.
>
> Glen



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

RE: Question about wsdl:import and xsd:extension

Posted by "Silberman, Nathan" <NS...@doubleclick.com>.
Glen, 

Thanks for the help. The problem I am encountering is that the
ServletController seems unable to find the xsds in that directory. The
ServletTransportFactory lists only my services in its destinations map. 

This code in the ServletController seems to not be able to find the xsd
in the wsdl directory, I believe for the aformentioned reasons.

       try {
            EndpointInfo ei = new EndpointInfo();
            String address = request.getPathInfo() == null ? "" :
request.getPathInfo();

            ei.setAddress(address);
            ServletDestination d =
(ServletDestination)transport.getDestinationForPath(ei.getAddress());
            
            if (d == null) {
                if (request.getRequestURI().endsWith("/services")
                    || request.getRequestURI().endsWith("/services/")
                    || StringUtils.isEmpty(request.getPathInfo())
                    || "/".equals(request.getPathInfo())) {
                    updateDests(request);
                    generateServiceList(request, res);

It seems to be looking for services only. Any thoughts?

Nathan



-----Original Message-----
From: Glen Mazza [mailto:glen.mazza@verizon.net] 
Sent: Friday, December 07, 2007 1:28 PM
To: cxf-user@incubator.apache.org
Subject: RE: Question about wsdl:import and xsd:extension

Am Freitag, den 07.12.2007, 11:02 -0500 schrieb Silberman, Nathan:
> Does CXF have a standard file structure/method for where to place the 
> xsds if one abstracts out schemas to external files?

The standard JAX-WS way I believe (from JSR 109) is that the wsdl and
xsd's go into your WEB-INF/wsdl directory of the WAR supporting your web
service.


> Since the import I
> have refers to a URI like: 
> 
> <import namespace="..."
> location="http://mysite.com/schemas/myschema.xsd"/>
> 
> I need to alter my web.xml to tell CXF not to route this request to 
> the CXFServlet and instead have a regular file serving servlet that 
> will server the XSD. Is there any other way to do this?
> 

Place the XSD's in the wsdl subdirectory as mentioned above?  It should
be accessible that way, just like the wsdl is when it is in that
directory.

Glen

RE: Question about wsdl:import and xsd:extension

Posted by Glen Mazza <gl...@verizon.net>.
Am Freitag, den 07.12.2007, 11:02 -0500 schrieb Silberman, Nathan:
> Does CXF have a standard file structure/method for where to place the
> xsds if one abstracts out schemas to external files? 

The standard JAX-WS way I believe (from JSR 109) is that the wsdl and
xsd's go into your WEB-INF/wsdl directory of the WAR supporting your web
service.


> Since the import I
> have refers to a URI like: 
> 
> <import namespace="..."
> location="http://mysite.com/schemas/myschema.xsd"/>
> 
> I need to alter my web.xml to tell CXF not to route this request to the
> CXFServlet and instead have a regular file serving servlet that will
> server the XSD. Is there any other way to do this?
> 

Place the XSD's in the wsdl subdirectory as mentioned above?  It should
be accessible that way, just like the wsdl is when it is in that
directory.

Glen



RE: Question about wsdl:import and xsd:extension

Posted by "Silberman, Nathan" <NS...@doubleclick.com>.
Does CXF have a standard file structure/method for where to place the
xsds if one abstracts out schemas to external files? Since the import I
have refers to a URI like: 

<import namespace="..."
location="http://mysite.com/schemas/myschema.xsd"/>

I need to alter my web.xml to tell CXF not to route this request to the
CXFServlet and instead have a regular file serving servlet that will
server the XSD. Is there any other way to do this?

Thanks

-----Original Message-----
From: Glen Mazza [mailto:glen.mazza@verizon.net] 
Sent: Thursday, December 06, 2007 4:58 PM
To: cxf-user@incubator.apache.org
Subject: Re: Question about wsdl:import and xsd:extension

Am Donnerstag, den 06.12.2007, 11:17 -0500 schrieb Ryan Moquin:
> I'm using CXF (this really might be a JAXWS specific question?) to 
> build a webservice that imports a common wsdl definition to create a 
> standard interface, the import wsdl has types, a port and a binding.  
> The wsdl that is the actual service, includes a service element, some 
> types and an import to the common wsdl (referencing the binding and
port).
> Can I extend a type from the imported wsdl if it is abstract, from my 
> wsdl that imports it?  When I try running wsdl2java, it can't find the

> extension base element that is in the imported wsdl, I'm using the
correct namespace.
> Has anyone tried this or knows where I can look at an example?  I 
> can't seem to figure out an effective way to search for this type of 
> example.  Really, all I want is to have a element in my imported wsdl 
> than can have a type in the importing wsdl as a child element......  
> maybe I'm approaching this wrong?
> 

I would go one more level--factor out your types from the common wsdl
into separate xsd file or files, and do your extensions from within
those XSD's.

Look at Slide #31 of here[1], also [2] for more ideas.

HTH,
Glen

[1] http://www.javapassion.com/webservices/WSDLBasics.pdf
[2] http://java.boot.by/wsd-guide/ch01.html

> Thanks!

Re: Question about wsdl:import and xsd:extension

Posted by Glen Mazza <gl...@verizon.net>.
Am Donnerstag, den 06.12.2007, 11:17 -0500 schrieb Ryan Moquin:
> I'm using CXF (this really might be a JAXWS specific question?) to build a
> webservice that imports a common wsdl definition to create a standard
> interface, the import wsdl has types, a port and a binding.  The wsdl that
> is the actual service, includes a service element, some types and an import
> to the common wsdl (referencing the binding and port).
> Can I extend a type from the imported wsdl if it is abstract, from my wsdl
> that imports it?  When I try running wsdl2java, it can't find the extension
> base element that is in the imported wsdl, I'm using the correct namespace.
> Has anyone tried this or knows where I can look at an example?  I can't seem
> to figure out an effective way to search for this type of example.  Really,
> all I want is to have a element in my imported wsdl than can have a type in
> the importing wsdl as a child element......  maybe I'm approaching this
> wrong?
> 

I would go one more level--factor out your types from the common wsdl
into separate xsd file or files, and do your extensions from within
those XSD's.

Look at Slide #31 of here[1], also [2] for more ideas.

HTH,
Glen

[1] http://www.javapassion.com/webservices/WSDLBasics.pdf
[2] http://java.boot.by/wsd-guide/ch01.html

> Thanks!