require 'chilkat'
xml = Chilkat::CkXml.new()
xml.put_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.put_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 = Chilkat::CkHttp.new()
http.ClearHeaders()
http.SetRequestHeader("Content-Type",contentType)
http.SetRequestHeader("SOAPAction",soapAction)
# resp is a CkHttpResponse
resp = http.PostXml(endpoint,soapRequestBody,"utf-8")
if (http.get_LastMethodSuccess() == false)
print http.lastErrorText() + "\n";
print"Failed to send SOAP request." + "\n";
exitend# Get the XML response body.
responseXml = Chilkat::CkXml.new()
resp.GetBodyXml(responseXml)
statusCode = resp.get_StatusCode()
print"response status code: " + statusCode.to_s() + "\n";
# If the status code does not indicate succcess, then show the response XML,
# which probably contains error information.if (statusCode != 200)
print responseXml.getXml() + "\n";
exitendprint responseXml.getXml() + "\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).
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")