Skip to main content
Solved

Multiple SOAP requesta


Forum|alt.badge.img

Hi all!

I want to request the monthly average exchange rate for a whole year.

So far, I have transformed the soap request to xml and pasted it into the xml templater.

XML request in the XML templater requesting the monthly average rate in January I then post the request by the HTTPCaller and extract attributes by means of the XMLFragmenter. This works fine as long as I request the monthly average exchange rate of one month of a specified year at the time.

However, here is were I am stuck: To get all monthly average exchange rate I would need to post 12 request, one for each month.

My idea was to do this by means of sub templates, but I have not succeeded in doing so. I tried to import a file containing a list from 1 to 12 (1= january...12=december) and connect this list to the sub port.

The root xml requestTrying out the sub template I could add 12 xml templater and httpcaller instead, but this does not seem very effective.

Is it possible to achieve this by sub template?

Or is there a way to dublicate requests or is it in some way possible to loop through the request?

Any ideas and help are welcome!

Thanks in advance!

 

 

Best answer by daveatsafe

Hi @ingridantonsen​,

Please use a Cloner transformer to create 12 copies of the year feature, one for each month. The cloned copies will have a copy number on them that can be used to set the month in the XMLTemplater:

Screen Shot 2023-04-19 at 11.25.04 AMThe Cloner begins counting at 0, so you will need to use an AttributeCreator to add 1 to the count attribute to get correct month values.

Use the following in the template:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://swea.riksbank.se/xsd">
    <soap:Header/>
    <soap:Body>
        <xsd:getMonthlyAverageExchangeRates>
            <year>$(Year)</year>
            <month>{fme:get-attribute("_month")}</month>
            <languageid>en</languageid>
        </xsd:getMonthlyAverageExchangeRates>
    </soap:Body>
</soap:Envelope>

You will now have 12 request features for the HTTPCaller - one for each month.

 

View original
Did this help you find an answer to your question?

2 replies

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • Best Answer
  • April 19, 2023

Hi @ingridantonsen​,

Please use a Cloner transformer to create 12 copies of the year feature, one for each month. The cloned copies will have a copy number on them that can be used to set the month in the XMLTemplater:

Screen Shot 2023-04-19 at 11.25.04 AMThe Cloner begins counting at 0, so you will need to use an AttributeCreator to add 1 to the count attribute to get correct month values.

Use the following in the template:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://swea.riksbank.se/xsd">
    <soap:Header/>
    <soap:Body>
        <xsd:getMonthlyAverageExchangeRates>
            <year>$(Year)</year>
            <month>{fme:get-attribute("_month")}</month>
            <languageid>en</languageid>
        </xsd:getMonthlyAverageExchangeRates>
    </soap:Body>
</soap:Envelope>

You will now have 12 request features for the HTTPCaller - one for each month.

 


Forum|alt.badge.img

Thanks you so very much for your help and effort @daveatsafe​ . It works perfectly. Thanks again!

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings