You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by pwanner <pw...@pwanner.com> on 2012/04/19 11:05:40 UTC

xsd:import schemaLocation url with query params

Hi all,

I would like to import a schema in a wsdl using <xsd:import> and having the
schemaLocation url point to the latest snapshot version in nexus:

<xsd:import namespace="http://www.xxx.com/ProjectService/1_0/"
schemaLocation="
nexus.xxx.com/nexus/service/local/artifact/maven/redirect?r=snapshots&g=com.xxx.project&a=project-service-wsdl&v=0.0.1-SNAPSHOT&e=xsd"/>

The problem is that CXF wsdl2java is not happy with the = in the url. Looks
like query parameters are not allowed in the url, can anyone confirm?

Does someone has an idea how to workaround this limitation?

Regards.

--
View this message in context: http://cxf.547215.n5.nabble.com/xsd-import-schemaLocation-url-with-query-params-tp5651282p5651282.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: xsd:import schemaLocation url with query params

Posted by pwanner <pw...@pwanner.com>.
Hi Daniel,

Not sure to understand the point.

The conduit configuration is for the client generated by wsdl2java and not
for wsdl2java itself, or I am missing something?

The redirect concern the url inside the wsdl file, thus affecting the run of
wsdl2java.

Regards

--
View this message in context: http://cxf.547215.n5.nabble.com/xsd-import-schemaLocation-url-with-query-params-tp5651282p5666944.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: xsd:import schemaLocation url with query params

Posted by Daniel Kulp <dk...@apache.org>.
On Monday, April 23, 2012 02:51:32 AM pwanner wrote:
> Hi Aki,
> 
> I finally figured out what the problem is.
> 
> The url I specified in the import is an url asking nexus for the latest
> snapshot of the xsd.
> 
> Nexus is answering with a "301 Moved Permanently" with the redirect url on
> the latest snapshot.

You can configure the http conduit to turn on the redirects:

<http:conduit name="http://nexus.xxx.com/.*">
   <http:client AutoRedirect="true"/>
</http:conduit>

That should allow it to follow that.

Dan



> 
> Wsdl2java dont kwow how to follow redirection I suppose... :-)
> 
> At the end, the problem had nothing related to the query parameters in the
> url.
> 
> Thank you for your help Aki.
> 
> Regards.
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/xsd-import-schemaLocation-url-with-query-
> params-tp5651282p5658837.html Sent from the cxf-user mailing list archive
> at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: xsd:import schemaLocation url with query params

Posted by pwanner <pw...@pwanner.com>.
Hi Aki,

I finally figured out what the problem is.

The url I specified in the import is an url asking nexus for the latest
snapshot of the xsd.

Nexus is answering with a "301 Moved Permanently" with the redirect url on
the latest snapshot.

Wsdl2java dont kwow how to follow redirection I suppose... :-)

At the end, the problem had nothing related to the query parameters in the
url.

Thank you for your help Aki.

Regards.

--
View this message in context: http://cxf.547215.n5.nabble.com/xsd-import-schemaLocation-url-with-query-params-tp5651282p5658837.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: xsd:import schemaLocation url with query params

Posted by Aki Yoshida <el...@googlemail.com>.
Hi,
I believe the error message is saying the content retrieved by the
query is invalid.

It looks like the xml file contains some invalid content before
starting with the xml prolog <?xml ...>
Can you download the file and verify if the file is a valid xml?

regards, aki

