【问题标题】:Axis web service client respnose HashMapAxis Web 服务客户端响应 HashMap
【发布时间】:2011-07-27 08:02:18
【问题描述】:

我正在尝试使用一个返回 Java 哈希映射的 Web 服务,下面是它的代码

        String endpoint =
                "http://localhost:8080/eCWServices/StructSpeech/StructSpeech";

        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName(new QName("http://ejb.ecw.com/", "parseNotes"));
        call.addParameter("notes", org.apache.axis.Constants.XSD_STRING, ParameterMode.IN);
        call.addParameter("apuId", org.apache.axis.Constants.XSD_STRING, ParameterMode.IN);
        call.addParameter("providerId", org.apache.axis.Constants.XSD_STRING, ParameterMode.IN);
        call.setReturnType(XMLType.SOAP_MAP);
        HashMap  ret = (HashMap) call.invoke(new Object[]{"","",""});
        System.out.println("Sent 'Hello!', got '" + ret + "'");

返回的 HashMap 始终为空,我认为该轴不支持它。谁能给我指点,我可以在哪里找到如何在 jdk 1.4 中使用返回哈希图的服务?

【问题讨论】:

    标签: java web-services axis


    【解决方案1】:

    好的,通过将它序列化为 ByteArrayOutputStream 返回一个 byte[] 来解决它,我检索字节数组并将其转换回客户端的 hashMap。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-01
      • 1970-01-01
      • 2018-11-30
      相关资源
      最近更新 更多