<commit_before>!define URL {http://wsf.cdyne.com/WeatherWS/Weather.asmx}

!2 Body in Wiki

Send a HTTP POST supplying the content to post in a variable so the script table does not have newlines in its cells. 

!define POST_BODY { {{{
<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/">
  <s11:Body>
    <ns1:GetCityWeatherByZIP xmlns:ns1="http://ws.cdyne.com/WeatherWS/">
      <ns1:ZIP>90210</ns1:ZIP>
    </ns1:GetCityWeatherByZIP>
  </s11:Body>
</s11:Envelope>
}}} }

|script         |xml http test                                                       |
|post           |${POST_BODY}   |to                   |${URL}                        |
|check          |response status|200                                                 |
|show           |response                                                            |
|register prefix|weather        |for namespace        |http://ws.cdyne.com/WeatherWS/|
|check          |xPath          |//weather:City/text()|Beverly Hills                 |


!2 Body via scenario

Using a scenario allows us to generate multiple request, only changing certain values.

!*> Scenario definition
!define POST_BODY_2 { {{{
<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/">
  <s11:Body>
    <ns1:GetCityWeatherByZIP xmlns:ns1="http://ws.cdyne.com/WeatherWS/">
      <ns1:ZIP>@{zip}</ns1:ZIP>
    </ns1:GetCityWeatherByZIP>
  </s11:Body>
</s11:Envelope>
}}} }

|script|xml http test|

|auto-scenario  |send request                                                        |
|post           |${POST_BODY_2} |to                   |${URL}                        |
|check          |response status|200                                                 |
|show           |response                                                            |
|register prefix|weather        |for namespace        |http://ws.cdyne.com/WeatherWS/|
|check          |xPath          |//weather:City/text()|@{City}                       |
*!

|send request       |
|zip  |City         |
|10007|New York     |
|94102|San Francisco|

!2 Http GET

Performs HTTP GET instead of POST

|script         |xml http test                                                       |
|set value      |90210          |for                  |ZIP                           |
|get from       |${URL}/GetCityWeatherByZIP                                          |
|check          |response status|200                                                 |
|show           |request                                                             |
|show           |response                                                            |
|register prefix|weather        |for namespace        |http://ws.cdyne.com/WeatherWS/|
|check          |xPath          |//weather:City/text()|Beverly Hills                 |



!2 Body from template

By using a Freemarker template we can have more dynamic body content.

|script          |xml http test                                                                                       |
|template        |samplePost.ftl.xml                                                                                  |
|set value       |http://www.webserviceX.NET/GetWeather  |for header                       |SOAPAction                |
|set value       |Canada                                 |for                              |countryName               |
|post template to|http://www.webservicex.com/globalweather.asmx                                                       |
|check           |response status                        |500                                                         |
|show            |request                                                                                             |
|show            |response                                                                                            |
|register prefix |wsX                                    |for namespace                    |http://www.webserviceX.NET|
|set value       |Vancouver International Air-Port, B. C.|for                              |cityName                  |
|post template to|http://www.webservicex.com/globalweather.asmx                                                       |
|check           |response status                        |200                                                         |
|show            |request                                                                                             |
|show            |response                                                                                            |
|check           |xPath                                  |!-//wsX:GetWeatherResult/text()-!|                          |<commit_msg>Show xpath result instead of checking without expectation<commit_after>!define URL {http://wsf.cdyne.com/WeatherWS/Weather.asmx}

!2 Body in Wiki

Send a HTTP POST supplying the content to post in a variable so the script table does not have newlines in its cells. 

!define POST_BODY { {{{
<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/">
  <s11:Body>
    <ns1:GetCityWeatherByZIP xmlns:ns1="http://ws.cdyne.com/WeatherWS/">
      <ns1:ZIP>90210</ns1:ZIP>
    </ns1:GetCityWeatherByZIP>
  </s11:Body>
</s11:Envelope>
}}} }

|script         |xml http test                                                       |
|post           |${POST_BODY}   |to                   |${URL}                        |
|check          |response status|200                                                 |
|show           |response                                                            |
|register prefix|weather        |for namespace        |http://ws.cdyne.com/WeatherWS/|
|check          |xPath          |//weather:City/text()|Beverly Hills                 |


!2 Body via scenario

Using a scenario allows us to generate multiple request, only changing certain values.

!*> Scenario definition
!define POST_BODY_2 { {{{
<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/">
  <s11:Body>
    <ns1:GetCityWeatherByZIP xmlns:ns1="http://ws.cdyne.com/WeatherWS/">
      <ns1:ZIP>@{zip}</ns1:ZIP>
    </ns1:GetCityWeatherByZIP>
  </s11:Body>
</s11:Envelope>
}}} }

|script|xml http test|

|auto-scenario  |send request                                                        |
|post           |${POST_BODY_2} |to                   |${URL}                        |
|check          |response status|200                                                 |
|show           |response                                                            |
|register prefix|weather        |for namespace        |http://ws.cdyne.com/WeatherWS/|
|check          |xPath          |//weather:City/text()|@{City}                       |
*!

|send request       |
|zip  |City         |
|10007|New York     |
|94102|San Francisco|

!2 Http GET

Performs HTTP GET instead of POST

|script         |xml http test                                                       |
|set value      |90210          |for                  |ZIP                           |
|get from       |${URL}/GetCityWeatherByZIP                                          |
|check          |response status|200                                                 |
|show           |request                                                             |
|show           |response                                                            |
|register prefix|weather        |for namespace        |http://ws.cdyne.com/WeatherWS/|
|check          |xPath          |//weather:City/text()|Beverly Hills                 |



!2 Body from template

By using a Freemarker template we can have more dynamic body content.

|script          |xml http test                                                                   |
|template        |samplePost.ftl.xml                                                              |
|set value       |http://www.webserviceX.NET/GetWeather  |for header   |SOAPAction                |
|set value       |Canada                                 |for          |countryName               |
|post template to|http://www.webservicex.com/globalweather.asmx                                   |
|check           |response status                        |500                                     |
|show            |request                                                                         |
|show            |response                                                                        |
|register prefix |wsX                                    |for namespace|http://www.webserviceX.NET|
|set value       |Vancouver International Air-Port, B. C.|for          |cityName                  |
|post template to|http://www.webservicex.com/globalweather.asmx                                   |
|check           |response status                        |200                                     |
|show            |request                                                                         |
|show            |response                                                                        |
|show            |xPath                                  |!-//wsX:GetWeatherResult/text()-!       |
{'fraction_non_alphanumeric': 0.08745371378784579, 'fraction_numerical': 0.015465040296231757, 'mean_word_length': 0.8559013742926435, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 22}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 108, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4820602', 'n_tokens_mistral': 2170, 'n_tokens_neox': 1994, 'n_words': 472}