Hi Jim,
I tried modifying my WSDL as suggested. However this produces the exact
same error as before. The preamble to my WSDL now looks like:
<?xml version="1.0" encoding="utf-8"?>
<definitions
targetNamespace="http://www.test.com/TestService/"
xmlns:tns="http://www.test.com/TestService/"
xmlns:test="http://www.test.com/test"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema>
<xsd:import schemaLocation="types.xsd"
namespace="http://www.test.com/test"/>
</xsd:schema>
</types>
...
And the error output looks the same as before:
[java] wsdl2java -verbose -client -b bindings.xml -d [...path-to-project
ommitted...]/src/main/java [...path-to-project
ommitted...]/src/main/test/test.wsdl
[java] wsdl2java - Apache CXF (incubator) 2.0.4-incubator
[java] WSDLToJava Error : java.lang.RuntimeException: Fail to create wsdl
definition file: [...path-to-project ommitted...]/src/main/test/test.wsdl
[java] org.apache.cxf.tools.common.ToolException:
java.lang.RuntimeException: Fail to create wsdl definition file:
[...path-to-project ommitted...]/src/main/test/test.wsdl
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:237)
[java] at
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:83)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:102)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:171)
[java] Caused by: java.lang.RuntimeException: Fail to create wsdl
definition file: [...path-to-project ommitted...]/src/main/test/test.wsdl
[java] at
org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.customize(JAXWSDefinitionBuilder.java:130)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:123)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:229)
[java] ... 3 more
[java] Caused by: java.lang.RuntimeException: Failed to Resolve types.xsd
[java] at
org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.CustomizedWSDLLocator.getImportInputSource(CustomizedWSDLLocator.java:129)
[java] at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
[java] at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
[java] at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
[java] at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown
Source)
[java] at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
[java] at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
[java] at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
[java] at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
[java] at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
[java] at
org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.buildCustomizedDefinition(JAXWSDefinitionBuilder.java:178)
[java] at
org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.customize(JAXWSDefinitionBuilder.java:125)
[java] ... 5 more
[java] Caused by: java.net.URISyntaxException: Illegal character in path at
index 53: file: [...path-to-project ommitted...]/src/main/test/test.wsdl
[java] at java.net.URI$Parser.fail(URI.java:2816)
[java] at java.net.URI$Parser.checkChars(URI.java:2989)
[java] at java.net.URI$Parser.parseHierarchical(URI.java:3073)
[java] at java.net.URI$Parser.parse(URI.java:3021)
[java] at java.net.URI.<init>(URI.java:578)
[java] at
org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.CustomizedWSDLLocator.getImportInputSource(CustomizedWSDLLocator.java:113)
[java] ... 16 more
Is this being caused by a bug somewhere in WSDL2Java? As before, it all
works OK if the binding file is not passed in.
Thanks,
Jesse.
jim ma wrote:
>
> Some elements are missing in your wsdl. Can you modify your wsdl like this
> and try it again ?
>
> <?xml version="1.0" encoding="utf-8"?>
> <definitions
> targetNamespace="http://www.test.com/TestService/"
> xmlns:tns="http://www.test.com/TestService/"
> xmlns:test="http://www.test.com/test"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns="http://schemas.xmlsoap.org/wsdl/">
> <wsdl:types>
> <xsd:schema>
> <xsd:import schemaLocation="types.xsd" namespace="
> http://www.test.com/test"/>
> </xsd:schema>
> </wsdl:types>
>
>
>
>
> On Wed, Mar 5, 2008 at 1:51 AM, Jesse McLaughlin <[EMAIL PROTECTED]>
> wrote:
>
>>
>> OK, thanks for the tip about the verbose flag. I got the stack trace
>> output
>> now:
>>
>> [java] wsdl2java -verbose -client -b bindings.xml -d
>> [...path-to-project ommitted...]/src/main/java [...path-to-project
>> ommitted...]/src/main/test/test.wsdl
>> [java] wsdl2java - Apache CXF (incubator) 2.0.4-incubator
>> [java] WSDLToJava Error : java.lang.RuntimeException: Fail to create
>> wsdl definition file: [...path-to-project
>> ommitted...]/src/main/test/test.wsdl
>> [java] org.apache.cxf.tools.common.ToolException:
>> java.lang.RuntimeException: Fail to create wsdl definition file:
>> [...path-to-project ommitted...]/src/main/test/test.wsdl
>> [java] at
>> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(
>> WSDLToJavaContainer.java:237)
>> [java] at
>> org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java
>> :83)
>> [java] at
>> org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:102)
>> [java] at
>> org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:171)
>> [java] Caused by: java.lang.RuntimeException: Fail to create wsdl
>> definition file: [...path-to-project ommitted...]/src/main/test/test.wsdl
>> [java] at
>>
>> org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.customize
>> (JAXWSDefinitionBuilder.java:130)
>> [java] at
>> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(
>> WSDLToJavaContainer.java:123)
>> [java] at
>> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(
>> WSDLToJavaContainer.java:229)
>> [java] ... 3 more
>> [java] Caused by: java.lang.RuntimeException: Failed to Resolve
>> types.xsd
>> [java] at
>>
>> org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.CustomizedWSDLLocator.getImportInputSource
>> (CustomizedWSDLLocator.java:129)
>> [java] at com.ibm.wsdl.xml.WSDLReaderImpl.parseImport(Unknown
>> Source)
>> [java] at
>> com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown
>> Source)
>> [java] at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown
>> Source)
>> [java] at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown
>> Source)
>> [java] at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown
>> Source)
>> [java] at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown
>> Source)
>> [java] at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown
>> Source)
>> [java] at
>>
>> org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.buildCustomizedDefinition
>> (JAXWSDefinitionBuilder.java:178)
>> [java] at
>>
>> org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.customize
>> (JAXWSDefinitionBuilder.java:125)
>> [java] ... 5 more
>> [java] Caused by: java.net.URISyntaxException: Illegal character in
>> path at index 53: file: [...path-to-project
>> ommitted...]/src/main/test/test.wsdl
>> [java] at java.net.URI$Parser.fail(URI.java:2816)
>> [java] at java.net.URI$Parser.checkChars(URI.java:2989)
>> [java] at java.net.URI$Parser.parseHierarchical(URI.java:3073)
>> [java] at java.net.URI$Parser.parse(URI.java:3021)
>> [java] at java.net.URI.<init>(URI.java:578)
>> [java] at
>>
>> org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.CustomizedWSDLLocator.getImportInputSource
>> (CustomizedWSDLLocator.java:113)
>> [java] ... 14 more
>>
>>
>> Not sure what the solution is from looking at this. I can provide the
>> WSDL
>> file and the XSD file I am using if necessary...?
>>
>> Thanks,
>> Jesse.
>>
>>
>>
>> dkulp wrote:
>> >
>> >
>> > Add the -verbose flag to the wsdl2java call.
>> >
>> > Dan
>> >
>> >
>> > On Tuesday 04 March 2008, Jesse McLaughlin wrote:
>> >> Hi there,
>> >>
>> >> I wanted to include the stack trace details in my previous post, but
>> >> unfortunately they are never output. My thought was that I just need
>> >> to change the logging level, but this doesn't work. Actually, looking
>> >> more closely at the output from running WSDL2Java, I don't think the
>> >> error message I'm getting is being output via the log, since it is not
>> >> in the same format used by the other log messages (is this observation
>> >> correct?). Anyway, here's the full output when I try to generate the
>> >> client (running via Ant):
>> >>
>> >> [java] Mar 4, 2008 2:28:06 PM
>> >> org.apache.cxf.tools.wsdlto.core.PluginLoader loadPlugin
>> >> [java] INFO: Loading plugin jar:file:[...path-to-project
>> >> ommitted...]/lib/cxf-2.0.4-incubator.jar!/META-INF/tools-plugin.xml
>> >> [java] Mar 4, 2008 2:28:06 PM
>> >> org.apache.cxf.tools.wsdlto.core.PluginLoader loadPlugin
>> >> [java] INFO: Found 1 frontends in <default> plugin.
>> >> [java] Mar 4, 2008 2:28:06 PM
>> >> org.apache.cxf.tools.wsdlto.core.PluginLoader loadPlugin
>> >> [java] INFO: Loading <jaxws> frontend from <default> plugin.
>> >> [java] Mar 4, 2008 2:28:06 PM
>> >> org.apache.cxf.tools.wsdlto.core.PluginLoader loadPlugin
>> >> [java] INFO: Found 1 databindings in <default> plugin.
>> >> [java] Mar 4, 2008 2:28:06 PM
>> >> org.apache.cxf.tools.wsdlto.core.PluginLoader loadPlugin
>> >> [java] INFO: Loading <jaxb> databinding from <default> plugin.
>> >> [java] WSDLToJava Error : java.lang.RuntimeException: Fail to
>> >> create wsdl definition file:[...path-to-project
>> >> ommitted...]/src/main/test/test.wsdl
>> >>
>> >> Is there some way to get the stack trace information?
>> >>
>> >> Cheers,
>> >> Jesse.
>> >>
>> >> jim ma wrote:
>> >> > Hi Jesse,
>> >> >
>> >> > Can you also paste the error stacktrace for the details?
>> >> >
>> >> > Thanks
>> >> >
>> >> > Jim Ma
>> >> >
>> >> >
>> >> > On Tue, Mar 4, 2008 at 5:42 PM, Jesse McLaughlin
>> >> > <[EMAIL PROTECTED]>
>> >> >
>> >> > wrote:
>> >> >> Thanks for the suggestion Dan. Now I am getting a different error
>> >> >> from WSDL2Java. I tried the following exact binding file based on
>> >> >> what you suggested:
>> >> >>
>> >> >> <jxb:bindings version="1.0"
>> >> >> xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
>> >> >> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>> >> >> <jxb:bindings schemaLocation="types.xsd" node="/xs:schema">
>> >> >> <jxb:globalBindings>
>> >> >> <jxb:serializable/>
>> >> >> </jxb:globalBindings>
>> >> >> </jxb:bindings>
>> >> >> </jxb:bindings>
>> >> >>
>> >> >> And the error I get is:
>> >> >>
>> >> >> "WSDLToJava Error : java.lang.RuntimeException: Fail to create
>> >> >> wsdl definition [...path-to-project
>> >> >> ommitted...]/src/main/test/test.wsdl"
>> >> >>
>> >> >> This must be a fairly common case, but I can't find any way to make
>> >> >> it work
>> >> >> (and I have tried a few variations).
>> >> >>
>> >> >> Is there any further help out there on this issue?
>> >> >>
>> >> >> Thanks and regards,
>> >> >> Jesse.
>> >> >>
>> >> >> dkulp wrote:
>> >> >> > It should just be something like:
>> >> >> >
>> >> >> >
>> >> >> > <jxb:bindings version="1.0"
>> >> >> > xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
>> >> >> > xmlns:xs="http://www.w3.org/2001/XMLSchema">
>> >> >> > <jxb:bindings schemaLocation="MySchema.xsd"
>> >> >> > node="/xs:schema"> <jaxb:globalBindings>
>> >> >> > <jaxb:serializable/>
>> >> >> > </jaxb:globalBindings>
>> >> >> > </jxb:bindings>
>> >> >> > </jxb:bindings>
>> >> >> >
>> >> >> >
>> >> >> > Dan
>> >> >> >
>> >> >> > On Monday 03 March 2008, Jesse McLaughlin wrote:
>> >> >> >> Thanks Jim. I've figured out why it didn't work for me. It
>> >> >> >> seems that this binding file won't work because I am importing
>> >> >> >> my type definitions (which are in a seperate xsd file) as
>> >> >> >> opposed to including them inline in the WSDL document itself.
>> >> >> >> Here's what the preamble of my WSDL looks like:
>> >> >> >>
>> >> >> >> <?xml version="1.0" encoding="utf-8"?>
>> >> >> >> <definitions
>> >> >> >> targetNamespace="http://www.test.com/TestService/"
>> >> >> >> xmlns:tns="http://www.test.com/TestService/"
>> >> >> >> xmlns:test="http://www.test.com/test"
>> >> >> >> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>> >> >> >> xmlns="http://schemas.xmlsoap.org/wsdl/">
>> >> >> >>
>> >> >> >> <import namespace="http://www.test.com/test"
>> >> >> >> location="types.xsd"/>
>> >> >> >>
>> >> >> >> ...
>> >> >> >>
>> >> >> >> I verified this by removing the import and in-lining my types,
>> >> >> >> and everything works.
>> >> >> >>
>> >> >> >> My problem is that I don't know how to construct a binding file
>> >> >> >> that works when an import is used. Do I now need to specify a
>> >> >> >> schemaLocation attribute? If so, what is the value? And what
>> >> >> >> would be the proper value for the node attribute on the
>> >> >> >> <jaxb:bindings> element in this case?
>> >> >> >>
>> >> >> >> Could someone provide an example of a binding file that would
>> >> >> >> work?
>> >> >> >>
>> >> >> >> Thanks,
>> >> >> >> Jesse.
>> >> >> >>
>> >> >> >> jim ma wrote:
>> >> >> >> > Hi Jesse,
>> >> >> >> >
>> >> >> >> > I just tried this binding file with hello_world.wsdl and it
>> >> >> >> > works.
>> >> >> >> >
>> >> >> >> > Can you check if there is some typo/error in your wsdl and
>> >> >> >> > make sure the
>> >> >> >> >
>> >> >> >> > xpath expression is right for your wsdl .
>> >> >> >> >
>> >> >> >> > Cheers
>> >> >> >> >
>> >> >> >> > Jim Ma
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > On Sun, Mar 2, 2008 at 7:13 PM, Jesse McLaughlin
>> >> >> >> > <[EMAIL PROTECTED]>
>> >> >> >> >
>> >> >> >> > wrote:
>> >> >> >> >> Hi there,
>> >> >> >> >>
>> >> >> >> >> I am trying to use CXF to generate a JAXB client from a WSDL,
>> >> >> >> >> and I want all
>> >> >> >> >> the generated objects to implement java.io.Serializable. To
>> >> >> >> >> do this, I pass
>> >> >> >> >> the following bindings file to WSDL2Java, using the -b
>> >> >> >> >> option:
>> >> >> >> >>
>> >> >> >> >> <?xml version="1.0" encoding="UTF-8"?>
>> >> >> >> >> <jaxws:bindings node="wsdl:definitions/wsdl:types/xsd:schema"
>> >> >> >> >> xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
>> >> >> >> >> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
>> >> >> >> >> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>> >> >> >> >> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>> >> >> >> >> <jaxb:globalBindings>
>> >> >> >> >> <jaxb:serializable/>
>> >> >> >> >> </jaxb:globalBindings>
>> >> >> >> >> </jaxws:bindings>
>> >> >> >> >>
>> >> >> >> >> When I run WSDL2Java, it gives me the following error:
>> >> >> >> >>
>> >> >> >> >> "WSDLToJava Error : Could not find any node with the XPath
>> >> >> >> >> expression: //wsdl:definitions/wsdl:types/xsd:schema"
>> >> >> >> >>
>> >> >> >> >> The client is generated normally if I don't pass this file.
>> >> >> >> >> I am using CXF
>> >> >> >> >> 2.0.4 with JDK5 on OS X.
>> >> >> >> >>
>> >> >> >> >> Note that I have read on JIRA that since CXF 2.0.3, neither
>> >> >> >> >> the wsdlLocation
>> >> >> >> >> nor schemaLocation attributes are required when doing this
>> >> >> >> >> sort of customization
>> >> >> >> >> (https://issues.apache.org/jira/browse/CXF-1094).
>> >> >> >> >>
>> >> >> >> >> Does anyone know what I am doing wrong here or why it does
>> >> >> >> >> not work?
>> >> >> >> >>
>> >> >> >> >> Thanks,
>> >> >> >> >> Jesse.
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >> View this message in context:
>> >> >> >> >> http://www.nabble.com/WSDL2Java-error-when-using-%3Cjaxb%3Ase
>> >> >> >> >>rializ able-%3E-binding-customization-tp15786637p15786637.html
>> >> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >> >> >
>> >> >> > --
>> >> >> > J. Daniel Kulp
>> >> >> > Principal Engineer, IONA
>> >> >> > [EMAIL PROTECTED]
>> >> >> > http://www.dankulp.com/blog
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >> http://www.nabble.com/WSDL2Java-error-when-using-%3Cjaxb%3Aserializ
>> >> >>able-%3E-binding-customization-tp15786637p15823617.html Sent from
>> >> >> the cxf-user mailing list archive at Nabble.com.
>> >
>> >
>> >
>> > --
>> > J. Daniel Kulp
>> > Principal Engineer, IONA
>> > [EMAIL PROTECTED]
>> > http://www.dankulp.com/blog
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/WSDL2Java-error-when-using-%3Cjaxb%3Aserializable-%3E-binding-customization-tp15786637p15833082.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/WSDL2Java-error-when-using-%3Cjaxb%3Aserializable-%3E-binding-customization-tp15786637p15845940.html
Sent from the cxf-user mailing list archive at Nabble.com.