Hi all. I am using Maven to generate a SOAP client from WSDL. I followed
the web site example and some other examples i found on the net and my
classes seemed to generate fine. As a side note i am using java version
"1.6.0_16"
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<client>true</client>
<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/wsdl/oasApi.wsdl</wsdl>
<extraargs>
<extraarg>-p</extraarg>
<extraarg>com.xxx.soap</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
However, when i create a new xxxService Object as in...
OaxApiService service = new OaxApiService( url, OaxApiService.SERVICE );
i am getting the following exception....
org.apache.cxf.service.factory.ServiceConstructionException: Failed to
create service.
at
org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:93)
at
org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:205)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:148)
at
org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:65)
at javax.xml.ws.Service.<init>(Service.java:56)
at com.xxx.soap.OaxApiService.<init>(OaxApiService.java:48)
at com.xxx.OaxClient.invoke(OaxClient.java:97)
at com.xxx.oas.OaxClient.main(OaxClient.java:32)
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR:
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 't' (code
116) excepted space, or '>' or "/>"
at [row,col,system-id]: [2,41,"https://server.xxx.com/oasapi/OaxApi"]
at
org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:226)
at
org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:179)
at
org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:91)
... 7 more
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected
character 't' (code 116) excepted space, or '>' or "/>"
at [row,col,system-id]: [2,41,"https://server.xxx.com/oasapi/OaxApi"]
at
com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at
com.ctc.wstx.sr.BasicStreamReader.handleNsAttrs(BasicStreamReader.java:2965)
at
com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:2936)
at
com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2848)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1019)
at
org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:908)
at org.apache.cxf.staxutils.StaxUtils.startElement(StaxUtils.java:826)
at
org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:868)
at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:755)
at
org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:217)
... 9 more