简体   繁体   中英

Axis web service client respnose HashMap

I am trying to consume a web service which returns a Java hash map, following is the code for that

        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 + "'");

The returned HashMap is always empty and I think that axis does not support it. Can anyone give me pointers where i can find how to consume a service in jdk 1.4 which returns a hashmap?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM