xfire服务器端返回自定义对象中包含hashmap的问题

2019-03-25 13:48|来源: 网路

我在项目中遇到这样一个问题,webservice服务器段用xfire实现,暴露的service方法返回一个自定义的对象ClaimNodeTimes(后面会贴出代码),这个对象中一个属性refusePayReason是HashMap<string,string>类型。

然后我用xfire的eclipse插件生成的测试代码进行测试,发现ClaimNodeTimes对象中的基本类型属性都能取到值,但是refusePayReason是空的,哪位遇到过这种问题,麻烦给解释下。

贴出代码如下:

自定义对象ClaimNodeTimes

public class ClaimNodeTimes {


 private HashMap<string,string> refusePayReason;



 public HashMap<string,string> getRefusePayReason() {
  return refusePayReason;
 }


 public void setRefusePayReason(HashMap<string,string> refusePayReason) {
  this.refusePayReason = refusePayReason;
 }



}

 

这里还有个问题,我看xfire的文档中说使用java5的泛型,就可以不用对collections 做aegis binding,但我发现即便使用了泛型在客户端生成的代码中refusePayReason的类型仍然是anyType2anyTypeMap,所以还是写了aegis binding,refusePayReason的类型就成了String2StringMap,如下:

 

<!---->   
<mappings xmlns:vo="http://vo.customer.claim.picc.com.cn">
<mapping name="vo:ClaimNodeTimes">  
<property name="refusePayReason" keytype="java.lang.String" componenttype="java.lang.String">
</mapping>   
</mappings>

 

暴露的service:

 

public interface CustomerWebServices {

public ClaimNodeTimes findClaimNodeTimesByRegistNo(String registNo);

}

 

 

对service的aegis binding:

<mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance " xsi:schemalocation="http://xfire.codehaus.org/schemas/1.0/mapping.xsd ">
  <mapping>
    <method name="findClaimNodeTimesByRegistNo">
      <return-type componenttype="cn.com.picc.claim.customer.vo.ClaimNodeTimes">
    </method>
  </mapping>
</mappings>

 

服务器端xfire的配置:

<!---->

<beans>
 <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
  <property name="urlMap">
   
    <entry key="/CustomerWebServices">
     <ref bean="customers">
    </entry>

   
  </property>
 </bean>
 
 
 <bean id="customers" class="org.codehaus.xfire.spring.remoting.XFireExporter" lazy-init="false">
  <property name="serviceFactory">
   <ref bean="xfire.serviceFactory">
  </property>
  <property name="xfire">
   <ref bean="xfire">
  </property>
  <property name="serviceBean">
   <ref bean="customerWebServices">
  </property>
  <property name="serviceClass">
   <value>cn.com.picc.claim.customer.service.facade.CustomerWebServices</value>
  </property>
 </bean>


</beans>

  

 

service配置:

<!---->

<beans default-autowire="byName" default-lazy-init="true">

<bean id="customerWebServices" class="cn.com.picc.claim.customer.service.spring.CustomerWebServiceSpringImpl" scope="prototype">

</beans>

 

 

下面是用xfire的eclipse插件生成的测试代码:

public class TestMain {
 public static void main(String[] args){
  CustomerWebServicesClient client=new CustomerWebServicesClient();
  ClaimNodeTimes array = client.getCustomerWebServicesHttpPort()
  .findClaimNodeTimesByRegistNo("RDAA200835020000004015");

String2StringMap temp = array.getRefusePayReason().getValue();
  List list = temp.getEntry();
  System.out.println(list.size());

}

 

 

我debug的时候,在服务器端接口实现中ClaimNodeTimes对象的refusePayReason是有值的,但list的size为0.

哪位能指点一下?

 

相关问答

更多
  • 回复 1# 的帖子 nginx默认就是支持ssi的,在配置文件中开启即可。在虚拟主机location 段里加上(加在http,server段里也可以)ssi on;ssi_silent_errors on;ssi_types text/shtml;这3行,再/usr/local/nginx/sbin/nginx -s reload 重启nginx
  • 什么是服务器端[2022-05-02]

    简单的说,服务器端是为客户端服务的,服务的内容诸如向客户端提供资源,保存客户端数据等等.客户端可以是任意的一台电脑,只要它和服务器端存在连接,并且得到了服务器端的授权,就可以使用服务器端的服务.象现在就可以理解为百度的网站是服务器端,我们现在使用的电脑就是客户端.我们可以使用它的服务. 通常的服务器端都是服务器级的高级PC,以便多客户访问时不会造成延时甚至数据溢出.
  • 我最终为需要验证的每一行数据创建了一个自定义验证器。 这是在转发器控件中动态完成的,然后星号显示在需要修改的行上。 这对我所需要的很好。 谢谢! I ended up creating a custom validator for each row of data that needs validated. This is done dynamically, in the repeater control, and then the asterisk is shown on the row that nee ...
  • 我认为它与最新的jQuery版本有关。 我从他们的例子中发现,validationMessageTmpl已经是一个jQuery对象,所以你不应该重新解析它。 换句话说,改变: .replaceWith($(validationMessageTmpl({ field: name, message: errors[0]}))) 有: .replaceWith(validationMessageTmpl({ field: name, message: errors[0]})) I think it has s ...
  • Restlet 2.3引入了带注释的异常,允许隐藏类ResourceException的使用,并在客户端使用客户端代理利用透明的用户定义异常。 有关详细信息,您可以查看以下链接: https : //templth.wordpress.com/2015/02/27/exception-handling-with-restlet/ 希望它对你有帮助,蒂埃里 Restlet 2.3 introduces annotated exceptions that allow to hide the use of the ...
  • 好吧,WCF中的DataContracts支持复杂的对象,所以我没有看到它的问题(你的对象有多复杂); 但是你应该使用足够的技术。 你可以使用Remoting,地狱,甚至套接字; 但它几乎在所有情况下都是过度杀戮并且在.NET堆栈中过低而无效; 你只会浪费你的时间来实施。 如果你没有理由反对WCF,我会这样做,因为它非常简单和强大。 如果您愿意,还有标准的ASP.NET ASMX Web服务。 有一点需要注意,无论哪种技术,您都应该在分布层中构建代码,从而暴露粗粒度方法。 Well, DataContrac ...
  • 这解决了我的问题。 我的问题是我使用的是具有
    • 的自定义控件但是使用控件的页面存在问题,即当用户点击li时它应该将其类更改为活动(class ='active')但是由于post回来它并没有改变 可能如果其他人有这个问题可以使用我的解决方案。 我在自定义控件代码隐藏中使用了这个函数 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ...
  • http://xiix.wordpress.com/2006/03/23/mozillafirefox-cookie-format/ http://xiix.wordpress.com/2006/03/23/mozillafirefox-cookie-format/
  • 将数据服务器端发送到Google Analytics完全是可能的(如果你之前没有这样做,那么这是非常令人生畏的)。 要使用的两个最佳资源是Google Analytics Measurement Protocol文档和Google Analytics Hit Builder 。 使用参数指南专门准备自定义指标数据。 这是我用于所有PHP项目的实际片段 (首先约150行左右)。 我确信有更好的方法可以做到这一点,但至少可以帮助你弄清楚一些复杂性。 吸收很多信息,但我希望能让你朝着正确的方向前进! Sendin ...
  • 扩展其他答案,可以将此值注入您的客户端javascript。 如果JS在CSHTML文件中,你只需要这样做: //Controller Action public ActionResult SomeAction() { ViewBag.Color = "green"; // Get this from ConfigurationManager.AppSettings, database, or anywhere return View(); } // on the view