Hi Matthew,
I think the solution is to generate getters and setters for the properties as the aegis binding works with javabean properties not fields. Cheers,
- Dan

Matthew T. Adams wrote:

Hi all,

I have a question regarding the control over the Aegis
binding.  I'm using XFire 1.0 (all jars in use are at
1.0 except xfire-jsr181-api-1.0-M1.jar) on JDK
1.5.0_06 with JSR 181 annotations & Spring 1.2.6 to
expose a web service.  It appears that the Aegis
binding is not descending into my DTO classes or
picking up the generics in them.

Here is my web service interface:
=================================
package dummy;

import javax.jws.WebService;
import javax.jws.WebMethod;

@WebService
public interface Dummy {
   @WebMethod
   DoSomethingResponse doSomething(DoSomethingRequest
request);
}
=================================
...and my implementation class:
=================================
package dummy;

import javax.jws.WebService;

@WebService(endpointInterface = "dummy.Dummy")
public class DummyImpl implements Dummy {

   public DoSomethingResponse
doSomething(DoSomethingRequest request) {
       DoSomethingResponse r = new
DoSomethingResponse();
       r.foo = request.foo;
       return r;
   }
}
=================================
...and my data transfer & request/response objects:
=================================
package dummy;

import java.io.Serializable;

public class DoSomethingRequest implements
Serializable {
   public Foo foo;

   public Foo getFoo() {
       return foo;
   }

   public void setFoo(Foo foo) {
       this.foo = foo;
   }
}
=================================
package dummy;

import java.io.Serializable;

public class DoSomethingResponse implements
Serializable {
   public Foo foo;

   public Foo getFoo() {
       return foo;
   }

   public void setFoo(Foo foo) {
       this.foo = foo;
   }
}
=================================
package dummy;

import java.util.Map;
import java.util.HashMap;
import java.io.Serializable;

public class Foo implements Serializable {
   public Map<String,Bar> bars = new
HashMap<String,Bar>();
}
=================================
package dummy;

import java.io.Serializable;

public class Bar implements Serializable {
   public int x;
   public int y;
   public int z;
}
=================================
...and my xfire-servlet.xml:
=================================
<beans>
   <bean id="webAnnotations"
class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations"/>
<bean id="handlerMapping"
class="org.codehaus.xfire.spring.remoting.Jsr181HandlerMapping">
       <property name="typeMappingRegistry">
           <ref bean="xfire.typeMappingRegistry"/>
       </property>
       <property name="xfire">
           <ref bean="xfire"/>
       </property>
       <property name="webAnnotations">
           <ref bean="webAnnotations"/>
       </property>
   </bean>

   <bean id="dummy" class="dummy.DummyImpl"/>

   <bean
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
       <property name="urlMap">
           <map>
               <entry key="/">
                   <ref bean="handlerMapping"/>
               </entry>
           </map>
       </property>
   </bean>
</beans>
=================================
...and my WEB-INF/web.xml:
=================================
<web-app>
   <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>
           /WEB-INF/applicationContext.xml
classpath:org/codehaus/xfire/spring/xfire.xml
       </param-value>
   </context-param>

   <context-param>
       <param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
   </context-param>

   <listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
   </listener>

   <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>

   <servlet>
       <servlet-name>xfire</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
   </servlet>

   <servlet-mapping>
       <servlet-name>xfire</servlet-name>
       <url-pattern>/*</url-pattern>
   </servlet-mapping>
</web-app>
=================================

The above produces the following WSDL when deployed
into Tomcat in the context named "tt" (URL is
http://localhost:8080/tt/services/DummyImpl?wsdl):
=================================
<?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://dummy";
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://dummy";>
 <wsdl:types>
   <xsd:schema targetNamespace="http://dummy";
elementFormDefault="qualified"
attributeFormDefault="qualified">
     <xsd:complexType name="DoSomethingRequest">
       <xsd:sequence>
         <xsd:element name="foo" type="tns:Foo"
minOccurs="0" nillable="true" />
       </xsd:sequence>
     </xsd:complexType>
     <xsd:complexType name="Foo" />

     <xsd:element name="doSomething">
       <xsd:complexType>
         <xsd:sequence>
           <xsd:element name="in0"
type="tns:DoSomethingRequest" nillable="true"
minOccurs="1" maxOccurs="1" />
         </xsd:sequence>
       </xsd:complexType>
     </xsd:element>
     <xsd:complexType name="DoSomethingResponse">
       <xsd:sequence>

         <xsd:element name="foo" type="tns:Foo"
minOccurs="0" nillable="true" />
       </xsd:sequence>
     </xsd:complexType>
     <xsd:element name="doSomethingResponse">
       <xsd:complexType>
         <xsd:sequence>
           <xsd:element name="out"
type="tns:DoSomethingResponse" nillable="true"
minOccurs="1" maxOccurs="1" />
         </xsd:sequence>
       </xsd:complexType>

     </xsd:element>
   </xsd:schema>
 </wsdl:types>
 <wsdl:message name="doSomethingResponse">
   <wsdl:part element="tns:doSomethingResponse"
name="parameters" />
 </wsdl:message>
 <wsdl:message name="doSomethingRequest">
   <wsdl:part element="tns:doSomething"
name="parameters" />
 </wsdl:message>

 <wsdl:portType name="DummyImpl">
   <wsdl:operation name="doSomething">
     <wsdl:input message="tns:doSomethingRequest"
name="doSomethingRequest" />
     <wsdl:output message="tns:doSomethingResponse"
name="doSomethingResponse" />
   </wsdl:operation>
 </wsdl:portType>
 <wsdl:binding name="DummyImplHttpBinding"
type="tns:DummyImpl">
   <wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"; />
   <wsdl:operation name="doSomething">

     <wsdlsoap:operation soapAction="" />
     <wsdl:input name="doSomethingRequest">
       <wsdlsoap:body use="literal" />
     </wsdl:input>
     <wsdl:output name="doSomethingResponse">
       <wsdlsoap:body use="literal" />
     </wsdl:output>
   </wsdl:operation>
 </wsdl:binding>

 <wsdl:service name="DummyImpl">
   <wsdl:port binding="tns:DummyImplHttpBinding"
name="DummyImplHttpPort">
     <wsdlsoap:address
location="http://localhost:8080/tt/services/DummyImpl";
/>
   </wsdl:port>
 </wsdl:service>
</wsdl:definitions>
=================================

Note in the WSDL the line
     <xsd:complexType name="Foo" />
which is clearly not reflective of Foo's structure: a
member variable whose name is "bars" and is of generic
type Map<java.lang.String,dummy.Bar>.  How do I get
XFire/Aegis/whatever to descend into the constituent
parts of a DoSomethingRequest and DoSomethingResponse
so that the proper structure is reflected in the WSDL?
I was under the impression from the user's guide that
the use of generics would cause all of this to be
picked up automatically, but it appears that XFire is
not even bothering to go deeper than
DoSomethingRequest/DoSomethingResponse.

TIA,
Matthew


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com


--
Dan Diephouse
(616) 971-2053
Envoi Solutions LLC
http://netzooid.com

Reply via email to