OrganisationServiceBasicHttpEndpoint / AddOrganisation
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:sys",L"http://schemas.datacontract.org/2004/07/System");
xml.AddAttribute(L"xmlns:arr",L"http://schemas.microsoft.com/2003/10/Serialization/Arrays");
xml.UpdateChildContent(L"soapenv:Header",L"");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Codes|tra:OrganisationCode|tra:ActionOnEntity",L"None");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Codes|tra:OrganisationCode|tra:EndDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Codes|tra:OrganisationCode|tra:StartDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Codes|tra:OrganisationCode|tra:Code",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:ActionOnEntity",L"None");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:EndDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:StartDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:Email",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:Fax",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:FirstName",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:GroupName",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:JobTitle",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:LastName",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:Mobile",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:OrganisationName",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:Phone",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:PostalAddress|tra:CountryCode",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:PostalAddress|tra:Latitude",L"99.0");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:PostalAddress|tra:Line1",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:PostalAddress|tra:Line2",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:PostalAddress|tra:Longitude",L"99.0");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:PostalAddress|tra:Postcode",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:PostalAddress|tra:StateCode",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:PostalAddress|tra:StateOverseas",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:PostalAddress|tra:Suburb",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:RoleCode",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:Title",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Contacts|tra:Contact|tra:TypeCode",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:CreatedDate|sys:DateTime",L"dateTime");
xml.UpdateChildContentInt(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:CreatedDate|sys:OffsetMinutes",442);
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:DataManagers|tra:DataManagerAssignment|tra:ActionOnEntity",L"None");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:DataManagers|tra:DataManagerAssignment|tra:EndDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:DataManagers|tra:DataManagerAssignment|tra:StartDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:DataManagers|tra:DataManagerAssignment|tra:Code",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:IsLegacyData",L"true");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Locations|tra:OrganisationLocation|tra:ActionOnEntity",L"None");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Locations|tra:OrganisationLocation|tra:EndDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Locations|tra:OrganisationLocation|tra:StartDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Locations|tra:OrganisationLocation|tra:Address|tra:CountryCode",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Locations|tra:OrganisationLocation|tra:Address|tra:Latitude",L"99.0");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Locations|tra:OrganisationLocation|tra:Address|tra:Line1",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Locations|tra:OrganisationLocation|tra:Address|tra:Line2",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Locations|tra:OrganisationLocation|tra:Address|tra:Longitude",L"99.0");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Locations|tra:OrganisationLocation|tra:Address|tra:Postcode",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Locations|tra:OrganisationLocation|tra:Address|tra:StateCode",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Locations|tra:OrganisationLocation|tra:Address|tra:StateOverseas",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Locations|tra:OrganisationLocation|tra:Address|tra:Suburb",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Locations|tra:OrganisationLocation|tra:OrganisationLocationId",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PostalAddresses|tra:OrganisationPostalAddress|tra:ActionOnEntity",L"None");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PostalAddresses|tra:OrganisationPostalAddress|tra:EndDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PostalAddresses|tra:OrganisationPostalAddress|tra:StartDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PostalAddresses|tra:OrganisationPostalAddress|tra:Address|tra:CountryCode",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PostalAddresses|tra:OrganisationPostalAddress|tra:Address|tra:Latitude",L"99.0");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PostalAddresses|tra:OrganisationPostalAddress|tra:Address|tra:Line1",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PostalAddresses|tra:OrganisationPostalAddress|tra:Address|tra:Line2",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PostalAddresses|tra:OrganisationPostalAddress|tra:Address|tra:Longitude",L"99.0");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PostalAddresses|tra:OrganisationPostalAddress|tra:Address|tra:Postcode",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PostalAddresses|tra:OrganisationPostalAddress|tra:Address|tra:StateCode",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PostalAddresses|tra:OrganisationPostalAddress|tra:Address|tra:StateOverseas",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PostalAddresses|tra:OrganisationPostalAddress|tra:Address|tra:Suburb",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PostalAddresses|tra:OrganisationPostalAddress|tra:OrganisationPostalAddressId",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PrincipalAddresses|tra:OrganisationPrincipalAddress|tra:ActionOnEntity",L"None");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PrincipalAddresses|tra:OrganisationPrincipalAddress|tra:EndDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PrincipalAddresses|tra:OrganisationPrincipalAddress|tra:StartDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PrincipalAddresses|tra:OrganisationPrincipalAddress|tra:Address|tra:CountryCode",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PrincipalAddresses|tra:OrganisationPrincipalAddress|tra:Address|tra:Latitude",L"99.0");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PrincipalAddresses|tra:OrganisationPrincipalAddress|tra:Address|tra:Line1",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PrincipalAddresses|tra:OrganisationPrincipalAddress|tra:Address|tra:Line2",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PrincipalAddresses|tra:OrganisationPrincipalAddress|tra:Address|tra:Longitude",L"99.0");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PrincipalAddresses|tra:OrganisationPrincipalAddress|tra:Address|tra:Postcode",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PrincipalAddresses|tra:OrganisationPrincipalAddress|tra:Address|tra:StateCode",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PrincipalAddresses|tra:OrganisationPrincipalAddress|tra:Address|tra:StateOverseas",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PrincipalAddresses|tra:OrganisationPrincipalAddress|tra:Address|tra:Suburb",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:PrincipalAddresses|tra:OrganisationPrincipalAddress|tra:OrganisationPrincipalAddressId",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:ResponsibleLegalPersons|tra:ResponsibleLegalPerson|tra:ActionOnEntity",L"None");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:ResponsibleLegalPersons|tra:ResponsibleLegalPerson|tra:EndDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:ResponsibleLegalPersons|tra:ResponsibleLegalPerson|tra:StartDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:ResponsibleLegalPersons|tra:ResponsibleLegalPerson|tra:Abns|arr:string",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:ResponsibleLegalPersons|tra:ResponsibleLegalPerson|tra:Acn",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:ResponsibleLegalPersons|tra:ResponsibleLegalPerson|tra:Name",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Roles|tra:Role|tra:ActionOnEntity",L"None");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Roles|tra:Role|tra:EndDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Roles|tra:Role|tra:StartDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Roles|tra:Role|tra:Abbreviation",L"string");
xml.UpdateChildContentInt(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Roles|tra:Role|tra:Code",1042);
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Roles|tra:Role|tra:Description",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:TradingNames|tra:TradingName|tra:ActionOnEntity",L"None");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:TradingNames|tra:TradingName|tra:EndDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:TradingNames|tra:TradingName|tra:StartDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:TradingNames|tra:TradingName|tra:Name",L"string");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:UpdatedDate|sys:DateTime",L"dateTime");
xml.UpdateChildContentInt(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:UpdatedDate|sys:OffsetMinutes",442);
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Urls|tra:Url|tra:ActionOnEntity",L"None");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Urls|tra:Url|tra:EndDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Urls|tra:Url|tra:StartDate",L"date");
xml.UpdateChildContent(L"soapenv:Body|tra:AddOrganisation|tra:rtoDto|tra:Urls|tra:Url|tra:Link",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/AddOrganisation";
// 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).
}