2012/4/20 pwanner <pw...@pwanner.com>:
> Hi,
> Thank you for the answer,
>
> When I use in the xsd:include the url pointing directly to the xsd like this
> (direct url, no query):
>
> http://nexus.xxx.com/nexus/service/local/repositories/snapshots/content/com/xxx/project/project-service-wsdl/0.0.1-SNAPSHOT/project-service-wsdl-0.0.1-20120420.140037-391.xsd
>
> all is fine, wsdl2java complete.
>
> When I use in the xsd:include the escaped url like this:
>
> http://nexus.xxx.com/nexus/service/local/artifact/maven/redirect?r=snapshots&amp;g=com.xxx.project&amp;a=project-service-wsdl&amp;v=0.0.1-SNAPSHOT&amp;e=xsd
>
> wsdl2java complains :
>
> Caused by: javax.wsdl.WSDLException: WSDLException (at
> /wsdl:definitions/wsdl:types/xsd:schema): faultCode=PARSER_ERROR: Problem
> parsing
> 'http://nexus.xxx.com/nexus/service/local/artifact/maven/redirect?r=snapshots&g=com.xxx.project&a=project-service-wsdl&v=0.0.1-SNAPSHOT&e=xsd'.:
> org.xml.sax.SAXParseException: Content is not allowed in prolog.
>        at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)
>        at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
>        at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
>        at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
>        at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
>        at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
>        at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
>        at
> org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:237)
>        at
> org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:186)
>        at
> org.apache.cxf.wsdl11.WSDLDefinitionBuilder.parseWSDL(WSDLDefinitionBuilder.java:78)
>        ... 32 more
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/xsd-import-schemaLocation-url-with-query-params-tp5651282p5654441.html
> Sent from the cxf-user mailing list archive at Nabble.com.

Re: xsd:import schemaLocation url with query params

Posted by pwanner <pw...@pwanner.com>.
Hi,
Thank you for the answer,

When I use in the xsd:include the url pointing directly to the xsd like this
(direct url, no query):

http://nexus.xxx.com/nexus/service/local/repositories/snapshots/content/com/xxx/project/project-service-wsdl/0.0.1-SNAPSHOT/project-service-wsdl-0.0.1-20120420.140037-391.xsd

all is fine, wsdl2java complete.

When I use in the xsd:include the escaped url like this:

http://nexus.xxx.com/nexus/service/local/artifact/maven/redirect?r=snapshots&amp;g=com.xxx.project&amp;a=project-service-wsdl&amp;v=0.0.1-SNAPSHOT&amp;e=xsd

wsdl2java complains :

Caused by: javax.wsdl.WSDLException: WSDLException (at
/wsdl:definitions/wsdl:types/xsd:schema): faultCode=PARSER_ERROR: Problem
parsing
'http://nexus.xxx.com/nexus/service/local/artifact/maven/redirect?r=snapshots&g=com.xxx.project&a=project-service-wsdl&v=0.0.1-SNAPSHOT&e=xsd'.:
org.xml.sax.SAXParseException: Content is not allowed in prolog.
        at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
        at
org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:237)
        at
org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:186)
        at
org.apache.cxf.wsdl11.WSDLDefinitionBuilder.parseWSDL(WSDLDefinitionBuilder.java:78)
        ... 32 more



--
View this message in context: http://cxf.547215.n5.nabble.com/xsd-import-schemaLocation-url-with-query-params-tp5651282p5654441.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: xsd:import schemaLocation url with query params

Posted by Aki Yoshida <el...@googlemail.com>.
You should not have any problems with the query parameters.
Are you sure that those &'s are escaped in the raw xml?

2012/4/19 pwanner <pw...@pwanner.com>:
> Hi all,
>
> I would like to import a schema in a wsdl using <xsd:import> and having the
> schemaLocation url point to the latest snapshot version in nexus:
>
> <xsd:import namespace="http://www.xxx.com/ProjectService/1_0/"
> schemaLocation="
> nexus.xxx.com/nexus/service/local/artifact/maven/redirect?r=snapshots&g=com.xxx.project&a=project-service-wsdl&v=0.0.1-SNAPSHOT&e=xsd"/>
>
> The problem is that CXF wsdl2java is not happy with the = in the url. Looks
> like query parameters are not allowed in the url, can anyone confirm?
>
> Does someone has an idea how to workaround this limitation?
>
> Regards.
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/xsd-import-schemaLocation-url-with-query-params-tp5651282p5651282.html
> Sent from the cxf-user mailing list archive at Nabble.com.