Results 1 to 3 of 3

Thread: Adding xml declaration to a response

  1. #1
    Join Date
    Apr 2005
    Location
    Brussels, Belgium
    Posts
    100

    Default 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:
    Code:
    <?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?

    Code:
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    
        <!-- SOAP Message Factory -->
        <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
            <property name="messageFactory">
                <bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"></bean>
            </property>
        </bean>
    
    <!-- Marshalling -->
        <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
            <property name="contextPath" value="org.epseelon.tagspot.schemas"/>
            <property name="marshallerProperties">
                <map>
                    <entry key="jaxb.formatted.output">
                        <value type="boolean">true</value>
                    </entry>
                </map>
            </property>
        </bean>
    <!--...-->
    </beans>
    Sebastien Arbogast

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

    Default

    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.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  3. #3
    Join Date
    Apr 2005
    Location
    Brussels, Belgium
    Posts
    100

    Default

    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...
    Sebastien Arbogast

Posting Permissions

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