Team,

This is a messy issue--I don't know if this is best for cxf-user,
cxf-dev, or just issue tracker.  But I can chop this problem up as
necessary on multiple lists if need be.

Problem:  I wanted to write a blog entry showing how to generate a
client to access the eBay Shopping API WSDL with both Apache CXF and
GlassFish Metro, just to show how similar the two operate.
Unfortunately, I could only get it working with Metro.[1]

I have found that because CXF and Metro share the same JAXB library, the
code is almost the same--just part of the Ant build script needs
changing, from Metro's:

<path id="ws-stack.classpath">
   <pathelement location="${build.classes.dir}"/>
   <pathelement location="${env.AS_HOME}/lib/javaee.jar"/>
   <pathelement location="${env.AS_HOME}/lib/activation.jar"/>
   <pathelement location="${env.AS_HOME}/lib/webservices-rt.jar"/>
   <pathelement location="${env.AS_HOME}/lib/webservices-tools.jar"/>
</path>
        
<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
   <classpath refid="ws-stack.classpath"/>
</taskdef>
  
<target name="generateClientCode">
   <wsimport destdir="build/classes" sourcedestdir="src" 
      wsdl="ShoppingService.wsdl"/>
</target>

To CXF's:

<path id="ws-stack.classpath">
   <pathelement location="${build.classes.dir}"/>
   <fileset dir="${env.CXF_HOME}/lib">
      <include name="*.jar"/>
   </fileset>
</path>
        
<target name="generateClientCode">
   <java classname="org.apache.cxf.tools.wsdlto.WSDLToJava">
       <arg value="-client"/>
       <arg value="-d"/>
       <arg value="src"/>
       <arg value="ShoppingService.wsdl"/>
       <classpath>
          <path refid="ws-stack.classpath"/>
       </classpath>
   </java>
</target>

I ran into two problems though, one easily fixable, the other perhaps
not-so.

1.) As for the easy one:  My classpath above for CXF's WSDL2Java did not
work until I put xercesImpl.jar into the cxf/lib directory.  (WSDL2Java
fails with this error: Provider
org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not found)

Question:  Is there a reason why we are not including Xerces in the
cxf/lib directory?  We are including Xalan already, so perhaps we should
have both.  (Or is the problem with my classpath--with JDK 1.5, is there
a common way to include Xerces automatically, without needing it in the
lib/ directory?)  I would like us to be able to provide a definitive way
of running WSDLToJava without requiring the user to separately download
Xerces.

2.)  This is the more complex issue, perhaps best for cxf-user or JIRA.
After copying the Xerces library in, WSDL2Java runs and compiles, but
the run task:

<target name="run">
    <java classname="client.ShoppingClient" fork="yes">         
       <!-- argument below is item to search for -->
       <arg value="camera"/>
       <classpath>
          <path refid="ws-stack.classpath"/>
       </classpath>
    </java>
</target>

produces this error "Unexpected character '"' (code 34) in DOCTYPE
declaration; expected a space between public and system identifiers":

     [java] INFO: Bean factory for application context
[EMAIL PROTECTED]:
[EMAIL PROTECTED]
     [java] 18.08.2007 14:14:15
org.springframework.context.support.AbstractApplicationContext
$BeanPostProcessorChecker postProcessAfterInitialization
     [java] INFO: Bean
'org.apache.cxf.bus.spring.Jsr250BeanPostProcessor' is not eligible for
getting processed by all BeanPostProcessors (for example: not eligible
for auto-proxying)
     [java] 18.08.2007 14:14:15
org.springframework.context.support.AbstractApplicationContext
$BeanPostProcessorChecker postProcessAfterInitialization
     [java] INFO: Bean 'cxf' is not eligible for getting processed by
all BeanPostProcessors (for example: not eligible for auto-proxying)
     [java] 18.08.2007 14:14:15
org.springframework.context.support.AbstractApplicationContext
$BeanPostProcessorChecker postProcessAfterInitialization
     [java] INFO: Bean
