Announcement Announcement Module
Collapse
No announcement yet.
Multiple service in single war Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple service in single war

    Hi,

    I have created two web projects each having the services:
    say
    project1 having the following:
    my-ws-servlet1.xml
    pj1.wsdl
    pj1.xsd
    project1Endpoint

    and

    project2 having the following:
    my-ws-servlet2.xml
    pj2.wsdl
    pj2.xsd
    project2Endpoint

    and wanted to merge these two so that I can have only one war to deploy.

    I searched this forum and gone through chapter 5 and found that I need to use Annotation for that but not sure how to use that.
    what changes should I make to the my-ws-servlet.xml to have single Endpoint controller.

    my-ws-servlet1.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"
           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 id="payloadMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
            <description>
                This endpoint mapping uses the qualified name of the payload (body contents) to determine the endpoint for
                an incoming message. Every message is passed to the default endpoint. Additionally, messages are logged
                using the logging interceptor.
            </description>
            <property name="defaultEndpoint" ref="customerEndpoint"/>
            <property name="interceptors">
                <list>
                    <ref local="validatingInterceptor"/>
                    <ref local="loggingInterceptor"/>
                </list>
            </property>
        </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 'customer.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="customerEndpoint" class="com.crossview.cia.ws.customer.segment.ws.CustomerProfileEndpoint">
            <description>
                This endpoint handles Customer Profile requests.
            </description>
    	       <constructor-arg ref="xmlBeansMarshaller"/>
               <constructor-arg ref="customerService"/>
        </bean>
    
    <!--
        <bean id="customer" 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 /ciaservices/customer.wsdl (i.e. the bean name corresponds to the filename).
            </description>
            <property name="schema" ref="schema"/>
            <property name="portTypeName" value="Customer"/>
            <property name="locationUri" value="http://localhost:8080/ciaservices/customer"/>
            <property name="targetNamespace" value="http://cia.crossview.com/customer/customersegments"/>
        </bean>
    -->
    	<bean id="customer" class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
    	    <constructor-arg value="/WEB-INF/customer.wsdl"/>
    	</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/customer.xsd"/>
        </bean>
    
        <bean id="customerService" class="com.crossview.cia.ws.customer.services.CustomerProfileServiceImpl">
            <description>
                This bean is our "business" service.
            </description>
        </bean>
    
    </beans>
    my-ws-servlet2.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"
           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 id="payloadMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
            <description>
                This endpoint mapping uses the qualified name of the payload (body contents) to determine the endpoint for
                an incoming message. Every message is passed to the default endpoint. Additionally, messages are logged
                using the logging interceptor.
            </description>
            <property name="defaultEndpoint" ref="rfmScoreEndpoint"/>
            <property name="interceptors">
                <list>
                    <ref local="validatingInterceptor"/>
                    <ref local="loggingInterceptor"/>
                </list>
            </property>
        </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="rfmScoreEndpoint" class="com.crossview.cia.ws.rfmscores.ws.RFMScoreEndpoint">
            <description>
                This endpoint handles RFM scores.
            </description>
    	       <constructor-arg ref="xmlBeansMarshaller"/>
               <constructor-arg ref="rfmScoreService"/>
        </bean>
    
    
    	<!--<bean id="rfmscores" class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
    	    <constructor-arg value="/WEB-INF/rfmscores.wsdl"/>
    	</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 /ciaservices/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/crossview-cia-rfm-ws/rfmscores"/>
            <property name="targetNamespace" value="http://cia.crossview.com/rfm/frmscores"/>
        </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.crossview.cia.ws.rfmscores.services.RFMScoreServiceImpl">
            <description>
                This bean is our "business" service.
            </description>
        </bean>
    
    </beans>
    thanks
Working...
X