Hi,

I'm having a weird problem where calls to a web service operation gets
routed to the incorrect method. I'm new to web services and XFire so
please be patient with me :)

For example I have 2 SOAP operations defined in the (generated) WSDL,
named "foo" and "bar". They are using named parameters specific to the
operation, but both methods on the underlying java class happen to
have the same native types as args.

What I've found is that no matter which web service operation is
invoked, "foo" or "bar", the foo() method is always called on the web
service class.

If I change the java class to have different input arguments on each
method then the problem goes away. I am using Castor with Aegis to
handle the bindings, with Spring to tie it all together. Please see my
code snippets below.

How can I fix this? I'm sure I'm missing something, as I don't imagine
that ignoring method signatures is default behaviour in XFire!


Thanks in advance,
Joey



The web service class:

public interface MyWebService {
   public Integer foo(String input) throws Exception;
   public Integer bar(String input) throws Exception;
       // E.g. if I change the method bar() to be as below i.e. with
different input args, then the web service calls are routed to the
correct method
      // public Integer bar(Integer aDifferentTypedArg) throws Exception;
}


The aegis mapping file:

<mappings>
       <mapping>
               <method name="foo">
                       <return-type mappedName="FooOutput"/>
                       <parameter index="0" mappedName="FooInput"/>
               </method>
               <method name="bar">
                       <return-type mappedName="BarOutput"/>
                       <parameter index="0" mappedName="BarInput"/>
               </method>
       </mapping>
</mappings>


The Spring config:

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
       "http://www.springframework.org/dtd/spring-beans.dtd";>

<beans>
       <import resource="classpath:org/codehaus/xfire/spring/xfire.xml"/>

       <bean id="addressingHandler"
class="org.codehaus.xfire.addressing.AddressingInHandler"/>
       <bean id="castorTypeRegistry"
class="org.codehaus.xfire.castor.CastorTypeMappingRegistry" />
       <bean id="bindingProvider"
class="org.codehaus.xfire.aegis.AegisBindingProvider">
               <constructor-arg ref="castorTypeRegistry" />
       </bean>
       <bean id="castorServiceFactory"
class="org.codehaus.xfire.service.binding.ObjectServiceFactory">
               <constructor-arg index="0" ref="xfire.transportManager" />
               <constructor-arg index="1" ref="bindingProvider" />
       </bean>

       <bean id="myWebService" class="net.xyz.MyWebServiceImpl"/>
       <bean name="myWebServiceBean"
class="org.codehaus.xfire.spring.ServiceBean">
       <property name="serviceBean" ref="myWebService"/>
               <property name="namespace" value="http://www.example.com"/>
               <property name="serviceClass" value="net.xyz.MyWebService"/>
               <property name="schemas">
                       <list>
                               <value>META-INF/schema/MyWebService.xsd</value>
                       </list>
               </property>
               <property name="style" value="document"/>
               <property name="serviceFactory" ref="castorServiceFactory"/>
               <property name="inHandlers">
                 <list>
                       <ref bean="addressingHandler"/>
                 </list>
               </property>
       </bean>

</beans>


The (generated) WSDL:
<wsdl:types>
   <xsd:schema>
       <xsd:element name="FooInputBean" type="xsd:string"/>
       <xsd:element name="FooOutputBean" type="xsd:integer"/>
   </xsd:schema>
</wsdl:types>
<wsdl:message name="FooResponse">
   <wsdl:part name="FooOutput" element="FooOutputBean"/>
</wsdl:message>
<wsdl:message name="FooRequest">
   <wsdl:part name="FooInput" element="FooInputBean"/>
</wsdl:message>

etc...

   <wsdl:operation name="foo">
     <wsdlsoap:operation soapAction=""/>
     <wsdl:input name="FooRequest">
       <wsdlsoap:body use="literal"/>
     </wsdl:input>
     <wsdl:output name="FooResponse">
       <wsdlsoap:body use="literal"/>
     </wsdl:output>
   </wsdl:operation>

   <wsdl:operation name="bar">
     <wsdlsoap:operation soapAction=""/>
     <wsdl:input name="barRequest">
       <wsdlsoap:body use="literal"/>
     </wsdl:input>
     <wsdl:output name="barResponse">
       <wsdlsoap:body use="literal"/>
     </wsdl:output>
   </wsdl:operation>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to