Getting Map value from JAXB Response Object

carl

I am using Spring WS Template to call a JAX-WS web service. The response would like as follows. Here I need get the value of key2 from the response object how do I need to do that ? Here I am using JAXB client.

<MyResponse>
        <return>
            <map>
               <key>key1</key>
               <value>value1</value>
            </map>
            <map>
               <key>key2</key>
               <value>value2</value>
            </map>
            <map>
               <key>key3</key>
               <value>value3</value>
            </map>
            <param1></param1>
            <param2></param2>
            <param3></param3>
            ......
            ......
        </return>
    </MyResponse>

The following code would return MapWrapper and I have no idea how to get the key from the returned MapWrapper

myResponse.getReturn();// returns MapWrapper 
carl

MapWrapper don't have specific methods, but it could simply be treated as a Map.

      List<MapElement> elements = conversationResponse.getReturn().getMap();

      for (MapElement mapElement : elements) {

        if (mapElement.getKey() != null
            && mapElement.getKey().equalsIgnoreCase("key2")) {

          val = mapElement.getValue();
          break;
        }

      }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to map the value in template by getting the reference from other object label?

From Dev

Getting array key(protected)-value from an array inside object (response from RTM-php)?

From Dev

Getting array key(protected)-value from an array inside object (response from RTM-php)?

From Dev

Getting request body from response object

From Dev

Getting xml element name from unmarshalled java object with JAXB

From Dev

Getting value from a collection object

From Dev

Getting value from object in javascript

From Dev

php getting value from object

From Dev

Unexpected value when getting value from a map

From Dev

Getting json value from nested response

From Dev

Getting value from json response Swift

From Dev

Getting null value in the response from a soap service

From Dev

ReactJSL: Enum value map from JSON response

From Dev

JAXB Marshal and Unmarshal Map to/from <key>value</key>

From Dev

Why is getting from Map slower than getting from object?

From Dev

Scala getting a value from a map when unsure if the map holds the value

From Dev

Getting a value from a map (Using Java 1.4)

From Dev

Jaxb and Object class do not get the value from the Xml when unmarshal

From Dev

Jaxb and Object class do not get the value from the Xml when unmarshal

From Dev

XPATH from JAXB object

From Dev

how to get value from json response object

From Dev

DataRowView object getting null value at time of getting value from DataGrid

From Dev

Getting a value from json response without header from cURL

From Java

Getting key with the highest value from object

From Dev

Getting checkbox value from json object

From Dev

perl: getting a value from a function of the object

From Dev

Getting value from array object(DateTime)

From Dev

Getting Parent Object, from nested value

From Dev

getting value from stdclass object/array

Related Related

  1. 1

    How to map the value in template by getting the reference from other object label?

  2. 2

    Getting array key(protected)-value from an array inside object (response from RTM-php)?

  3. 3

    Getting array key(protected)-value from an array inside object (response from RTM-php)?

  4. 4

    Getting request body from response object

  5. 5

    Getting xml element name from unmarshalled java object with JAXB

  6. 6

    Getting value from a collection object

  7. 7

    Getting value from object in javascript

  8. 8

    php getting value from object

  9. 9

    Unexpected value when getting value from a map

  10. 10

    Getting json value from nested response

  11. 11

    Getting value from json response Swift

  12. 12

    Getting null value in the response from a soap service

  13. 13

    ReactJSL: Enum value map from JSON response

  14. 14

    JAXB Marshal and Unmarshal Map to/from <key>value</key>

  15. 15

    Why is getting from Map slower than getting from object?

  16. 16

    Scala getting a value from a map when unsure if the map holds the value

  17. 17

    Getting a value from a map (Using Java 1.4)

  18. 18

    Jaxb and Object class do not get the value from the Xml when unmarshal

  19. 19

    Jaxb and Object class do not get the value from the Xml when unmarshal

  20. 20

    XPATH from JAXB object

  21. 21

    how to get value from json response object

  22. 22

    DataRowView object getting null value at time of getting value from DataGrid

  23. 23

    Getting a value from json response without header from cURL

  24. 24

    Getting key with the highest value from object

  25. 25

    Getting checkbox value from json object

  26. 26

    perl: getting a value from a function of the object

  27. 27

    Getting value from array object(DateTime)

  28. 28

    Getting Parent Object, from nested value

  29. 29

    getting value from stdclass object/array

HotTag

Archive