AwdbWebServiceSoapBinding / getForecastEquations
ASP AutoIt C C (Unicode) C++ C++ (Unicode) C# DataFlex Delphi Foxpro Go Java Node.js Objective-C Perl PHP Extension PowerBuilder Powershell PureBasic Python CkPython Ruby SQL Server Swift TCL VB.NET VB6 VBScript Xojo
#include <CkXml.h>
#include <CkHttp.h>
#include <CkHttpResponse.h>
void ChilkatSample(void)
{
CkXml xml;
xml.put_Tag("soapenv:Envelope");
xml.AddAttribute("xmlns:awd","http://www.wcc.nrcs.usda.gov/ns/awdbWebService");
xml.AddAttribute("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/");
xml.UpdateChildContent("soapenv:Header","");
xml.UpdateChildContent("soapenv:Body|awd:getForecastEquations|awd:stationTriplet","string");
// In a SOAP HTTP request, including the XML declaration (<?xml version="1.0" encoding="UTF-8"?>) in the XML body is generally not required.
xml.put_EmitXmlDecl(false);
const char *soapRequestBody = xml.getXml();
const char *endpoint = "https://wcc.sc.egov.usda.gov/awdbWebService/services";
const char *soapAction = "";
// For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
const char *contentType = "text/xml";
CkHttp http;
http.ClearHeaders();
http.SetRequestHeader("Content-Type",contentType);
http.SetRequestHeader("SOAPAction",soapAction);
CkHttpResponse *resp = http.PostXml(endpoint,soapRequestBody,"utf-8");
if (http.get_LastMethodSuccess() == false) {
std::cout << http.lastErrorText() << "\r\n";
std::cout << "Failed to send SOAP request." << "\r\n";
return;
}
// Get the XML response body.
CkXml responseXml;
resp->GetBodyXml(responseXml);
int statusCode = resp->get_StatusCode();
std::cout << "response status code: " << statusCode << "\r\n";
delete resp;
// If the status code does not indicate succcess, then show the response XML,
// which probably contains error information.
if (statusCode != 200) {
std::cout << responseXml.getXml() << "\r\n";
return;
}
std::cout << responseXml.getXml() << "\r\n";
// Parse the successful SOAP response XML.
// This is a sample of the response XML, but the namespace prefixes will be different.
// We can parse the result using "*" for the namespace prefixes (see below).
const char *comment = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:comment");
const char *dataSource = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:dataSource");
const char *elementCd = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:elementCd");
const char *coefficient = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:coefficient");
const char *dataPeriodDays = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:dataPeriodDays");
const char *dataPeriodMonth = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:dataPeriodMonth");
const char *dataYearFlag = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:dataYearFlag");
const char *beginDate = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:stationElement|*:beginDate");
int dataPrecision = responseXml.GetChildIntValue("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:stationElement|*:dataPrecision");
const char *duration = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:stationElement|*:duration");
elementCd = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:stationElement|*:elementCd");
const char *endDate = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:stationElement|*:endDate");
const char *unitCd = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:stationElement|*:heightDepth|*:unitCd");
const char *value = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:stationElement|*:heightDepth|*:value");
int ordinal = responseXml.GetChildIntValue("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:stationElement|*:ordinal");
const char *originalUnitCd = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:stationElement|*:originalUnitCd");
const char *stationTriplet = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:stationElement|*:stationTriplet");
const char *storedUnitCd = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:stationElement|*:storedUnitCd");
unitCd = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:unitCd");
const char *upstreamForecast = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:equationTerms|*:upstreamForecast");
const char *footnotes = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:footnotes");
const char *forecastCondition = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:forecastCondition");
const char *forecastPeriod = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:forecastPeriod");
const char *forecastType = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:forecastType");
const char *v_function = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:function");
const char *functionArgument = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:functionArgument");
const char *interceptConstant = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:interceptConstant");
int key = responseXml.GetChildIntValue("*:Body|*:getForecastEquationsResponse|*:return|*:key");
const char *maxOfRecord = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:maxOfRecord");
const char *minOfRecord = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:minOfRecord");
const char *monthlyCorrelationCoefficients = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:monthlyCorrelationCoefficients");
const char *monthlyStderrValues = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:monthlyStderrValues");
const char *name = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:name");
int day = responseXml.GetChildIntValue("*:Body|*:getForecastEquationsResponse|*:return|*:publicationMonthsAndDays|*:day");
int month = responseXml.GetChildIntValue("*:Body|*:getForecastEquationsResponse|*:return|*:publicationMonthsAndDays|*:month");
const char *published = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:published");
stationTriplet = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:stationTriplet");
const char *transformErrorsOnly = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:transformErrorsOnly");
unitCd = responseXml.getChildContent("*:Body|*:getForecastEquationsResponse|*:return|*:unitCd");
}
Request XML
<soapenv:Envelope xmlns:awd="http://www.wcc.nrcs.usda.gov/ns/awdbWebService" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<awd:getForecastEquations>
<awd:stationTriplet>string</awd:stationTriplet>
</awd:getForecastEquations>
</soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:awd="http://www.wcc.nrcs.usda.gov/ns/awdbWebService" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<awd:getForecastEquationsResponse>
<awd:return>
<awd:comment>string</awd:comment>
<awd:dataSource>string</awd:dataSource>
<awd:elementCd>string</awd:elementCd>
<awd:equationTerms>
<awd:coefficient>99.0</awd:coefficient>
<awd:dataPeriodDays>string</awd:dataPeriodDays>
<awd:dataPeriodMonth>string</awd:dataPeriodMonth>
<awd:dataYearFlag>string</awd:dataYearFlag>
<awd:stationElement>
<awd:beginDate>string</awd:beginDate>
<awd:dataPrecision>1042</awd:dataPrecision>
<awd:duration>DAILY</awd:duration>
<awd:elementCd>string</awd:elementCd>
<awd:endDate>string</awd:endDate>
<awd:heightDepth>
<awd:unitCd>string</awd:unitCd>
<awd:value>99.0</awd:value>
</awd:heightDepth>
<awd:ordinal>1042</awd:ordinal>
<awd:originalUnitCd>string</awd:originalUnitCd>
<awd:stationTriplet>string</awd:stationTriplet>
<awd:storedUnitCd>string</awd:storedUnitCd>
</awd:stationElement>
<awd:unitCd>string</awd:unitCd>
<awd:upstreamForecast>true</awd:upstreamForecast>
</awd:equationTerms>
<awd:footnotes>string</awd:footnotes>
<awd:forecastCondition>string</awd:forecastCondition>
<awd:forecastPeriod>string</awd:forecastPeriod>
<awd:forecastType>string</awd:forecastType>
<awd:function>string</awd:function>
<awd:functionArgument>99.0</awd:functionArgument>
<awd:interceptConstant>99.0</awd:interceptConstant>
<awd:key>1042</awd:key>
<awd:maxOfRecord>99.0</awd:maxOfRecord>
<awd:minOfRecord>99.0</awd:minOfRecord>
<awd:monthlyCorrelationCoefficients>99.0</awd:monthlyCorrelationCoefficients>
<awd:monthlyStderrValues>99.0</awd:monthlyStderrValues>
<awd:name>string</awd:name>
<awd:publicationMonthsAndDays>
<awd:day>1042</awd:day>
<awd:month>1042</awd:month>
</awd:publicationMonthsAndDays>
<awd:published>true</awd:published>
<awd:stationTriplet>string</awd:stationTriplet>
<awd:transformErrorsOnly>true</awd:transformErrorsOnly>
<awd:unitCd>string</awd:unitCd>
</awd:return>
</awd:getForecastEquationsResponse>
</soapenv:Body>
</soapenv:Envelope>