SOAP WSDL Generate Code

AwdbWebServiceSoapBinding / getDataInsertedOrUpdatedSince

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
import sys
import chilkat2

xml = chilkat2.Xml()
xml.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:getDataInsertedOrUpdatedSince|awd:stationTriplets","string")
xml.UpdateChildContent("soapenv:Body|awd:getDataInsertedOrUpdatedSince|awd:elementCd","string")
xml.UpdateChildContentInt("soapenv:Body|awd:getDataInsertedOrUpdatedSince|awd:ordinal",1042)
xml.UpdateChildContent("soapenv:Body|awd:getDataInsertedOrUpdatedSince|awd:heightDepth|awd:unitCd","string")
xml.UpdateChildContent("soapenv:Body|awd:getDataInsertedOrUpdatedSince|awd:heightDepth|awd:value","99.0")
xml.UpdateChildContent("soapenv:Body|awd:getDataInsertedOrUpdatedSince|awd:duration","DAILY")
xml.UpdateChildContent("soapenv:Body|awd:getDataInsertedOrUpdatedSince|awd:getFlags","true")
xml.UpdateChildContent("soapenv:Body|awd:getDataInsertedOrUpdatedSince|awd:beginDate","string")
xml.UpdateChildContent("soapenv:Body|awd:getDataInsertedOrUpdatedSince|awd:endDate","string")
xml.UpdateChildContent("soapenv:Body|awd:getDataInsertedOrUpdatedSince|awd:insertOrUpdateBeginDate","string")
xml.UpdateChildContent("soapenv:Body|awd:getDataInsertedOrUpdatedSince|awd:alwaysReturnDailyFeb29","true")

# 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.EmitXmlDecl = False
soapRequestBody = xml.GetXml()

endpoint = "https://wcc.sc.egov.usda.gov/awdbWebService/services"
soapAction = ""
#  For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
contentType = "text/xml"

http = chilkat2.Http()

http.ClearHeaders()
http.SetRequestHeader("Content-Type",contentType)
http.SetRequestHeader("SOAPAction",soapAction)

# resp is a CkHttpResponse
resp = http.PostXml(endpoint,soapRequestBody,"utf-8")
if (http.LastMethodSuccess == False):
    print(http.LastErrorText)
    print("Failed to send SOAP request.")
    sys.exit()

# Get the XML response body.
responseXml = chilkat2.Xml()
resp.GetBodyXml(responseXml)

statusCode = resp.StatusCode
print("response status code: " + str(statusCode))

# If the status code does not indicate succcess, then show the response XML,
# which probably contains error information.
if (statusCode != 200):
    print(responseXml.GetXml())
    sys.exit()

print(responseXml.GetXml())

# 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).

beginDate = responseXml.GetChildContent("*:Body|*:getDataInsertedOrUpdatedSinceResponse|*:return|*:beginDate")
collectionDate = responseXml.GetChildContent("*:Body|*:getDataInsertedOrUpdatedSinceResponse|*:return|*:dataContentList|*:collectionDate")
flag = responseXml.GetChildContent("*:Body|*:getDataInsertedOrUpdatedSinceResponse|*:return|*:dataContentList|*:flag")
timestamp = responseXml.GetChildContent("*:Body|*:getDataInsertedOrUpdatedSinceResponse|*:return|*:dataContentList|*:timestamp")
value = responseXml.GetChildContent("*:Body|*:getDataInsertedOrUpdatedSinceResponse|*:return|*:dataContentList|*:value")
duration = responseXml.GetChildContent("*:Body|*:getDataInsertedOrUpdatedSinceResponse|*:return|*:duration")
elementCd = responseXml.GetChildContent("*:Body|*:getDataInsertedOrUpdatedSinceResponse|*:return|*:elementCd")
endDate = responseXml.GetChildContent("*:Body|*:getDataInsertedOrUpdatedSinceResponse|*:return|*:endDate")
stationTriplet = responseXml.GetChildContent("*:Body|*:getDataInsertedOrUpdatedSinceResponse|*:return|*:stationTriplet")
timezoneOffset = responseXml.GetChildIntValue("*:Body|*:getDataInsertedOrUpdatedSinceResponse|*:return|*:timezoneOffset")
unitCd = responseXml.GetChildContent("*:Body|*:getDataInsertedOrUpdatedSinceResponse|*: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:getDataInsertedOrUpdatedSince>
            <awd:stationTriplets>string</awd:stationTriplets>
            <awd:elementCd>string</awd:elementCd>
            <awd:ordinal>1042</awd:ordinal>
            <awd:heightDepth>
                <awd:unitCd>string</awd:unitCd>
                <awd:value>99.0</awd:value>
            </awd:heightDepth>
            <awd:duration>DAILY</awd:duration>
            <awd:getFlags>true</awd:getFlags>
            <awd:beginDate>string</awd:beginDate>
            <awd:endDate>string</awd:endDate>
            <awd:insertOrUpdateBeginDate>string</awd:insertOrUpdateBeginDate>
            <awd:alwaysReturnDailyFeb29>true</awd:alwaysReturnDailyFeb29>
        </awd:getDataInsertedOrUpdatedSince>
    </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:getDataInsertedOrUpdatedSinceResponse>
            <awd:return>
                <awd:beginDate>string</awd:beginDate>
                <awd:dataContentList>
                    <awd:collectionDate>string</awd:collectionDate>
                    <awd:flag>string</awd:flag>
                    <awd:timestamp>string</awd:timestamp>
                    <awd:value>99.0</awd:value>
                </awd:dataContentList>
                <awd:duration>DAILY</awd:duration>
                <awd:elementCd>string</awd:elementCd>
                <awd:endDate>string</awd:endDate>
                <awd:stationTriplet>string</awd:stationTriplet>
                <awd:timezoneOffset>1042</awd:timezoneOffset>
                <awd:unitCd>string</awd:unitCd>
            </awd:return>
        </awd:getDataInsertedOrUpdatedSinceResponse>
    </soapenv:Body>
</soapenv:Envelope>