'org.apache.cxf.bus.spring.BusExtensionPostProcessor' is not eligible
for getting processed by all BeanPostProcessors (for example: not
eligible for auto-proxying)
     [java] 18.08.2007 14:14:15
org.springframework.beans.factory.support.DefaultListableBeanFactory
preInstantiateSingletons
     [java] INFO: Pre-instantiating singletons in
[EMAIL PROTECTED]: defining beans 
[cxf,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.binding.xml.XMLBindingFactory,org.apache.cxf.binding.object.ObjectBindingFactory,org.apache.cxf.transport.local.LocalTransportFactory,org.apache.cxf.binding.http.HttpBindingFactory,org.apache.cxf.ws.rm.RMManager,org.apache.cxf.ws.rm.policy.RMPolicyInterceptorProvider,org.apache.cxf.ws.rm.RMAssertionBuilder,org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder,org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider,org.apache.cxf.ws.addressing.policy.UsingAddressingAssertionBuilder,org.apache.cxf.transport.jms.JMSTransportFactory,org.apache.cxf.management.jmx.InstrumentationManagerImpl,org.apache.cxf.ws.policy.AssertionBuilderRegistry,org.apache.cxf.ws.policy.PolicyConstants,org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry,org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilderRegistry,org.apache.cxf.ws.policy.attachment.external.EndpointReferenceDomainExpressionBuilder,org.apache.cxf.ws.policy.PolicyBuilder,org.apache.cxf.ws.policy.PolicyEngine,org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider,org.apache.cxf.ws.policy.attachment.ServiceModelPolicyProvider,org.apache.cxf.ws.policy.mtom.MTOMAssertionBuilder,org.apache.cxf.ws.policy.mtom.MTOMPolicyInterceptorProvider,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder,org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory];
 root of factory hierarchy
     [java] 18.08.2007 14:14:17
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
     [java] INFO: Creating Service
{urn:ebay:apis:eBLBaseComponents}Shopping from WSDL:
file:ShoppingService.wsdl
     [java] 18.08.2007 14:14:20
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
     [java] INFO: Interceptor has thrown exception, unwinding now
     [java] org.apache.cxf.binding.soap.SoapFault: Error reading
XMLStreamReader.
     [java]     at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:189)
     [java]     at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:57)
     [java]     at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
     [java]     at
org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:395)
     [java]     at org.apache.cxf.transport.http.HTTPConduit
$WrappedOutputStream.handleResponse(HTTPConduit.java:1959)
     [java]     at org.apache.cxf.transport.http.HTTPConduit
$WrappedOutputStream.close(HTTPConduit.java:1806)
     [java]     at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
     [java]     at
org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:574)
     [java]     at org.apache.cxf.interceptor.MessageSenderInterceptor
$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
     [java]     at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
     [java]     at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
     [java]     at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)
     [java]     at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
     [java]     at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
     [java]     at $Proxy33.findItems(Unknown Source)
     [java]     at client.ShoppingClient.main(ShoppingClient.java:40)
     [java] Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException:
Unexpected character '"' (code 34) in DOCTYPE declaration; expected a
space between public and system identifiers
     [java]  at [row,col {unknown-source}]: [1,50]
     [java]     at
com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:623)
     [java]     at
com.ctc.wstx.sr.BasicStreamReader.startDTD(BasicStreamReader.java:2482)
     [java]     at
com.ctc.wstx.sr.BasicStreamReader.nextFromPrologBang(BasicStreamReader.java:2398)
     [java]     at
com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2058)
     [java]     at
com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
     [java]     at
com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1095)
     [java]     at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:87)
     [java]     ... 15 more
     [java] Exception: Error reading XMLStreamReader.

Has anyone seen this type of error message before?  If not obvious, I
can just dump this problem into Issue Tracker, and perhaps even start
looking myself for its solution.

Regards,
Glen

[1] http://www.jroller.com/gmazza/entry/using_the_ebay_shopping_api1


Reply via email to