Hi Grzegorz,
Thanks for the offer 
As a bit of background: I'm experimenting with Spring WS to send user id and receive other credentials back.
I'm getting this exception, actual request triggering it is included:
Code:
2010-10-08 22:38:24,169 DEBUG [org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter] - Accepting incoming [org.springframework.ws.transport.http.HttpServletConnection@299481b2] to [http://localhost:8080/FrontEndServices/credentialservices]
2010-10-08 22:38:24,172 DEBUG [org.springframework.ws.server.MessageTracing.received] - Received request [SaajSoapMessage {http://www.test.com/ws/domain/credential}UserCredentialsRequest]
2010-10-08 22:38:24,172 DEBUG [org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping] - Looking up endpoint for [{http://www.test.com/ws/domain/credential}UserCredentialsRequest]
2010-10-08 22:38:24,172 DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] - Endpoint mapping [org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping@4e84f566] maps request to endpoint [com.test.ws.endpoint.credential.UserCredentialsEndpoint@10ea443f]
2010-10-08 22:38:24,173 DEBUG [org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor] - Request: <cred:UserCredentialsRequest xmlns:cred="http://www.test.com/ws/domain/credential">
<cred:UserIdentification>
<!--You may enter the following 2 items in any order-->
<cred:UserId>John</cred:UserId>
<cred:Password>mypassword</cred:Password>
</cred:UserIdentification>
</cred:UserCredentialsRequest>
2010-10-08 22:38:24,174 DEBUG [org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor] - Request message validated
2010-10-08 22:38:24,174 DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] - Testing endpoint adapter [org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter@51f88fbd]
2010-10-08 22:38:24,174 DEBUG [org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver] - Resolving exception from endpoint [com.test.ws.endpoint.credential.UserCredentialsEndpoint@10ea443f]: org.springframework.oxm.jaxb.JaxbUnmarshallingFailureException: JAXB unmarshalling exception: unexpected element (uri:"http://www.test.com/ws/domain/credential", local:"UserCredentialsRequest"). Expected elements are <{}UserCredentials>,<{}UserCredentialsRequest>,<{}UserCredentialsResponse>,<{}UserIdentification>; nested exception is javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.test.com/ws/domain/credential", local:"UserCredentialsRequest"). Expected elements are <{}UserCredentials>,<{}UserCredentialsRequest>,<{}UserCredentialsResponse>,<{}UserIdentification>
2010-10-08 22:38:24,174 DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] - Endpoint invocation resulted in exception - responding with Fault
org.springframework.oxm.jaxb.JaxbUnmarshallingFailureException: JAXB unmarshalling exception: unexpected element (uri:"http://www.test.com/ws/domain/credential", local:"UserCredentialsRequest"). Expected elements are <{}UserCredentials>,<{}UserCredentialsRequest>,<{}UserCredentialsResponse>,<{}UserIdentification>; nested exception is javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.test.com/ws/domain/credential", local:"UserCredentialsRequest"). Expected elements are <{}UserCredentials>,<{}UserCredentialsRequest>,<{}UserCredentialsResponse>,<{}UserIdentification>
The xsd is the following:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.test.com/ws/domain/credential" xmlns:crd="http://www.test.com/ws/domain/credential"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="2.0"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jxb:extensionBindingPrefixes="xjc" elementFormDefault="qualified">
<xs:element name="UserCredentials">
<xs:complexType>
<xs:all>
<xs:element name="UserId" type="xs:long" />
<xs:element name="Password" type="xs:string" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="UserIdentification">
<xs:complexType>
<xs:all>
<xs:element name="UserId" type="xs:string" />
<xs:element name="Password" type="xs:string" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="UserCredentialsRequest">
<xs:complexType>
<xs:all>
<xs:element ref="crd:UserIdentification" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="UserCredentialsResponse">
<xs:complexType>
<xs:all>
<xs:element ref="crd:UserCredentials" />
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Java classes are generated from this xsd using ObjectFactory is present; and package-info class contains annotation to bind to namespace:
Code:
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.test.com/ws/domain/credential", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
All generated classes have proper annotations, e.g. for the UserCredentials class:
Code:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
})
@XmlRootElement(name = "UserCredentials")
And 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-2.5.xsd
http://www.springframework.org/schema/oxm
http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd">
<bean id="credentialService" class="com.test.ws.service.credential.CredentialServiceImpl"
init-method="initialize" />
<bean id="Credential"
class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
<property name="schema" ref="schema" />
<property name="portTypeName" value="Credential" />
<property name="locationUri" value="/credentialservices" />
<property name="targetNamespace" value="http://www.test.com/ws/domain/credential" />
</bean>
<bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema">
<property name="xsd" value="/WEB-INF/credential.xsd" />
</bean>
<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="contextPaths">
<list>
<value>com.test.ws.domain.credential</value>
</list>
</property>
</bean>
<bean id="unmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name = "contextPaths">
<list>
<value>com.test.ws.domain.credential</value>
</list>
</property>
</bean>
<bean id="userCredentialsEndpoint" class="com.test.ws.endpoint.credential.UserCredentialsEndpoint"
autowire="byName" />
<bean id="validatingInterceptor"
class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
<property name="xsdSchema" ref="schema" />
<property name="validateRequest" value="true" />
<property name="validateResponse" value="true" />
</bean>
<bean id="loggingInterceptor"
class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor" />
<bean name="endpointMapping"
class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
<property name="interceptors">
<list>
<ref local="loggingInterceptor" />
<ref local="validatingInterceptor" />
</list>
</property>
<property name="mappings">
<props>
<prop key="{http://www.test.com/ws/domain/credential}UserCredentialsRequest">userCredentialsEndpoint</prop>
</props>
</property>
</bean>
<bean id="exceptionResolver"
class="org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver">
<property name="defaultFault" value="SERVER" />
<property name="exceptionMappings">
<props>
<prop key="org.springframework.oxm.ValidationFailureException">CLIENT,Invalid request</prop>
<prop key="com.test.ws.service.credential.CredentialException">SERVER</prop>
</props>
</property>
</bean>
</beans>
All pointers appreciated...
Thanks
Frederik