Import mapping for a convoluted Key-Value response from a web service
Hello experts, I am trying to generate an import mapping for a response returned from a web service, an example of which as observed in the $latestHttpResponse/Content, is pasted below. Using the entities and associations generated by the automatic mapping feature , results in none of them being populated by the response of this web service. Is there a quick way of creating an import mapping that could correspond to the schema of this response? Any suggestions? Thanks in advance. <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><getProductResponse xmlns="http://ofbiz.apache.org/service/"><map-Map> <map-Entry> <map-Key> <std-String value="product"></std-String> </map-Key> <map-Value> <eeval-Product createdStamp="2020-03-11 10:34:31.81" createdTxStamp="2020-03-11 10:34:30.253" description="Giant Widget with Wheels" internalName="Giant Widget variant explosion" isVariant="N" isVirtual="Y" largeImageUrl="/images/products/WG-9943/large.png" lastUpdatedStamp="2020-03-11 10:35:00.198" lastUpdatedTxStamp="2020-03-11 10:34:59.968" longDescription="This giant widget is mobile. It will seat one person safely. The wheels will never rust or break. Quite a unique item." primaryProductCategoryId="202" productId="WG-9943" productName="Giant Widget with variant explosion" productTypeId="FINISHED_GOOD" quantityIncluded="10.000000" smallImageUrl="/images/products/WG-9943/small.png" virtualVariantMethodEnum="VV_VARIANTTREE" weight="22.000000"></eeval-Product> </map-Value> </map-Entry> <map-Entry> <map-Key> <std-String value="responseMessage"></std-String> </map-Key> <map-Value> <std-String value="success"></std-String> </map-Value> </map-Entry> </map-Map></getProductResponse></soapenv:Body></soapenv:Envelope>
The problem with this XML is that you vahe two map-Entry both containing a map-Key and map-Values but seem to belong to the same object. What you might want to do is in the mapping creating a microflow for retrieving the map-Key and map-Value objects. Because then you can do some string comparison the remove the responseMessage and the succes message. You could offcourse ask the other side to provide a better XML because this one is just lousy programming IMHO. But they probably will not do that.