You can only have one "primary" NS in an XMLSchema based document, in your
case, it would be the Spring beans NS, I believe. So, if you want to use the
NS for XFire, you would need to do something like xf:xfire xmlns:xf="..." -
that's assuming that this is how the XFire stuff was meant to be used in the
Spring 2.0.2 env (haven't used it yet, so don't know). Pre-Spring 2.0.2, you
needed to use xbean, which made the xfire tags 'first-class' in the XML
document, and the Spring beans syntax was included as a separate NS.

Hope this helps.

Cheers,
Brice

On 1/16/07, Phil Bowker <[EMAIL PROTECTED]> wrote:

I would like to create a WS using JMS transport in a Spring 2.0.2environment. I 
have followed the example in the User Guide but I get an
exception when reading the services.xml file. The XML tag <xfire> is not
understood by Spring. Below is the exception:


org.springframework.beans.factory.BeanDefinitionStoreException: Line 9 in
XML document from class path resource [META-INF/xfire/services.xml] is
invalid; nested exception is org.xml.sax.SAXParseException:
cvc-complex-type.2.4.c : The matching wildcard is strict, but no
declaration can be found for element 'xfire'.
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The
matching wildcard is strict, but no declaration can be found for element
'xfire'.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at
org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown
Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError (Unknown
Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown 
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse (Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at
org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(
DefaultDocumentLoader.java:77)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(
XmlBeanDefinitionReader.java:405)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions
(XmlBeanDefinitionReader.java:357)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(
XmlBeanDefinitionReader.java:334)
at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions
(AbstractBeanDefinitionReader.java:126)
at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(
AbstractBeanDefinitionReader.java:142)
at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions
(AbstractBeanDefinitionReader.java:168)
at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(
AbstractXmlApplicationContext.java:113)
at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions
(AbstractXmlApplicationContext.java:79)
at
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(
AbstractRefreshableApplicationContext.java:94)
at org.springframework.context.support.AbstractApplicationContext.refresh(
AbstractApplicationContext.java:292)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(
ClassPathXmlApplicationContext.java:92)
at org.springframework.context.support.ClassPathXmlApplicationContext
.<init>(ClassPathXmlApplicationContext.java:77)
at com.mach.fcmoon.batch.xfiretest.jms.DataLoadJmsTest.createContext (
DataLoadJmsTest.java:21)
at org.codehaus.xfire.spring.AbstractXFireSpringTest.setUp(
AbstractXFireSpringTest.java:22)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect (TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest (TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(
JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run (
TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(
RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
RemoteTestRunner.java:196)



The exception refers to this services.xml:

1<?xml version="1.0" encoding="UTF-8"?>
2
3<beans xmlns="http://www.springframework.org/schema/beans";
<http://www.springframework.org/schema/beans%22>;
4      
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";<http://www.w3.org/2001/XMLSchema-instance%22>;

5    xsi:schemaLocation=" http://www.springframework.org/schema/beans
6               http://www.springframework.org/schema/beans/spring-beans.xsd";
<http://www.springframework.org/schema/beans/spring-beans.xsd%22>;>
7
8
9<xfire 
xmlns="http://xfire.codehaus.org/config/1.0";<http://xfire.codehaus.org/config/1.0%22>
;>
  <transports>
   <bean id="jmsTransport"
      class="org.codehaus.xfire.transport.jms.JMSTransport"
      
xmlns="http://xbean.org/schemas/spring/1.0";<http://xbean.org/schemas/spring/1.0%22>
;>
    <constructor-arg ref="xfire"/>
    <constructor-arg ref="jmsConnectionFactory"/>
   </bean>
  </transports>
</xfire>

  <service xmlns=" 
http://xfire.codehaus.org/config/1.0";<http://xfire.codehaus.org/config/1.0%22>
;>
    <serviceClass>com.mach.project.service.IMyService</serviceClass>
    
<wsdlURL>file:/D:/eclipse/workspaces/ws_test/wsdl/me.com.myproject.MyService.Service.wsdl</wsdlURL>

    <serviceFactory>org.codehaus.xfire.jaxb2.JaxbServiceFactory
</serviceFactory>
    <bindings>
     <soap11binding name="e:MyServiceJmsBinding"
transport="urn:xfire:transport:jms">
      <endpoints>
       <endpoint name="e:MyServiceJmsEndPoint" url="jms://MY_QUEUE"/>
      </endpoints>
     </soap11binding>
    </bindings>
  </service>

  <bean id="connectionFactory"
     class="org.apache.activemq.ActiveMQConnectionFactory"
     singleton="true"
     xmlns=" 
http://xbean.org/schemas/spring/1.0/";<http://xbean.org/schemas/spring/1.0/%22>
;>
   <constructor-arg value="vm://localhost?broker.persistent=false" type="
java.lang.String"/>
  </bean>

</beans>


My test client looks like this:

public class MyServiceJmsTest extends AbstractXFireSpringTest {
@Override
protected ApplicationContext createContext() {
  return new ClassPathXmlApplicationContext(
    new String[] {
      "/META-INF/xfire/services.xml",
      "/org/codehaus/xfire/spring/xfire.xml"
    });
}

public void testClient() throws Exception {
  ObjectServiceFactory sf = new
ObjectServiceFactory(getTransportManager());
  sf.addSoap11Transport(JMSTransport.BINDING_ID);

  Service serviceModel = sf.create(IMyService.class);
  XFireProxyFactory pf = new XFireProxyFactory(getXFire());
  IMyService myService = (IMyService) pf.create(serviceModel,
"jms://MY_QUEUE");

  ((XFireProxy) Proxy.getInvocationHandler
(myService)).getClient().setEndpointUri("jms://Peer1");

  String result = myService.execute("A task");
  assertEquals(result, "A task");
}
}



I'm using XFire 1.2.4, Spring 2.0.2 and will hopefully connect to ActiveMQ
4.0.1.

I suspect this is a spring configuration issue, but I wonder if someone
here has perhaps done this before and could help?

Many thanks,

Phil Bowker




____________________________________________________________________________________
Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather




--
Brice Ruth
Software Engineer, Madison WI

Reply via email to