Announcement Announcement Module
Collapse
No announcement yet.
problem marshalling for a spring-ws client using WebServiceTemplate Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem marshalling for a spring-ws client using WebServiceTemplate

    I have a standalone (i.e. no app server) spring-ws 1.5.7 client-app that is sending document/literal soap request to a soap-service. Unfortunately, the xml being sent does not add the namespace prefixes correctly. If I run the same application from within my IDE the correct XML namespace prefixes are created.

    Valid XML generated from within the IDE:
    Code:
    SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header>
        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                       SOAP-ENV:mustUnderstand="1">
            <wsse:UsernameToken
                    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
                    wsu:Id="UsernameToken-12129794">
                <wsse:Username>anonymous</wsse:Username>
                <wsse:Password
                        Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">
                    nvhGyOO3/FcMpkVd18IJ+zH8yNc=
                </wsse:Password>
                <wsse:Nonce>g8jI68igM5OpNJxDW/aU0w==</wsse:Nonce>
                <wsu:Created>2009-08-07T19:14:31.799Z</wsu:Created>
            </wsse:UsernameToken>
        </wsse:Security>
        <nsh1:RequestHeader xmlns:nsh1="http://cithaeron.com/schemas">
            <nsh1:ipaddress>FIXME10.52.8.58</nsh1:ipaddress>
            <nsh1:serverId>FIXME10.52.8.58</nsh1:serverId>
            <nsh1:sessionId>test</nsh1:sessionId>
        </nsh1:RequestHeader>
    </SOAP-ENV:Header><SOAP-ENV:Body>
    <ns2:ListenerHeartbeatRequest xmlns:ns2="http://cithaeron.com/schemas">
        <ns2:destinationName>rtm</ns2:destinationName>
    </ns2:ListenerHeartbeatRequest>
    </SOAP-ENV:Body></SOAP-ENV:Envelope>
    Invalid XML generated when running at the command line:
    Code:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
        <SOAP-ENV:Header>
            <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                           SOAP-ENV:mustUnderstand="1">
                <wsse:UsernameToken
                        xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
                        wsu:Id="UsernameToken-14390689">
                    <wsse:Username>anonymous</wsse:Username>
                    <wsse:Password
                            Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">
                        svQFG8HNs+f7OxGIxZoo+9ZM6q0=
                    </wsse:Password>
                    <wsse:Nonce>4kvtV2kqv4yjCsJ4VHQNSg==</wsse:Nonce>
                    <wsu:Created>2009-08-07T19:15:32.190Z</wsu:Created>
                </wsse:UsernameToken>
            </wsse:Security>
            <nsh1:RequestHeader xmlns:nsh1="http://cithaeron.com/schemas">
                <nsh1:ipaddress>FIXME10.52.8.58</nsh1:ipaddress>
                <nsh1:serverId>FIXME10.52.8.58</nsh1:serverId>
                <nsh1:sessionId>test</nsh1:sessionId>
            </nsh1:RequestHeader>
        </SOAP-ENV:Header>
        <SOAP-ENV:Body>
            <ListenerHeartbeatRequest xmlns:ns3="http://cithaeron.com/schemas">
                <destinationName>rtm</destinationName>
            </ListenerHeartbeatRequest>
        </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    In the second piece of XML the ListenerHeartbeatRequest and it's child elements should be prefixed with ns3 but it doesn't.

    Here is my spring.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:oxm="http://www.springframework.org/schema/oxm"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                               http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd">
    
        <oxm:jaxb2-marshaller id="zeusSoapMarshaller" contextPath="com.cithaeron.jaxb.zeus.soap"/>
    
        <bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
            <property name="interceptors">
                <bean id="wss4j"
                      class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
                    <property name="securementActions" value="UsernameToken "/>
                    <property name="securementCallbackHandler">
                        <bean class="com.cithaeron.webclient.PwdCallbackHandler"/>
                    </property>
                </bean>
            </property>
            <property name="marshaller" ref="zeusSoapMarshaller"/>
            <property name="unmarshaller" ref="zeusSoapMarshaller"/>
        </bean>
    </beans>
    I'm using java version "1.6.0_11"
    spring 2.5.6
    spring-ws 1.5.7
    spring-security 2.0.5

  • #2
    Also when I run the stand-alone java app the following warning is seen in System.out

    Warning: The encoding 'utf-8' is not supported by the Java runtime.
    Warning: The encoding 'utf-8' is not supported by the Java runtime.

    Comment

    Working...
    X