Announcement Announcement Module
No announcement yet.
Adding xml declaration to a response Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding xml declaration to a response

    I have several issues with the responses sent back by Spring WS to my client. It's a J2ME JSR172 client and it seems to have a hard time parsing the response message ("Missing end tag for SOAP body or enveloper"). One of the differences between the response sent by Spring WS and the request sent by my mobile client is that there is no xml declaration in the response, something like:
    <?xml version="1.0" encoding="UTF-8"?>
    Knowing that I'm using the following configuration, what should I add to include such a declaration in my response messages?

    <beans xmlns="" xmlns:xsi=""
        <!-- SOAP Message Factory -->
        <bean id="messageFactory" class="">
            <property name="messageFactory">
                <bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"></bean>
    <!-- Marshalling -->
        <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
            <property name="contextPath" value="org.epseelon.tagspot.schemas"/>
            <property name="marshallerProperties">
                    <entry key="jaxb.formatted.output">
                        <value type="boolean">true</value>

  • #2
    Writing the response is delegated to SAAJ, and there is no way to enforce an XML declaration AFAIK.

    To me, it seems unlikely that the XML declaration is the problem, but I could be wrong. You could use a tool such as tcpmon to monitor the incoming and outgoing messages.


    • #3
      I'm doing just that. Well I'm not using tcpmon but something lower level: etherreal.
      And the only other hypothesis I have for now is that the only line containing the SOAP envelope is too long and Nokia's XML parser trims it in some way. That's why I would like to format the response.

      I've seen somewhere that it could be related to the parser not supporting the empty <SoapHeader/> element, but I don't know. And since it's proprietary code and I don't have the possibility to debug it, I'm stuck making assumptions and trying to eliminate them...