On Fri December 4 2009 8:43:25 am Nathaniel Auvil wrote:
> ah...when i added a ?wsdl to the URL it worked.  Why does CXF need to parse
> the WSDL at runtime?  I have already generated my code.

That's pretty much what the JAX-WS spec requires.   There are things in the 
WSDL that are not completely represented in code.   The actual endpoint 
address is one of them.   Things like policies are another.

In MOST cases, you can pass null for the wsdl location and then do a 
service.createPort(...) call to create a port with your service URL and it 
will work fine.    For straight soap calls with nothing fancy, the generated 
code may be enough in that case.

Dan




> 
> On Fri, Dec 4, 2009 at 8:38 AM, Benson Margulies 
<[email protected]>wrote:
> > CXF is trying to dynamically take the WSDL from your service, and
> > something is coming back (perhaps an error page) that is not much like
> > a WSDL. If you manually grab the ?wsdl URL what do you see?
> >
> > On Fri, Dec 4, 2009 at 8:09 AM, Nathaniel Auvil
> >
> > <[email protected]> wrote:
> > > 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:9
> >3)
> >
> > >    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:9
> >1)
> >
> > >    ... 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:64
> > >8) at
> >
> > com.ctc.wstx.sr.BasicStreamReader.handleNsAttrs(BasicStreamReader.java:29
> >65)
> >
> > >    at
> >
> > com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:
> >2936)
> >
> > >    at
> >
> > com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:284
> >8)
> >
> > >    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
> 

-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to