Results 1 to 5 of 5

Thread: Possible error in CastorMarshaller

  1. #1
    Join Date
    Sep 2006
    Posts
    3

    Default Possible error in CastorMarshaller

    Hi all,

    I've created an client that uses the CastorMarshaller transform my domain model into a soap message and vise versa. But when I wire it all together I get this error

    Code:
    java.io.IOException: Stream closed
    	at java.io.BufferedInputStream.ensureOpen(BufferedInputStream.java:120)
    	at java.io.BufferedInputStream.read(BufferedInputStream.java:199)
    	at org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(XMLEntityManager.java:3358)
    	at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:807)
    	at org.apache.xerces.impl.XMLEntityManager.startDocumentEntity(XMLEntityManager.java:741)
    	at org.apache.xerces.impl.XMLDocumentScannerImpl.setInputSource(XMLDocumentScannerImpl.java:260)
    	at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:498)
    	at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:580)
    	at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
    	at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1169)
    	at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:741)
    	at org.castor.mapping.MappingUnmarshaller.loadMappingInternal(MappingUnmarshaller.java:202)
    	at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:124)
    	at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:99)
    	at org.exolab.castor.xml.Unmarshaller.setMapping(Unmarshaller.java:487)
    	at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:252)
    	at org.springframework.oxm.castor.CastorMarshaller.afterPropertiesSet(CastorMarshaller.java:141)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:957)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:924)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:415)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:242)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:239)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:155)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:246)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:850)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:624)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:411)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:242)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:239)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:155)
    	at org.springframework.aop.framework.ProxyFactoryBean.initializeAdvisorChain(ProxyFactoryBean.java:438)
    	at org.springframework.aop.framework.ProxyFactoryBean.getObject(ProxyFactoryBean.java:251)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectFromFactoryBean(AbstractBeanFactory.java:935)
    my application context looks like this:
    Code:
    	<bean id="aasWebServiceSoap" class="org.springframework.aop.framework.ProxyFactoryBean">
    		<property name="proxyInterfaces">
    			<value>nl.anwb.aas.AASWebServiceSoap</value>
    		</property>
    		<property name="interceptorNames">
    			<list>
    				<value>soapInterceptor</value>
    			</list>
    		</property>
    	</bean>
    
    	<bean id="soapInterceptor" class="nl.anwb.autoportaal.service.SoapInterceptor">
    		<property name="marshaller" ref="castorMarshaller" />
    		<property name="unmarshaller" ref="castorMarshaller" />
    		<property name="url" value="http://localhost:8080/WebServiceProject/services/AASWebServiceSoap"/>
    	</bean>
    
    	<bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller" >
            <property name="mappingLocation" value="classpath:/castor-mapping.xml" />
        </bean>
    I've tried this with spring-omx-m2 and with the latested version from subversion but both give the same error. Does anyone have a clue?

    Thanks.
    Erik Jan

  2. #2
    Join Date
    Sep 2006
    Posts
    3

    Default

    After some google-ing found this castor issue so apperently what is done in the CastorMarshaller is not good when you want to cache the mapping file is this a bug?

  3. #3
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Quote Originally Posted by erikjan View Post
    Hi all,

    I've created an client that uses the CastorMarshaller transform my domain model into a soap message and vise versa.
    Just a note: transforming your domain model to be used in web services is generally not a good idea. By doing that, you are basically making your internal classes part of a public API, and the clients of your web service will not be happy to when you change them.

    I will investigate the bug further, thanks for submitting the JIRA issue!
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  4. #4
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    The issue has been resolved. Let me know how it works for you.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  5. #5
    Join Date
    Sep 2006
    Posts
    3

    Default Works!

    Works great thanks a lot.

    Quote Originally Posted by poutsma View Post
    Just a note: transforming your domain model to be used in web services is generally not a good idea. By doing that, you are basically making your internal classes part of a public API, and the clients of your web service will not be happy to when you change them.
    What mean is that I take the xml from the third party saop message and transform it to my own domain model. For the client of my service it's transparant that it was a soap call because it will receive domain model objects just as it did when it called a service that used a datbase to retreive the data.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •