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 <CkoXml.h>
#import <NSString.h>
#import <CkoHttp.h>
#import <CkoHttpResponse.h>

CkoXml *xml = [[CkoXml alloc] init];
xml.Tag = @"soap:Envelope";
[xml AddAttribute: @"xmlns:tra" value: @"http://training.gov.au/services/12/"];
[xml AddAttribute: @"xmlns:soap" value: @"http://www.w3.org/2003/05/soap-envelope"];
[xml AddAttribute: @"xmlns:arr" value: @"http://schemas.microsoft.com/2003/10/Serialization/Arrays"];
[xml UpdateChildContent: @"soap:Header" value: @""];
[xml UpdateChildContentInt: @"soap:Body|tra:SearchByScope|tra:request|tra:PageNumber" value: [NSNumber numberWithInt: 1042]];
[xml UpdateChildContentInt: @"soap:Body|tra:SearchByScope|tra:request|tra:PageSize" value: [NSNumber numberWithInt: 1042]];
[xml UpdateChildContent: @"soap:Body|tra:SearchByScope|tra:request|tra:Filter" value: @"string"];
[xml UpdateChildContent: @"soap:Body|tra:SearchByScope|tra:request|tra:IncludeImplicitScope" value: @"true"];
[xml UpdateChildContent: @"soap:Body|tra:SearchByScope|tra:request|tra:IncludeLegacyData" value: @"true"];
[xml UpdateChildContent: @"soap:Body|tra:SearchByScope|tra:request|tra:RegistrationManagers|arr:string" value: @"string"];
[xml UpdateChildContent: @"soap:Body|tra:SearchByScope|tra:request|tra:SearchTrainingPackageContents" value: @"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 = NO;
NSString *soapRequestBody = [xml GetXml];

NSString *endpoint = @"https://ws.staging.training.gov.au/Deewr.Tga.WebServices/OrganisationServiceV12.svc/Organisation12";
NSString *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"
NSString *contentType = @"text/xml";

CkoHttp *http = [[CkoHttp alloc] init];

[http ClearHeaders];
[http SetRequestHeader: @"Content-Type" value: contentType];
[http SetRequestHeader: @"SOAPAction" value: soapAction];

CkoHttpResponse *resp = [http PostXml: endpoint xmlDoc: soapRequestBody charset: @"utf-8"];
if (http.LastMethodSuccess == NO) {
    NSLog(@"%@",http.LastErrorText);
    NSLog(@"%@",@"Failed to send SOAP request.");
    return;
}

// Get the XML response body.
CkoXml *responseXml = [[CkoXml alloc] init];
[resp GetBodyXml: responseXml];

int statusCode = [resp.StatusCode intValue];
NSLog(@"%@%d",@"response status code: ",statusCode);

// If the status code does not indicate succcess, then show the response XML,
// which probably contains error information.
if (statusCode != 200) {
    NSLog(@"%@",[responseXml GetXml]);
    return;
}

NSLog(@"%@",[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: @"*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Count"] intValue];
int PageNumber = [[responseXml GetChildIntValue: @"*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:PageNumber"] intValue];
int PageSize = [[responseXml GetChildIntValue: @"*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:PageSize"] intValue];
NSString *Code = [responseXml GetChildContent: @"*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:Code"];
NSString *DataManagerCode = [responseXml GetChildContent: @"*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:DataManagerCode"];
NSString *HasActiveRegistration = [responseXml GetChildContent: @"*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:HasActiveRegistration"];
NSString *IsLegacyData = [responseXml GetChildContent: @"*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:IsLegacyData"];
NSString *LegalPersonName = [responseXml GetChildContent: @"*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:LegalPersonName"];
NSString *RegistrationStatus = [responseXml GetChildContent: @"*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:RegistrationStatus"];
NSString *TradingName = [responseXml GetChildContent: @"*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:TradingName"];
NSString *DateTime = [responseXml GetChildContent: @"*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:UpdatedDate|*:DateTime"];
int OffsetMinutes = [[responseXml GetChildIntValue: @"*:Body|*:SearchByScopeResponse|*:SearchByScopeResult|*:Results|*:OrganisationSearchResultItem|*:UpdatedDate|*:OffsetMinutes"] intValue];
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>