RE: How to pass a HashMap
I reported the same issue in 2.0.3 a while back, and I did have my Map specified as MapString, String. (It was a service that had previously worked under XFire.) I got no response, so I switched to JAXB and just wrapped the Map inside a bean. -Original Message- From: Benson Margulies [mailto:[EMAIL PROTECTED] Sent: Monday, February 25, 2008 10:20 AM To: cxf-user@incubator.apache.org Subject: Re: How to pass a HashMap Please try my suggestion of declaring MapType,Type in your SEI instead of just 'map'. On Mon, Feb 25, 2008 at 10:04 AM, Li, Weiye [EMAIL PROTECTED] wrote: Should be the latest one:2.0.4 Thanks for the reply. On 2/23/08 11:49 AM, Benson Margulies [EMAIL PROTECTED] wrote: What version of CXF have you got? On Fri, Feb 22, 2008 at 4:39 PM, Li, Weiye [EMAIL PROTECTED] wrote: The CXF document says that Aegis data binding can even works on Map. I tried this, but it always return an empty one. Here's my testing codes. Did I miss something? Or I need to write special config file? @WebService(name=EmicroManager, targetNamespace=http://test.emicro ) @SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle= ParameterStyle.WRAPPED) public interface EmicroService { @WebMethod @RequestWrapper(className=test.model.Employee, localName=employee, targetNamespace= http://test.emicro/types ) @Oneway public void addEmployee(Employee emp); @WebMethod(operationName=getEmployeesAsMap) @ResponseWrapper(className=java.util.HashMap, localName=EmployeesMap, targetNamespace= http://test.emicro/types;) public Map getEmployeesMap(); } public static void main(String args[]) throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(test.EmicroService.class); factory.setAddress(http://localhost:9080/emicro-ws/EmicroService ); factory.getServiceFactory().setDataBinding(new AegisDatabinding()); EmicroService client = (EmicroService)factory.create(); // add 2 employees here, then MapInteger, Employee emap = client.getEmployeesMap(); logger.info(emap); System.exit(0); } The backend configuration is just following the CXF tutorial bean id=aegisBean class= org.apache.cxf.aegis.databinding.AegisDatabinding scope=prototype/ bean id=jaxws-and-aegis-service-factory class=org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean scope=prototype 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 bean id=emicro class=org.stjude.ri.emicro.ws.EmicroServiceImpl / jaxws:endpoint id=helloWorld implementor=#emicro address=/EmicroService jaxws:serviceFactory ref bean='jaxws-and-aegis-service-factory' / /jaxws:serviceFactory /jaxws:endpoint Any advice? Thanks
Map parameter is empty in CXF, worked in XFire
I've been struggling with this for the better part of a day now. I have a service that takes a MapString, String as a parameter. It worked under XFire, but I am trying to port to CXF 2.0.3 now and I can't get the values in the Map to come across. I pass a Map with three entries from the client but an empty Map appears on the server side. Any ideas where I'm going wrong: Here is the client setup code: ClientProxyFactoryBean fb = new ClientProxyFactoryBean(); fb.setServiceClass(IntegrityCheckWebService.class); fb.setAddress(serviceUri + SERVICE_URL); fb.setProperties(properties); // Not sure if this line is needed, but tried it anyway // Didn't work either way fb.setDataBinding(new AegisDatabinding()); fb.getServiceFactory().setDataBinding(new AegisDatabinding()); this.service = (IntegrityCheckWebService) fb.create(); And the call: MapString, String licenseCheckInfo = new HashMapString, String(); licenseCheckInfo.put(IntegrityCheckWebService.TRANSACTION_ID, rro.getTransactionID()); licenseCheckInfo.put(IntegrityCheckWebService.OPERATOR_ID, rro.getParameters().get(2)); licenseCheckInfo.put(IntegrityCheckWebService.TERMINAL_SERIAL_NUMBER, rro.getParameters().get(1)); result = this.service.integrityAssert(licenseCheckInfo); And the service method interface: public boolean integrityAssert(MapString, String integrityCheckInfo); And the Spring config: bean id=aegisBean class=org.apache.cxf.aegis.databinding.AegisDatabinding/ bean id='jaxwsAegisServiceFactory' 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 bean id=integrityCheckWebService class=IntegrityCheckWebService/ property name=licenseManager ref=systemLicenseManager/ /bean jaxws:endpoint id=IntegrityCheckService implementor=#integrityCheckWebService address=/IntegrityCheckService jaxws:serviceFactory ref bean='jaxwsAegisServiceFactory' / /jaxws:serviceFactory /jaxws:endpoint
RE: Map parameter is empty in CXF, worked in XFire
Little more info: I turned on logging, and the map entries are being sent by the client, just not mapped on the server side. The inbound message was logged as: soap:Envelope soap:Body ns1:integrityAssert ns1:arg0 ns1:entry ns1:keyterminalSerialNumber/ns1:key ns1:value63336559/ns1:value /ns1:entry ns1:entry ns1:keytransactionId/ns1:key ns1:valueprTaskLUTCoreSignOn/ns1:value /ns1:entry ns1:entry ns1:keyoperatorId/ns1:key ns1:valuedennisd/ns1:value /ns1:entry /ns1:arg0 /ns1:integrityAssert /soap:Body /soap:Envelope -Original Message- From: Doubleday, Dennis [mailto:[EMAIL PROTECTED] Sent: Friday, January 11, 2008 12:28 PM To: cxf-user@incubator.apache.org Subject: Map parameter is empty in CXF, worked in XFire I've been struggling with this for the better part of a day now. I have a service that takes a MapString, String as a parameter. It worked under XFire, but I am trying to port to CXF 2.0.3 now and I can't get the values in the Map to come across. I pass a Map with three entries from the client but an empty Map appears on the server side. Any ideas where I'm going wrong: Here is the client setup code: ClientProxyFactoryBean fb = new ClientProxyFactoryBean(); fb.setServiceClass(IntegrityCheckWebService.class); fb.setAddress(serviceUri + SERVICE_URL); fb.setProperties(properties); // Not sure if this line is needed, but tried it anyway // Didn't work either way fb.setDataBinding(new AegisDatabinding()); fb.getServiceFactory().setDataBinding(new AegisDatabinding()); this.service = (IntegrityCheckWebService) fb.create(); And the call: MapString, String licenseCheckInfo = new HashMapString, String(); licenseCheckInfo.put(IntegrityCheckWebService.TRANSACTION_ID, rro.getTransactionID()); licenseCheckInfo.put(IntegrityCheckWebService.OPERATOR_ID, rro.getParameters().get(2)); licenseCheckInfo.put(IntegrityCheckWebService.TERMINAL_SERIAL_NUMBER, rro.getParameters().get(1)); result = this.service.integrityAssert(licenseCheckInfo); And the service method interface: public boolean integrityAssert(MapString, String integrityCheckInfo); And the Spring config: bean id=aegisBean class=org.apache.cxf.aegis.databinding.AegisDatabinding/ bean id='jaxwsAegisServiceFactory' 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 bean id=integrityCheckWebService class=IntegrityCheckWebService/ property name=licenseManager ref=systemLicenseManager/ /bean jaxws:endpoint id=IntegrityCheckService implementor=#integrityCheckWebService address=/IntegrityCheckService jaxws:serviceFactory ref bean='jaxwsAegisServiceFactory' / /jaxws:serviceFactory /jaxws:endpoint