Results 1 to 2 of 2

Thread: WSDL while using JMS transport in Spring-ws

  1. #1
    Join Date
    Jun 2009
    Posts
    13

    Default WSDL while using JMS transport in Spring-ws

    Hi All,

    I am using JMS transport for my web service as shown in chapter 5 of Spring web services reference doc.

    My beans configuration is shown below (exactly as given in the reference doc)

    Now how can I get the WSDL with this configuration? Thanks!

    Code:
    <beans>
    
        <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
            <property name="brokerURL" value="vm://localhost?broker.persistent=false"/>
        </bean>
    
        <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"/>
    
        <bean class="org.springframework.jms.listener.DefaultMessageListenerContainer">
            <property name="connectionFactory" ref="connectionFactory"/>
            <property name="destinationName" value="RequestQueue"/>
            <property name="messageListener">
                <bean class="org.springframework.ws.transport.jms.WebServiceMessageListener">
                    <property name="messageFactory" ref="messageFactory"/>
                    <property name="messageReceiver" ref="messageDispatcher"/>
                </bean>
            </property>
        </bean>
    
        <bean id="messageDispatcher" class="org.springframework.ws.soap.server.SoapMessageDispatcher">
            <property name="endpointMappings">
                <bean
                  class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
                    <property name="defaultEndpoint">
                        <bean class="com.example.MyEndpoint"/>
                    </property>
                </bean>
            </property>
        </bean>
    </beans>

  2. #2

    Default WebServices over JMS port implementation

    Hi any update on this.

    We have implementing SOAP over JMS in webservices by using spring and weblogic as my application server. i have read some documents but not able to find correct solution for that, regarding how to add port in wsdl and how to invoke client from soap to point my JMS end point some thing like.
    am attaching sample code below.

    stream.wsdl
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <wsdl:definitions xmlns:ms="http://abc.com/streamservice/"
    	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    	xmlns:jms="http://schemas.xmlsoap.org/wsdl/jms/"
    	xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="streamservice"
    	targetNamespace="http://abc.com/streamservice/">
    	<wsdl:types>
    		<xsd:schema targetNamespace="http://abc.com/streamservice/" elementFormDefault="qualified">
          	 <xsd:element name="TransactionMessage">
                <xsd:complexType>
                      <xsd:sequence>
                            <xsd:element name="Operation" type="ms:OperationType" maxOccurs="1" minOccurs="1" />
                            <xsd:element name="TransactionKey" type="ms:TransactionKeyType" maxOccurs="1" minOccurs="1" />
                            <xsd:element name="Message" type="ms:MessageType" maxOccurs="1" minOccurs="1" />
                      </xsd:sequence>
                </xsd:complexType>
          </xsd:element>
          <xsd:simpleType name="OperationType">
                <xsd:restriction base="xsd:string">
                      <xsd:enumeration value="InsertTransaction"/>
                </xsd:restriction>
          </xsd:simpleType>
          <xsd:complexType name="TransactionKeyType">
                <xsd:sequence>
                <xsd:element name="sourceSystem" type="ms:string1_20" maxOccurs="1" minOccurs="1" />
                <xsd:element name="entity" type="ms:string1_20" maxOccurs="1" minOccurs="1" />
                <xsd:element name="transactionKey" type="ms:string1_100" maxOccurs="1" minOccurs="1" />
    	    <xsd:element name="instance" type="ms:string1_50" maxOccurs="1" minOccurs="0" />
    	    </xsd:sequence>
          </xsd:complexType>            
          <xsd:complexType name="MessageType">
                <xsd:choice>
                      <xsd:element name="Transaction" type="ms:TransactionType" />
                </xsd:choice>
          </xsd:complexType>
          <xsd:complexType name="TransactionType">
                <xsd:sequence>
                      <xsd:element name="TransactionDetail" type="ms:TransactionDetailType" maxOccurs="1" minOccurs="1" />
               </xsd:sequence>
          </xsd:complexType>
          <xsd:complexType name="TransactionDetailType">
                <xsd:sequence>
                      <xsd:element name="accountType" type="ms:string1_20" maxOccurs="1" minOccurs="1" />
                      <xsd:element name="accountAlias" type="ms:string1_20" maxOccurs="1" minOccurs="1" />
                </xsd:sequence>
          </xsd:complexType>
          <xsd:complexType name="Operation">
    			<xsd:choice>
    			<xsd:element name="TransactionOperation" type="ms:OperationType"/>
                </xsd:choice>
    	</xsd:complexType>
           <xsd:simpleType name="SuccessMessageType">
                <xsd:restriction base="xsd:string">
                      <xsd:enumeration value="SuccessfulInsert"/>
                      <xsd:enumeration value="SuccessfulUpdate"/>
                </xsd:restriction>
          </xsd:simpleType>
          <xsd:simpleType name="string0_1" >
                <xsd:restriction base="xsd:string">
                      <xsd:minLength value="0" />
                      <xsd:maxLength value="1" />
                </xsd:restriction>
          </xsd:simpleType>
            </xsd:schema>
    	</wsdl:types>
    	<wsdl:message name="TransactionMessage">
    		<wsdl:part element="ms:TransactionMessage" name="parameters" />
    	</wsdl:message>
        <wsdl:message name="SuccessMessage">
    		<wsdl:part element="ms:SuccessMessage" name="parameters" />
    	</wsdl:message>
    	<wsdl:message name="ErrorMessage">
    		<wsdl:part element="ms:ErrorMessage" name="parameters" />
    	</wsdl:message>
    	<wsdl:portType name="streamservice">
    		<wsdl:operation name="transactionrequest">
    			<wsdl:input message="ms:TransactionMessage" />
    		</wsdl:operation>
        </wsdl:portType>
        
    	<wsdl:binding name="streamserviceSOAP" type="ms:streamservice">
    		<soap:binding style="document"
    			transport="http://schemas.xmlsoap.org/soap/http" />
    		<wsdl:operation name="transactionrequest">
    			<soap:operation soapAction="http://abc.com/streamservice/transactionrequest" />
    			<wsdl:input>
    				<soap:body use="literal" />
    			</wsdl:input>
                <wsdl:output>
    				<soap:body use="literal" />
    			</wsdl:output>
            </wsdl:operation>
    		
        </wsdl:binding>
        
        <wsdl:binding name="streamservicesJMS" type="ms:streamservice">
    		<!-- <soap:binding style="document" transport="http://www.openuri.org/2002/04/soap/jms/" />-->
    		<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms/" />
    		<wsdl:operation name="transactionrequest">
    			<soap:operation soapAction=""/>
    			<wsdl:input>
    				<soap:body use="literal"/>
    			</wsdl:input>
                <wsdl:output>
    				<soap:body use="literal"/>
    			</wsdl:output>
            </wsdl:operation>
    		
        </wsdl:binding>
    	<wsdl:service name="streamservice">
    		<wsdl:port binding="ms:streamserviceSOAP" name="streamserviceSOAP">
    			<soap:address location="http://localhost:7010/StreamServices/streamrequest" />
    		</wsdl:port>
    	</wsdl:service>
    	<wsdl:service name="streamservicesJMS">
    		<wsdl:port binding="ms:streamservicesJMS" name="streamservicesJMS">
    			<soap:address location="jms://localhost:7010/StreamServices/streamrequest?URI=StreamQueue&amp;FACTORY=StreamJMSConnectionFactory"/>
    		</wsdl:port>
    	</wsdl:service>
    	
    </wsdl:definitions>

    application_context.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:aop="http://www.springframework.org/schema/aop"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:jee="http://www.springframework.org/schema/jee"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
            http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd">
    
    	<bean id="payloadMapping"
    		class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
    		<!--<property name="interceptors">
    			<ref local="wsSecurityInterceptor"/>
    		</property>-->
    		<property name="endpointMap">
    			<map>
    				<entry key="{http://abc.com/streamservice/}TransactionMessage"
    					value-ref="StreamRequestEndpoint"/>
    				<!--<entry key="{http://abc.com/streamservice/}AccountMessage"
    					value-ref="StreamRequestEndpoint"/>
    				-->
                </map>
    		</property>
    	</bean>
    	<bean id="messageDispatcher" class="org.springframework.ws.soap.server.SoapMessageDispatcher">
            <property name="endpointMappings" ref="payloadMapping"/>
        </bean>
    	
    
    	<bean id="jndiTemplate"
    		class="org.springframework.jndi.JndiTemplate">
    
    		<property name="environment">
    			<props>
    				<prop key="java.naming.factory.initial">
    					weblogic.jndi.WLInitialContextFactory
    				</prop>
    				<prop key="java.naming.provider.url">
                        t3://localhost:7010
                    </prop>
    				<prop key="java.naming.security.principal">
    					weblogic
                    </prop>
                    <prop key="java.naming.security.credentials">
    					weblogic
    				</prop>
    			</props>
    		</property>
    	</bean>
    
    	<bean id="StreamRequestEndpoint" class="com.ssp.streamservices.endpoint.StreamRequestEndpoint">
    		<property name="marshaller" ref="jaxbmarshaller" />
    		<property name="unmarshaller" ref="jaxbmarshaller" />
    		<property name="requestHandler" ref="streamservicerequesthandler" />
    		<property name="sourceApplication" value="Stream Services - Web Services" />
    	</bean>
    
    	<bean id="streamrequest"
    		class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
    		<property name="wsdl" value="/WEB-INF/stream.wsdl" />
    	</bean>
    
    
    	<bean id="jaxbmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    		<property name="schema" value="/WEB-INF/Stream_xsd.xsd" />
    		<property name="contextPath" value="com.ssp.streamservices.xmlobjects"/>	
    	</bean>
    	<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"/>
       
    	<bean class="org.springframework.jms.listener.DefaultMessageListenerContainer">
            <property name="connectionFactory" ref="connectionFactory"/>
            <property name="destinationName" value="StreamQueue"/>
            <property name="messageListener">
                <bean class="org.springframework.ws.transport.jms.WebServiceMessageListener">
                    <property name="messageFactory" ref="messageFactory"/>
                    <property name="messageReceiver" ref="messageDispatcher"/>
                </bean>
            </property>
        </bean>
    	<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiTemplate">
    			<ref bean="jndiTemplate" />
    		</property>
    		<property name="jndiName">
    			<value>StreamJMSConnectionFactory</value>
    		</property>
    	</bean>
    </beans>
    the application contxt file is specified in the web.xml as configuartion.

    can any body please suggest where am making mistake if it looks fine, any client code or steps related for how to call from soap ui to my JMS endpoint, becuase when i call my http webservices end point it works fine.

    Thanks,
    Gangadhar

Tags for this Thread

Posting Permissions

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