SOAP WSDL Generate Code

OrganisationServiceBasicHttpEndpoint / Search

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 <CkXmlW.h>
#include <CkHttpW.h>
#include <CkHttpResponseW.h>

void ChilkatSample(void)
    {
    CkXmlW xml;
    xml.put_Tag(L"soapenv:Envelope");
    xml.AddAttribute(L"xmlns:soapenv",L"http://schemas.xmlsoap.org/soap/envelope/");
    xml.AddAttribute(L"xmlns:tra",L"http://training.gov.au/services/12/");
    xml.AddAttribute(L"xmlns:arr",L"http://schemas.microsoft.com/2003/10/Serialization/Arrays");
    xml.UpdateChildContent(L"soapenv:Header",L"");
    xml.UpdateChildContentInt(L"soapenv:Body|tra:Search|tra:request|tra:PageNumber",1042);
    xml.UpdateChildContentInt(L"soapenv:Body|tra:Search|tra:request|tra:PageSize",1042);
    xml.UpdateChildContent(L"soapenv:Body|tra:Search|tra:request|tra:ClassificationFilters|tra:ClassificationFilter|tra:Scheme",L"string");
    xml.UpdateChildContent(L"soapenv:Body|tra:Search|tra:request|tra:ClassificationFilters|tra:ClassificationFilter|tra:Values|arr:string",L"string");
    xml.UpdateChildContent(L"soapenv:Body|tra:Search|tra:request|tra:CurrentNamesOnly",L"true");
    xml.UpdateChildContent(L"soapenv:Body|tra:Search|tra:request|tra:ExcludeNotRtos",L"true");
    xml.UpdateChildContent(L"soapenv:Body|tra:Search|tra:request|tra:ExcludeRtoWithoutActiveRegistration",L"true");
    xml.UpdateChildContent(L"soapenv:Body|tra:Search|tra:request|tra:Filter",L"string");
    xml.UpdateChildContent(L"soapenv:Body|tra:Search|tra:request|tra:IncludeCode",L"true");
    xml.UpdateChildContent(L"soapenv:Body|tra:Search|tra:request|tra:IncludeLegacyData",L"true");
    xml.UpdateChildContent(L"soapenv:Body|tra:Search|tra:request|tra:RegistrationManagers|arr:string",L"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 wchar_t *soapRequestBody = xml.getXml();

    const wchar_t *endpoint = L"https://ws.staging.training.gov.au/Deewr.Tga.WebServices/OrganisationServiceV12.svc/Organisation";
    const wchar_t *soapAction = L"http://training.gov.au/services/12/IOrganisationService/Search";
    //  For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
    const wchar_t *contentType = L"text/xml";

    CkHttpW http;

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

    CkHttpResponseW *resp = http.PostXml(endpoint,soapRequestBody,L"utf-8");
    if (http.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",http.lastErrorText());
        wprintf(L"Failed to send SOAP request.\n");
        return;
    }

    // Get the XML response body.
    CkXmlW responseXml;
    resp->GetBodyXml(responseXml);

    int statusCode = resp->get_StatusCode();
    wprintf(L"response status code: %d\n",statusCode);

    delete resp;

    // If the status code does not indicate succcess, then show the response XML,
    // which probably contains error information.
    if (statusCode != 200) {
        wprintf(L"%s\n",responseXml.getXml());
        return;
    }

    wprintf(L"%s\n",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).

    int Count = responseXml.GetChildIntValue(L"*:Body|*:SearchResponse|*:SearchResult|*:Count");
    int PageNumber = responseXml.GetChildIntValue(L"*:Body|*:SearchResponse|*:SearchResult|*:PageNumber");
    int PageSize = responseXml.GetChildIntValue(L"*:Body|*:SearchResponse|*:SearchResult|*:PageSize");
    const wchar_t *Code = responseXml.getChildContent(L"*:Body|*:SearchResponse|*:SearchResult|*:Results|*:OrganisationSearchResultItem|*:Code");
    const wchar_t *DataManagerCode = responseXml.getChildContent(L"*:Body|*:SearchResponse|*:SearchResult|*:Results|*:OrganisationSearchResultItem|*:DataManagerCode");
    const wchar_t *HasActiveRegistration = responseXml.getChildContent(L"*:Body|*:SearchResponse|*:SearchResult|*:Results|*:OrganisationSearchResultItem|*:HasActiveRegistration");
    const wchar_t *IsLegacyData = responseXml.getChildContent(L"*:Body|*:SearchResponse|*:SearchResult|*:Results|*:OrganisationSearchResultItem|*:IsLegacyData");
    const wchar_t *LegalPersonName = responseXml.getChildContent(L"*:Body|*:SearchResponse|*:SearchResult|*:Results|*:OrganisationSearchResultItem|*:LegalPersonName");
    const wchar_t *RegistrationStatus = responseXml.getChildContent(L"*:Body|*:SearchResponse|*:SearchResult|*:Results|*:OrganisationSearchResultItem|*:RegistrationStatus");
    const wchar_t *TradingName = responseXml.getChildContent(L"*:Body|*:SearchResponse|*:SearchResult|*:Results|*:OrganisationSearchResultItem|*:TradingName");
    const wchar_t *DateTime = responseXml.getChildContent(L"*:Body|*:SearchResponse|*:SearchResult|*:Results|*:OrganisationSearchResultItem|*:UpdatedDate|*:DateTime");
    int OffsetMinutes = responseXml.GetChildIntValue(L"*:Body|*:SearchResponse|*:SearchResult|*:Results|*:OrganisationSearchResultItem|*:UpdatedDate|*:OffsetMinutes");
    }
Request XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tra="http://training.gov.au/services/12/" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <soapenv:Header/>
    <soapenv:Body>
        <tra:Search>
            <tra:request>
                <tra:PageNumber>1042</tra:PageNumber>
                <tra:PageSize>1042</tra:PageSize>
                <tra:ClassificationFilters>
                    <tra:ClassificationFilter>
                        <tra:Scheme>string</tra:Scheme>
                        <tra:Values>
                            <arr:string>string</arr:string>
                        </tra:Values>
                    </tra:ClassificationFilter>
                </tra:ClassificationFilters>
                <tra:CurrentNamesOnly>true</tra:CurrentNamesOnly>
                <tra:ExcludeNotRtos>true</tra:ExcludeNotRtos>
                <tra:ExcludeRtoWithoutActiveRegistration>true</tra:ExcludeRtoWithoutActiveRegistration>
                <tra:Filter>string</tra:Filter>
                <tra:IncludeCode>true</tra:IncludeCode>
                <tra:IncludeLegacyData>true</tra:IncludeLegacyData>
                <tra:RegistrationManagers>
                    <arr:string>string</arr:string>
                </tra:RegistrationManagers>
            </tra:request>
        </tra:Search>
    </soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tra="http://training.gov.au/services/12/" xmlns:sys="http://schemas.datacontract.org/2004/07/System">
    <soapenv:Header/>
    <soapenv:Body>
        <tra:SearchResponse>
            <tra:SearchResult>
                <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:SearchResult>
        </tra:SearchResponse>
    </soapenv:Body>
</soapenv:Envelope>