Closed
Description
Michael Hausl opened SWS-230 and commented
I used the following configuration for accessing a web service:
<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServi ceTemplate">
<property name="defaultUri" value="http://anyURL"/>
<property name="marshaller" ref="castorMarshaller"/>
<property name="unmarshaller" ref="castorMarshaller"/>
</bean>
Due to the fact that the access occurs inside a JBoss running on JDK 1.5 I run into the problem that SAAJ is not available in the JDK and the JBoss version of the SAAJ-library led to SAAJ-version problems.
So I switched to Axiom using the following:
<bean id="axiom_MessageFactory" class="org.springframework.ws.soap.axiom.AxiomSoap MessageFactory">
<property name="payloadCaching" value="true"/>
</bean>
<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServi ceTemplate">
<constructor-arg ref="axiom_MessageFactory"/>
<property name="defaultUri" value="http://anyURI"/>
<property name="marshaller" ref="castorMarshaller"/>
<property name="unmarshaller" ref="castorMarshaller"/>
</bean>
I have to access the web service three times. The first and second call were successful. The third failed with:
Exception in thread "main" java.lang.NullPointerException
at org.springframework.xml.stream.AbstractStaxXmlRead er.parse(AbstractStaxXmlReader.java:70)
at org.springframework.xml.stream.AbstractStaxXmlRead er.parse(AbstractStaxXmlReader.java:50)
at org.springframework.oxm.castor.CastorMarshaller.un marshalSaxReader(CastorMarshaller.java:286)
at org.springframework.oxm.castor.CastorMarshaller.un marshalXmlStreamReader(CastorMarshaller.java:297)
at org.springframework.oxm.AbstractMarshaller.unmarsh alStaxSource(AbstractMarshaller.java:301)
at org.springframework.oxm.AbstractMarshaller.unmarsh al(AbstractMarshaller.java:125)
at org.springframework.ws.support.MarshallingUtils.un marshal(MarshallingUtils.java:65)
at org.springframework.ws.client.core.WebServiceTempl ate$2.extractData(WebServiceTemplate.java:275)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:416)
at org.springframework.ws.client.core.WebServiceTempl ate.marshalSendAndReceive(WebServiceTemplate.java: 264)
at org.springframework.ws.client.core.WebServiceTempl ate.marshalSendAndReceive(WebServiceTemplate.java: 252)
at org.springframework.ws.client.core.WebServiceTempl ate.marshalSendAndReceive(WebServiceTemplate.java: 244)
The NullPointerException does not help very much. But i switched the payloadCaching property to:
<property name="payloadCaching" value="false"/>
fixed it.
Affects: 1.0.2
Issue Links:
- NPE when unmarshalling invalid request with Jaxb1Marshaller [SWS-260] #417 NPE when unmarshalling invalid request with Jaxb1Marshaller
("is duplicated by") - Marshalling with Castor and Axiom results in a XMLStreamException [SWS-239] #391 Marshalling with Castor and Axiom results in a XMLStreamException