SOAP WSDL Generate Code

OrganisationServiceWsHttpEndpoint / SearchByScope

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 = "soap:Envelope"
xml.AddAttribute("xmlns:tra","http://training.gov.au/services/12/")
xml.AddAttribute("xmlns:soap","http://www.w3.org/2003/05/soap-envelope")
xml.AddAttribute("xmlns:arr","http://schemas.microsoft.com/2003/10/Serialization/Arrays")
xml.UpdateChildContent("soap:Header","")
xml.UpdateChildContentInt("soap:Body|tra:SearchByScope|tra:request|tra:PageNumber",1042)
xml.UpdateChildContentInt("soap:Body|tra:SearchByScope|tra:request|tra:PageSize",1042)
xml.UpdateChildContent("soap:Body|tra:SearchByScope|tra:request|tra:Filter","string")
xml.UpdateChildContent("soap:Body|tra:SearchByScope|tra:request|tra:IncludeImplicitScope","true")
xml.UpdateChildContent("soap:Body|tra:SearchByScope|tra:request|tra:IncludeLegacyData","true")
xml.UpdateChildContent("soap:Body|tra:SearchByScope|tra:request|tra:RegistrationManagers|arr:string","string")
xml.UpdateChildContent("soap:Body|tra:SearchByScope|tra:request|tra:SearchTrainingPackageContents","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://ws.staging.training.gov.au/Deewr.Tga.WebServices/OrganisationServiceV12.svc/Organisation12"
soapAction = "http://training.gov.au/services/12/IOrganisationService/SearchByScope"
#  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).

Count = responseXml.GetChildIntValue("*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Count")
PageNumber = responseXml.GetChildIntValue("*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:PageNumber")
PageSize = responseXml.GetChildIntValue("*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:PageSize")
Code = responseXml.GetChildContent("*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:Code")
DataManagerCode = responseXml.GetChildContent("*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:DataManagerCode")
HasActiveRegistration = responseXml.GetChildContent("*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:HasActiveRegistration")
IsLegacyData = responseXml.GetChildContent("*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:IsLegacyData")
LegalPersonName = responseXml.GetChildContent("*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:LegalPersonName")
RegistrationStatus = responseXml.GetChildContent("*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:RegistrationStatus")
TradingName = responseXml.GetChildContent("*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:TradingName")
DateTime = responseXml.GetChildContent("*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:UpdatedDate|*:DateTime")
OffsetMinutes = responseXml.GetChildIntValue("*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:UpdatedDate|*:OffsetMinutes")
Request XML
<soap:Envelope xmlns:tra="http://training.gov.au/services/12/" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <soap:Header/>
    <soap:Body>
        <tra:SearchByScope>
            <tra:request>
                <tra:PageNumber>1042</tra:PageNumber>
                <tra:PageSize>1042</tra:PageSize>
                <tra:Filter>string</tra:Filter>
                <tra:IncludeImplicitScope>true</tra:IncludeImplicitScope>
                <tra:IncludeLegacyData>true</tra:IncludeLegacyData>
                <tra:RegistrationManagers>
                    <arr:string>string</arr:string>
                </tra:RegistrationManagers>
                <tra:SearchTrainingPackageContents>true</tra:SearchTrainingPackageContents>
            </tra:request>
        </tra:SearchByScope>
    </soap:Body>
</soap:Envelope>
Response XML
<soap:Envelope xmlns:sys="http://schemas.datacontract.org/2004/07/System" xmlns:tra="http://training.gov.au/services/12/" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Header/>
    <soap:Body>
        <tra:SearchByScopeResponse>
            <tra:SearchByScopeResult>
                <tra:Count>1042</tra:Count>
                <tra:PageNumber>1042</tra:PageNumber>
                <tra:PageSize>1042</tra:PageSize>
                <tra:Results>
                    <tra:OrganisationSearchResultItem>
                        <tra:Code>string</tra:Code>
                        <tra:DataManagerCode>string</tra:DataManagerCode>
                        <tra:HasActiveRegistration>true</tra:HasActiveRegistration>
                        <tra:IsLegacyData>true</tra:IsLegacyData>
                        <tra:LegalPersonName>string</tra:LegalPersonName>
                        <tra:RegistrationStatus>string</tra:RegistrationStatus>
                        <tra:TradingName>string</tra:TradingName>
                        <tra:UpdatedDate>
                            <sys:DateTime>dateTime</sys:DateTime>
                            <sys:OffsetMinutes>442</sys:OffsetMinutes>
                        </tra:UpdatedDate>
                    </tra:OrganisationSearchResultItem>
                </tra:Results>
            </tra:SearchByScopeResult>
        </tra:SearchByScopeResponse>
    </soap:Body>
</soap:Envelope>