cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayteeem <michael.chri...@axa.com.au>
Subject RE: Map contains no data when returned from remote call - Aegis databinding - empty Map?
Date Wed, 19 Sep 2007 00:40:33 GMT

Thanks for the reply.

Yes JaxB definitely has issues with returning java.util.Map type.
According to the Aegis databinding docs:
it supports Maps, but doesn't seem to be working.

"Aegis Supported Types" 

	* Basic types: int, double, float, long, byte[], short, String, 
BigDecimal 
	* Arrays 
	* Collections - including Maps 
	* Dates: java.util.Date, java.util.Calendar, java.sql.Timestamp, 
	java.sql.Date, java.sql.Time 
	* XML: org.w3c.dom.Docmument, org.jdom.Element, XMLStreamReader, 
	Source 
	* Complex types which are aggregations of the above 

	Ref: http://cwiki.apache.org/CXF20DOC/aegis-databinding.html 

bmargulies wrote:
> 
> There is a complex question about how a Map can be represented in XML
> Schema. As I recall, in JAXB, the rather complex annotation for the
> purpose is only in 2.1, which CXF doesn't do yet. We switched from a Map
> to an explicit data structure to get around this.
> 
>> -----Original Message-----
>> From: kayteeem [mailto:michael.christl@axa.com.au]
>> Sent: Tuesday, September 18, 2007 8:11 PM
>> To: cxf-user@incubator.apache.org
>> Subject: Re: Map contains no data when returned from remote call -
> Aegis
>> databinding - empty Map?
>> 
>> 
>> Searching through the forum, it seems that no-one else seems to have
>> issues
>> with returning java.util.Map.
>> Is this true? Is anyone returning a Map from CXF with no issues?
>> 
>> I think this is a known issue with BEA Weblogic 9.2 then, from there
> web
>> site:
>> 
>> "Weblogic Workshop 8.1 supported returning the java.util.Map type from
> Web
>> Service operations. The runtime provided a Workshop specific
> serialization
>> of the Map to and from XML. The schema for that serialization was
> included
>> in the WSDL for the Web Service.
>> 
>> In WebLogic Server 9.2, the java.util.Map type can no longer be
> returned
>> from Web Service operations.
>> Workaround or Solution:
>> Provide an application-defined type that supports the key/value
> features
>> provided by java.util.Map. That type must conform to JAX/RPC
> Java<->XML
>> Serialization rules. If the application-type is going to contain
>> subclasses
>> of type key or value type, then the weblogic.jws.Types annotation must
> be
>> used to specify the types that could be contained at runtime. WebLogic
> Web
>> Services (and their clients) that previously returned a java.util.Map
> will
>> have to be manually updated to use this new application-defined type.
>> "
>> Ref:
> http://e-docs.bea.com/wls/docs92/issues/known_resolved.html#wp1118161
>> 
>> Thanks Michael
>> 
>> 
>> kayteeem wrote:
>> >
>> > Hi all,
>> >
>> > I cant return a simple java.util.Map from a Remote Service call. The
>> > implementation class on the remote end is java.util.HashMap.
>> > Once the data is returned on the caller, the Map contains data in
> the
>> SOAP
>> > message (included below for String->String Map, and
> String->AccountBO
>> > also), but once unmarshalled into a Java object, it has a size = 0
> (No
>> > entries in the Map).
>> >
>> > I must have missed some simple configuration of some sort, since I
> have
>> > switched the databinding to Aegis, and according to Aegis
> documentation
>> it
>> > supports Maps.
>> > Any Help would be much appreciated.
>> >
>> > "Aegis Supported Types"
>> >
>> >     * Basic types: int, double, float, long, byte[], short, String,
>> > BigDecimal
>> >     * Arrays
>> >     * Collections - including Maps
>> >     * Dates: java.util.Date, java.util.Calendar, java.sql.Timestamp,
>> > java.sql.Date, java.sql.Time
>> >     * XML: org.w3c.dom.Docmument, org.jdom.Element, XMLStreamReader,
>> > Source
>> >     * Complex types which are aggregations of the above
>> >
>> > Ref: http://cwiki.apache.org/CXF20DOC/aegis-databinding.html
>> >
>> > Calling any of the Service methods below that return Map always seem
> to
>> be
>> > unmarshalled into an empty java object, even though I can see the
> data
>> > inside the SOAP message once returned on the calling/requestor side.
>> >
>> > In the returned SOAP message why does it contain a reference to the
>> > Complex object(AccountBO) eg)
>> com.axa.demo.ws.shared.bo.AccountBO@270e606
>> > and not the marshalled data into XML. If I returned a java.util.List
> it
>> > marshalls the values inside AccountBO into XML data containing the
>> values
>> > inside each AccountBO object.
>> >
>> > Details of the implementation:
>> > CXF 2.0.1
>> > Spring 2.0.4
>> > Weblogic BEA 9.2 AppServer
>> > JDK 1.5 using Generics ( I even tried with explicit Aegis Mapping
> file
>> for
>> > JDK1.4, but to no avail.
>> > Ref:http://xfire.codehaus.org/Mapping+collections)
>> >
>> >
>>
> ************************************************************************
> **
>> ******
>> >
>>
> ************************************************************************
> **
>> ******
>> > // Service Interface: AccountService.java:
>> >
>> >
>> > @WebService
>> > public interface AccountService {
>> >
>> >     /**
>> >      * Gets a Map of all the accounts
>> >      *
>> >      * @return the id of the Map is the accountId, value is the
>> > account(AccountBO)
>> >      */
>> >     @WebMethod
>> >     public Map<String, AccountBO> getAccounts();
>> >
>> >     @WebMethod
>> >     public Map<String, String> getMapOfStrings();
>> > }
>> >
>> >
>>
> ************************************************************************
> **
>> ******
>> >
>>
> ************************************************************************
> **
>> ******
>> > // Service Implementation - AccountServiceImpl .java:
>> >
>> > @WebService(endpointInterface =
>> > "com.axa.demo.ws.shared.service.AccountService")
>> > public class AccountServiceImpl implements AccountService,
> Serializable
>> {
>> >
>> >     // list of Accounts
>> >     Map<String, AccountBO> accounts = new HashMap<String,
> AccountBO>();
>> >
>> >     List<AccountBO> theList = new ArrayList<AccountBO>();
>> >
>> >     Map<String, String> mapOfStrings = new HashMap<String,
> String>();
>> >
>> >     private static final long serialVersionUID = 1L;
>> >
>> >     public AccountServiceImpl(){
>> >         mapOfStrings.put("One", "Michael");
>> >         mapOfStrings.put("Two", "Paul");
>> >
>> >         AccountBO acct1 = new AccountBO();
>> >         acct1.setAccountId("acct_1");
>> >
>> >         AccountBO acct2 = new AccountBO();
>> >         acct2.setAccountId("acct_2");
>> >
>> >         accounts.put("acct_1", acct1);
>> >         accounts.put("acct_2", acct2);
>> >
>> >     }
>> >
>> >     public java.util.Map<String, AccountBO> getAccounts() {
>> >         return accounts;
>> >     }
>> >
>> >     public Map<String, String> getMapOfStrings(){
>> >         return mapOfStrings ;
>> >     }
>> >
>> > }
>> >
>> >
>>
> ************************************************************************
> **
>> ******
>> >
>>
> ************************************************************************
> **
>> ******
>> > Spring config Client proxy side
>> >
>> > <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:jaxws="http://cxf.apache.org/jaxws"
>> >     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-2.0.xsd
>> > http://cxf.apache.org/jaxws
> http://cxf.apache.org/schemas/jaxws.xsd">
>> >
>> >     <import resource="classpath:META-INF/cxf/cxf.xml" />
>> >     <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
> />
>> >     <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>> >
>> >     <!-- Aegis data binding
>> >     <bean id="aegisDatabinding"
>> >
>> class="org.apache.cxf.aegis.databinding.AegisDatabinding"/>
>> >
>> >     <!-- Definition of AccountService client bean -->
>> >     <bean id="services.appln.accountClient"
>> > class="com.axa.demo.ws.shared.service.AccountService"
>> > factory-bean="accountClientFactory" factory-method="create"/>
>> >
>> >     <bean id="accountClientFactory"
>> > class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>> >         <property name="serviceClass"
>> > value="com.axa.demo.ws.shared.service.AccountService"/>
>> >         <property name="address"
>> > value="http://localhost:7001/demoWeb/ws/AccountService"/>
>> >         <property name="dataBinding" ref="aegisDatabinding"/>
>> >
>> >     </bean>
>> >
>> > </beans>
>> >
>>
> ************************************************************************
> **
>> ******
>> >
>>
> ************************************************************************
> **
>> ******
>> > Spring config Remote Service side
>> >
>> > <beans xmlns="http://www.springframework.org/schema/beans"
>> >     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >     xmlns:jaxws="http://cxf.apache.org/jaxws"
>> >     xsi:schemaLocation="
>> > http://www.springframework.org/schema/beans
>> > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>> > http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
>> > http://www.springframework.org/schema/aop
>> > http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"
>> >>
>> >
>> >     <import resource="classpath:META-INF/cxf/cxf.xml" />
>> >     <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
> />
>> >     <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>> >
>> >     <!-- Aegis databinding -->
>> >     <bean id="aegisBean"
>> > class="org.apache.cxf.aegis.databinding.AegisDatabinding"/>
>> >         <bean id='jaxws-and-aegis-service-factory'
>> > class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
>> >         <property name="dataBinding" ref="aegisBean"/>
>> >                  <property name="serviceConfigurations">
>> >                      <list>
>> >                        <bean
>> > class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
>> >                        <bean
>> > class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration"/>
>> >                        <bean
>> > class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/>
>> >                     </list>
>> >                 </property>
>> >     </bean>
>> >
>> >      <!-- AccountService Implementation -->
>> >     <jaxws:endpoint id="accountService" address="/AccountService">
>> >         <jaxws:implementor>
>> >           <bean
>> class="com.axa.demo.ws.service.impl.AccountServiceImpl"/>
>> >          </jaxws:implementor>
>> >
>> >          <jaxws:serviceFactory>
>> >             <ref bean='jaxws-and-aegis-service-factory' />
>> >         </jaxws:serviceFactory>
>> >
>> >      </jaxws:endpoint>
>> >
>> >     <!-- The stuff below enables logging of the SOAP messages to the
>> > console -->
>> >     <bean id="logInbound"
>> > class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>> >     <bean id="logOutbound"
>> > class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>> >     <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
>> >         <property name="inInterceptors">
>> >             <list>
>> >                  <ref bean="logInbound"/>
>> >             </list>
>> >         </property>
>> >         <property name="outInterceptors">
>> >             <list>
>> >                 <ref bean="logOutbound"/>
>> >                 <ref bean="interceptor.webservices.out.security"/>
>> >             </list>
>> >         </property>
>> >         <property name="outFaultInterceptors">
>> >             <list>
>> >                 <ref bean="logOutbound"/>
>> >             </list>
>> >         </property>
>> >     </bean>
>> >
>> > </beans>
>> >
>> >
>>
> ************************************************************************
> **
>> ******
>> >
>>
> ************************************************************************
> **
>> ******
>> > // AccountBO.java
>> > public class AccountBO implements Serializable{
>> >
>> >     /**
>> >      *
>> >      */
>> >     private static final long serialVersionUID =
> 273699541584709071L;
>> >
>> >     private String accountId;
>> >     private String accountType;
>> >     private int balance = 0;
>> >
>> >     public String getAccountType() {
>> >         return accountType;
>> >     }
>> >     public void setAccountType(String accountType) {
>> >         this.accountType = accountType;
>> >     }
>> >     public int getBalance() {
>> >         return balance;
>> >     }
>> >     public void setBalance(int balance) {
>> >         this.balance = balance;
>> >     }
>> >     public String getAccountId() {
>> >         return accountId;
>> >     }
>> >     public void setAccountId(String accountId) {
>> >         this.accountId = accountId;
>> >     }
>> >
>> > }
>> >
>>
> ************************************************************************
> **
>> ******
>> >
>>
> ************************************************************************
> **
>> ******
>> >
>> > SOAP Messages received back from remote call to AccountService
>> >  public Map<String, String> getMapOfStrings();
>> >
>> > INFO: Outbound Message
>> > --------------------------------------
>> > <soap:Envelope
>> > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
>> >><ns1:getMapOfStringsResponse
>> xmlns:ns1="http://service.shared.ws.demo.axa.com/"
>> >><return><entry
>> xmlns="http://impl.service.ws.demo.axa.com/"><key>Two</key><valu
>> > e>Paul</value></entry><entry
>> > xmlns="http://impl.service.ws.demo.axa.com/"><key>O
>> >
>>
> ne</key><value>Michael</value></entry></return></ns1:getMapOfStringsResp
> on
>> se></s
>> > oap:Body></soap:Envelope>
>> > --------------------------------------
>> > 18/09/2007 14:44:15 org.apache.cxf.interceptor.LoggingInInterceptor
>> > handleMessag
>> > e
>> > INFO: Inbound Message
>> > --------------------------------------
>> > <soap:Envelope
>> > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
>> >><ns1:getMapOfStringsResponse
>> xmlns:ns1="http://service.shared.ws.demo.axa.com/"
>> >><return><entry
>> xmlns="http://impl.service.ws.demo.axa.com/"><key>Two</key><valu
>> > e>Paul</value></entry><entry
>> > xmlns="http://impl.service.ws.demo.axa.com/"><key>O
>> >
>>
> ne</key><value>Michael</value></entry></return></ns1:getMapOfStringsResp
> on
>> se></s
>> > oap:Body></soap:Envelope>
>> > --------------------------------------
>> > <18/09/2007 02:44:15 PM EST> <DEBUG> <demoEAR_demoWeb> <pc33326>
>> > <AdminServer> <
>> >> <demo>
>> >>
> <portlets.coreFramework.remotingAccount.RemotingAccountController.getMa
>> > pOfStringsAction(RemotingAccountController.java:121)> - Map Of
> Strings
>> > size = 0
>> >
>> >
>>
> ************************************************************************
> **
>> ******
>> >
>>
> ************************************************************************
> **
>> ******
>> >
>> > SOAP Messages received back from remote call to AccountService
>> > public Map<String, AccountBO> getAccounts();
>> >
>> > INFO: Outbound Message
>> > --------------------------------------
>> > <soap:Envelope
>> > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
>> >><ns1:getAccountsResponse
>> xmlns:ns1="http://service.shared.ws.demo.axa.com/"><re
>> > turn><entry
>> > xmlns="http://impl.service.ws.demo.axa.com/"><key>acct_2</key><value
>> >>com.axa.demo.ws.shared.bo.AccountBO@270e606</value></entry><entry
>> xmlns="http:/
>> >
>>
> /impl.service.ws.demo.axa.com/"><key>acct_1</key><value>com.axa.demo.ws.
> sh
>> ared.b
>> >
>>
> o.AccountBO@270bb11</value></entry></return></ns1:getAccountsResponse></
> so
>> ap:Bod
>> > y></soap:Envelope>
>> > --------------------------------------
>> > 18/09/2007 14:50:18 org.apache.cxf.interceptor.LoggingInInterceptor
>> > handleMessag
>> > e
>> > INFO: Inbound Message
>> > --------------------------------------
>> > <soap:Envelope
>> > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
>> >><ns1:getAccountsResponse
>> xmlns:ns1="http://service.shared.ws.demo.axa.com/"><re
>> > turn><entry
>> > xmlns="http://impl.service.ws.demo.axa.com/"><key>acct_2</key><value
>> >>com.axa.demo.ws.shared.bo.AccountBO@270e606</value></entry><entry
>> xmlns="http:/
>> >
>>
> /impl.service.ws.demo.axa.com/"><key>acct_1</key><value>com.axa.demo.ws.
> sh
>> ared.b
>> >
>>
> o.AccountBO@270bb11</value></entry></return></ns1:getAccountsResponse></
> so
>> ap:Bod
>> > y></soap:Envelope>
>> > --------------------------------------
>> > <18/09/2007 02:50:18 PM EST> <DEBUG> <demoEAR_demoWeb> <pc33326>
>> > <AdminServer> <
>> >> <demo>
>> >>
> <portlets.coreFramework.remotingAccount.RemotingAccountController.getAl
>> > lAccountsAction(RemotingAccountController.java:79)> - Map of
> Accounts
>> size
>> > = 0
>> >
>> > Thanks in advance
>> > Michael
>> >
>> >
>> 
>> --
>> View this message in context:
> http://www.nabble.com/Map-contains-no-data-
>> when-returned-from-remote-call---Aegis-databinding---empty-Map--
>> tf4471690.html#a12768529
>> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Map-contains-no-data-when-returned-from-remote-call---Aegis-databinding---empty-Map--tf4471690.html#a12768812
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message