thanks robertoschwald,
Actually I am new to spring framework, I tried to understand the Airline sample code but not able to figure it out much. It include many other stuff as well.
My actual problem is :
I have created two different web services (project) for handling multiple request that is:
project1 having wsdl1, sprind-ws-1.xml, req-res1.xsd
and
project2 having wsdl2, sprind-ws-2.xml, req-res2.xsd
both are working fine but now i need to merge them in a single web project so that i can have only single war to deploy.
For that I tried to use PayloadRootAnnotationMethodEndpointMapping after goiing through chapter5, airline sampple and yours current post but getting the NoSuchMethodError.
Following is my current code:
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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<description>
This web application context contains Spring-WS beans. The beans defined in this context are automatically
detected by Spring-WS, similar to the way Controllers are picked up in Spring Web MVC.
</description>
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping"/>
<bean id="orderEndpoint" class="com.mycompany.prod.ws.rfmscores.ws.AnnotationOrderEndpoint">
<constructor-arg ref="rfmScoreService"/>
</bean>
<bean id="xmlBeansMarshaller" class="org.springframework.oxm.xmlbeans.XmlBeansMarshaller" />
<bean id="validatingInterceptor"
class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
<description>
This interceptor validates both incoming and outgoing message contents according to the 'rfmscores.xsd' XML
Schema file.
</description>
<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">
<description>
This interceptor logs the message payload.
</description>
</bean>
<bean id="rfmscores" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
<description>
This bean definition represents a WSDL definition that is generated at runtime. It can be retrieved by
going to /prodservices/rfmscores.wsdl (i.e. the bean name corresponds to the filename).
</description>
<property name="schema" ref="schema"/>
<property name="portTypeName" value="RFMscore"/>
<property name="locationUri" value="http://localhost:8080/mycompany-prod-rfm-ws/rfmscores"/>
<property name="targetNamespace" value="http://prod.mycompany.com/rfm/rfmscores"/>
</bean>
<bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema">
<description>
This bean definition contains the XSD schema.
</description>
<property name="xsd" value="/WEB-INF/rfmscores.xsd"/>
</bean>
<bean id="rfmScoreService" class="com.mycompany.prod.ws.rfmscores.services.RFMScoreServiceImpl">
<description>
This bean is our "business" service.
</description>
</bean>
</beans>
Code:
package com.mycompany.prod.ws.rfmscores.ws;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import com.mycompany.prod.ws.rfmscores.services.RFMScoreService;
@Endpoint
public class AnnotationOrderEndpoint {
/**
* Instance of RFMService
*/
private RFMScoreService rfmService;
public AnnotationOrderEndpoint(RFMScoreService rfmService) {
this.rfmService = rfmService;
}
@PayloadRoot(localPart = "RFMScoresRequest", namespace = "http://prod.mycompany.com/rfm/rfmscores")
public void rfmScoresRequest(Object order) {
System.out.println("Inside method2 222222222222");
}
}
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://prod.mycompany.com/rfm/rfmscores" xmlns:tns="http://prod.mycompany.com/rfm/rfmscores" xmlns="http://prod.mycompany.com/rfm/rfmscores" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="RFMScoresRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="userID" type="xs:string" minOccurs="1" />
<xs:element name="userType" type="xs:string" minOccurs="1" />
<xs:element name="channelID" minOccurs="1" >
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="1|2|3|ALL"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="scoreType" minOccurs="1" >
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="R|F|M|PR|PF|RFM|ALL"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="RFMScoresResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="channelID" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0" />
<xs:element name="scores" minOccurs="0" >
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="type" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I tried many things but still stuck with this multiple request and response. I would be very grateful if you helped me out
Thanks in advance