How to Resolve "..\" character in location of wsdl:import in WSDL?

132 Views Asked by At

When I am parsing the WSDL through wsimport using JDK1.8, it gives me below error: Error: Illegal character in path at index 2: ....\schema\abcdschema.xsd

The WSDL is on located on web and it has the below syntax:

<xsd:import namespace="https://abcd.org/abcd/ab/v1.0/abcds" schemaLocation="....\schema\abcdschema.xsd"/>

How can I replace all "\" with "/" runtime when executing wsimport?

PS: I can not do it local editing because it is a huge Project which has multiple xsd files getting imported from many other schema files.

I tried it by editing files in local. But, it is too much time consuming and manual intervention is more required. I need wsimport compatible attribute so that it can replace run-time.

I am using NetBeans for this activity.

1

There are 1 best solutions below

0
zebity On

unfortunately without modifying wsimport (ie downloading code and creating a custom version) there is no way to intercede its its URL communications interface.

I had similar issues with trying to generate code directly via http (from www.onvif.org) which resulted in a whole series of issues:

  1. URL redirects that used HTML rather than XML / HTTP Headers
  2. Parse not accepting WSDL/XSD that did not have encoding directives
  3. Unresolved crashes with SAX parser

I have no choice but to download selected WSDL/XSD and then create patches by first hand editing and then doing diff against original.

This meant that I could then automate the WSDL/XSD download and patching process as part of build.

See: https://github.com/zebity/onvif-relay and look at the "get-and-patch.sh" shell script. It is pretty generic and could be used to solve your problem.

NOTE: The related link to blog provide details on various wsimport/download/parsing errors I found.

This is a work around solution and it would be good to do this a "better" way by having more maven/ant/make based automation, but I have not got to that yet to make process 100% automated.

Cheers from Oz,

zebity/John