On 2010-11-15, at 下午4:20, Jinglong Wang wrote:

On 2010/11/15 16:03, Freeman Fang wrote:

On 2010-11-15, at 下午3:53, Wang Jinglong wrote:

On 2010/11/15 14:41, Freeman Fang wrote:
Hi,

Did you already specify namepace=packagename following the syntax
<[wsdl-namespace =]package-name>* after -p?
You can't only insert -p in the arg list.

Freeman

On 2010-11-15, at 下午2:29, Wang Jinglong wrote:

On 2010/11/15 8:32, Willem Jiang wrote:
Please make sure that you are typing "-" in English input method
mode.
I guess you just used Chinese input method to type "-".


On 11/15/10 1:03 AM, Wang Jinglong wrote:
hi willem,
im tried your suggestions in my project,that's ok,be running.

wsdl2java dependencies these:

<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-tools-wsdlto-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-tools-wsdlto-frontend-jaxws</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-tools-wsdlto-databinding-jaxb</artifactId>
<version>2.3.0</version>
</dependency>

add them in default configurations can be run.

then, it come up another exception:
i set a arg "-p" in args list,then wsdl2java throw an exception:

-p has invalid character!

Usage : wsdl2java -fe<front-end-name> -db<data-binding-name> -wv
<wsdl-version> -p<[wsdl-namespace =]package-name>* -sn<service- name>
-b<binding-file-name>* -reserveClass<class-name>* -catalog
<catalog-file-name> -d<output-directory> -compile -classdir
<compile-classes-directory> -impl -server -client -all
-autoNameResolution -allowElementReferences<=true>
-defaultValues<=class-name-for-DefaultValueProvider> -ant - nexclude <schema-namespace [= java-package-name]>* -exsh<(true, false)> -dns
<Default value is true> -dex<(true, false)> -validate -keep
-wsdlLocation<wsdlLocation> -xjc<xjc-arguments>* - noAddressBinding
-useFQCNForFaultSerialVersionUID -h -v -verbose -quiet
-wsdlList<wsdlurl>

org.apache.cxf.tools.common.ToolException:
org.apache.cxf.tools.common.toolspec.parser.BadUsageException: -p
has
invalid character!

at
org .apache .cxf .tools .common .toolspec .AbstractToolContainer.execute(AbstractToolContainer.java:180)


at
org .apache .cxf .tools .common .AbstractCXFToolContainer .execute(AbstractCXFToolContainer.java:71)


at
org .apache .cxf .tools .wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java: 269)


at
org .apache .cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java: 103)


at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java: 113) at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java: 86)
at
com .tongtech .ti .adaptors .webservice .generator.WSDL2JavaGenerator.generate(WSDL2JavaGenerator.java: 85)


at
com .tongtech .ti .adaptors .webservice.generator.GeneratorTest.testGen(GeneratorTest.java: 15)


at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun .reflect .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39)


at
sun .reflect .DelegatingMethodAccessorImpl .invoke(DelegatingMethodAccessorImpl.java:25)


at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at
org .junit .internal .runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)


at
org .eclipse .jdt .internal .junit4 .runner.JUnit4TestReference.run(JUnit4TestReference.java:46)


at
org .eclipse .jdt .internal.junit.runner.TestExecution.run(TestExecution.java:38)


at
org .eclipse .jdt .internal .junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java: 467)


at
org .eclipse .jdt .internal .junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java: 683)


at
org .eclipse .jdt .internal .junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)


at
org .eclipse .jdt .internal .junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


Caused by:
org.apache.cxf.tools.common.toolspec.parser.BadUsageException: -p
has
invalid character!

at
org .apache .cxf .tools .common .toolspec .parser.CommandLineParser.throwUsage(CommandLineParser.java:199)


at
org .apache .cxf .tools .common .toolspec .parser .CommandLineParser.parseArguments(CommandLineParser.java:174)


at
org .apache .cxf .tools .common .toolspec .AbstractToolContainer .parseCommandLine(AbstractToolContainer.java:89)


at
org .apache .cxf .tools .common .toolspec .AbstractToolContainer.execute(AbstractToolContainer.java:178)


... 26 more

then remove it,everything is ok.

i dont know what happened..

thx willem.

On 2010/11/10 20:15, Willem Jiang wrote:
Hi,

You need to put this module into your pom dependency.

<groupId>org.apache.cxf</groupId>
<artifactId>cxf-tools-wsdlto-frontend-jaxws</artifactId>
<packaging>jar</packaging>

On 11/10/10 5:38 PM, Wang Jinglong wrote:
hi,

in my environmen,i need to use wsdl4java to generate java code in
runtime.
so i need call wsdl4java api that i can generate code in
runtime(may be
not in web apps).

then i run my test case,that throw an exception:
org.apache.cxf.tools.common.ToolException: Could not find jaxws
frontend
within classpath
at
org .apache .cxf .tools .wsdlto.core.PluginLoader.getFrontEnd(PluginLoader.java:241)


at
org .apache .cxf .tools .wsdlto .core.PluginLoader.getFrontEndProfile(PluginLoader.java:377)


at
org .apache .cxf.tools.wsdlto.WSDLToJava.loadFrontEnd(WSDLToJava.java:64)


at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:96) at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)

that's means no jar of jaxws frontend in my classpath.

how to add jaxws frontend into my classpath?

i'm use maven.

pom dependencies:

<dependencies>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.ws.schema</groupId>
<artifactId>XmlSchema</artifactId>
<version>1.4.5</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ws-commons</groupId>
<artifactId>axiom</artifactId>
<version>1.1.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-tools-wsdlto-core</artifactId>
<version>2.3.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.3.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>

thx a lot!



i paste "-d" into "-p"...
"-d" is ok,but "-p" doesnt work...
the "-p" is all english symbols...


yeah i do...

argsList.add("-p");
argsList.add(this.getPackagePath());

Could you post what this.getPackagePath() is?
I doubt if it's not valid arguement.

You can check
org .apache .cxf.tools.common.toolspec.parser.Option.isIdentifyString(String
value) to see what is an valid input.

Freeman


thx Freeman,
i got the reason of the path.

if (value.charAt(i) == '.') {
continue;
} else {
if (!Character.isJavaIdentifierPart(value.charAt(i))) {
return false;
}
}
the arg "-p" need a package path with "." splitter, i give it a real
file path.

but have a anther question, how can i appoint a root file path for "- p"
package path?

e.g:
c:/project/target/generate/com/demo/ws/
the "c:/project/target/generate/" maybe called root path,"com/demo/ ws/"
maybe called package path.
Firstly I don't think you really need specify -p by default, wsdl2java will generate package path based on namespace in your wsdl. Secondly If you do need change package path, you just need directly specify like mycom.mydemo.ws, can't understand why you need extract it from generated files as you showed me.

Any way, now you know what is valid input, you can always write a simple code piece to change from c:/project/target/generate/com/demo/ ws/ to com.demo.ws
Freeman



--
Freeman Fang

------------------------

FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org

Reply via email to