lundi 19 octobre 2020

How can we improve the performance of parsing SOAP elements in java

Here is my java code to parse SOAP elements into java objects.It is taking around 40ms to execute but the same logic is executing in 20ms in the case of the REST call

How can I improve my SOAP service overall response time when compared with the REST call? Do we have any improvements in recent releases or can we improve the below code

    ArrayList<Item> items = new ArrayList<>();
    NodeList nodeList = operationNode.getChildNodes();  
    Stream<Item> nodeStream = IntStream.range(0, nodeList.getLength()).
            .mapToObj(nodeList::item);
    
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node createChildNode = nodeList.item(i);
        String localName = createChildNode.getLocalName();
        if (localName.toLowerCase(Locale.ROOT).endsWith(REQUEST_ID_NODE_NAME_SUFFIX)) {
            continue;
        }

        if (localName.toLowerCase(Locale.ROOT).endsWith(REQUEST_CREATE_NODE_NAME_SUFFIX)) {
            Item item = Item.createFromDefault(element);
            items.add(item);
            ItemSoapReader itemSoapReader = new ItemSoapReader(requestContext.getDOMSource(),reateChildNode, (ItemListDefinitionBase) element);
            ItemReaderResult itemReaderResult = itemSoapReader.readItem();
            item.initialize(itemReaderResult, null);
            item.commitDraft();
        }

Aucun commentaire:

Enregistrer un commentaire