Announcement Announcement Module
Collapse
No announcement yet.
Asnychronous service with Spring & Xfire Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Asnychronous service with Spring & Xfire

    Has anyone tried creating an Asynchronous web service using Spring and Xfire?

    I'm new to web services and was able to get a synchronous version of the webservice running fairly quickly. I followed the documentation from Spring and Xfire but I can't get the wsa headers to be generated with my wsdl.

    I've tried Axis2 and I don't really care for how webservices are deployed and I favor the Xfire way of just deploying a war and the close integration with Spring.

    If anyone has tried this before with Xfire or can offer some advice I'd really appriciate it.

    Spring Configuration File:
    Code:
    <bean id="exceptionService" class="org.codehaus.xfire.spring.remoting.XFireExporter">
        <property name="serviceFactory">
            <ref bean="serviceFactory"/>
        </property>
        <property name="xfire">
            <ref bean="xfire"/>
        </property>
        <property name="serviceBean">
            <ref bean="exceptionBean"/>
        </property>
        <property name="serviceClass">
            <value>com.liquid.kyoto.service.ExceptionService</value>
        </property>
        <property name="inHandlers">
                    <list>
                            <ref bean="addressingInHandler"/>
                    </list>
            </property>
        <property name="outHandlers">
                    <list>
                            <ref bean="addressingOutHandler"/>
                    </list>
            </property>  
    </bean>
    
    <bean id="addressingInHandler" class="org.codehaus.xfire.addressing.AddressingInHandler"/>
    <bean id="addressingOutHandler" class="org.codehaus.xfire.addressing.AddressingOutHandler"/>
    
    <bean id="serviceFactory" class="com.liquid.kyoto.service.factory.ServiceFactory" singleton="true">
        <constructor-arg index="0">
          <ref bean="xfire.transportManager" />
        </constructor-arg>
        <constructor-arg index="1">
          <ref bean="xfire.aegisBindingProvider" />
        </constructor-arg>
    </bean>
    
    
    <bean name="exceptionBean" class="com.liquid.kyoto.service.impl.ExceptionServiceImpl"/>
    My custom service factory:
    Code:
    public class ServiceFactory extends ObjectServiceFactory {
    
        public ServiceFactory(TransportManager tm, BindingProvider bp) {        
            super(tm, bp);
        }
    
        /* (non-Javadoc)
         * @see org.codehaus.xfire.service.binding.ObjectServiceFactory#getAction(org.codehaus.xfire.service.OperationInfo)
         */
        @Override
        protected String getAction(OperationInfo op) {
            return "http://10.0.2.33:8080/kyoto/ExceptionService/Invoke";
        }
    }
    And my Implementation of my service:
    Code:
    public class ExceptionServiceImpl implements ExceptionService {
    
        public String testExceptionOne(String test) {
            return "Pass";
        }
    
    }
    And my wsdl:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding" xmlns:tns="http://service.kyoto.liquid.com" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://service.kyoto.liquid.com">
      <wsdl:types>
        <xsd:schema targetNamespace="http://service.kyoto.liquid.com" elementFormDefault="qualified" attributeFormDefault="qualified">
          <xsd:element name="testExceptionOne">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="in0" type="xsd:string" nillable="true" minOccurs="1" maxOccurs="1" />
              </xsd:sequence>
            </xsd:complexType>
    
          </xsd:element>
          <xsd:element name="testExceptionOneResponse">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="out" type="xsd:string" nillable="true" minOccurs="1" maxOccurs="1" />
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:schema>
    
      </wsdl:types>
      <wsdl:message name="testExceptionOneResponse">
        <wsdl:part element="tns:testExceptionOneResponse" name="parameters" />
      </wsdl:message>
      <wsdl:message name="testExceptionOneRequest">
        <wsdl:part element="tns:testExceptionOne" name="parameters" />
      </wsdl:message>
      <wsdl:portType name="ExceptionServicePortType">
        <wsdl:operation name="testExceptionOne">
    
          <wsdl:input message="tns:testExceptionOneRequest" name="testExceptionOneRequest" />
          <wsdl:output message="tns:testExceptionOneResponse" name="testExceptionOneResponse" />
        </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="ExceptionServiceHttpBinding" type="tns:ExceptionServicePortType">
        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="testExceptionOne">
          <wsdlsoap:operation soapAction="http://10.0.2.33:8080/kyoto/ExceptionService/Invoke" />
          <wsdl:input name="testExceptionOneRequest">
    
            <wsdlsoap:body use="literal" />
          </wsdl:input>
          <wsdl:output name="testExceptionOneResponse">
            <wsdlsoap:body use="literal" />
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="ExceptionService">
        <wsdl:port binding="tns:ExceptionServiceHttpBinding" name="ExceptionServiceHttpPort">
    
          <wsdlsoap:address location="http://10.0.2.33:8080/kyoto/ExceptionService" />
        </wsdl:port>
      </wsdl:service>
    </wsdl:definitions>
    Thanks for your help.

    Chris
Working...
X