SOAP WSDL Generate Code

DataServiceEndpointSoapBinding / getAllTypes

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 = @"soapenv:Envelope";
[xml AddAttribute: @"xmlns:intf" value: @"http://data.webservice.workshop.vivid.nl"];
[xml AddAttribute: @"xmlns:soapenv" value: @"http://schemas.xmlsoap.org/soap/envelope/"];
[xml UpdateChildContent: @"soapenv:Header" value: @""];
[xml UpdateChildContent: @"soapenv:Body|intf:getAllTypes|intf:vrid" value: @"xml"];
[xml UpdateChildContent: @"soapenv:Body|intf:getAllTypes|intf:modelId" value: @"xml"];

// 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 = @"http://www.haynespro-services.com/workshopServices3/services/DataServiceEndpoint";
NSString *soapAction = @"";
//  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).

NSString *confirmationLink = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:status|*:confirmationLink"];
NSString *statusCode = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:status|*:statusCode"];
NSString *id = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:id"];
NSString *faultcodes = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:subjects|*:faultcodes"];
NSString *fusesandrelays = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:subjects|*:fusesandrelays"];
NSString *repairmanuals = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:subjects|*:repairmanuals"];
NSString *shownew = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:subjects|*:shownew"];
NSString *showoldabs = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:subjects|*:showoldabs"];
NSString *showoldmm = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:subjects|*:showoldmm"];
NSString *wiringdiagrams = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:subjects|*:wiringdiagrams"];
NSString *ty_end_year = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:ty_end_year"];
NSString *ty_engine_code = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:ty_engine_code"];
NSString *ty_model_id = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:ty_model_id"];
NSString *ty_name = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:ty_name"];
NSString *ty_power = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:ty_power"];
NSString *ty_start_year = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:ty_start_year"];
NSString *ty_used = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:ty_used"];
NSString *ty_volume = [responseXml GetChildContent: @"*:Body|*:getAllTypesResponse|*:getAllTypesReturn|*:typeArray|*:item|*:ty_volume"];
Request XML
<soapenv:Envelope xmlns:intf="http://data.webservice.workshop.vivid.nl" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header/>
    <soapenv:Body>
        <intf:getAllTypes>
            <intf:vrid>xml</intf:vrid>
            <intf:modelId>xml</intf:modelId>
        </intf:getAllTypes>
    </soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns2="http://datatypes.webservice.elecdata.vivid.nl" xmlns:tns1="http://datamodel.webservice.elecdata.vivid.nl" xmlns:intf="http://data.webservice.workshop.vivid.nl">
    <soapenv:Header/>
    <soapenv:Body>
        <intf:getAllTypesResponse>
            <intf:getAllTypesReturn>
                <tns1:status>
                    <intf:confirmationLink>xml</intf:confirmationLink>
                    <intf:statusCode>xml</intf:statusCode>
                </tns1:status>
                <tns1:typeArray>
                    <intf:item>
                        <tns2:id>xml</tns2:id>
                        <tns2:subjects>
                            <tns1:faultcodes>xml</tns1:faultcodes>
                            <tns1:fusesandrelays>xml</tns1:fusesandrelays>
                            <tns1:repairmanuals>xml</tns1:repairmanuals>
                            <tns1:shownew>xml</tns1:shownew>
                            <tns1:showoldabs>xml</tns1:showoldabs>
                            <tns1:showoldmm>xml</tns1:showoldmm>
                            <tns1:wiringdiagrams>xml</tns1:wiringdiagrams>
                        </tns2:subjects>
                        <tns2:ty_end_year>xml</tns2:ty_end_year>
                        <tns2:ty_engine_code>xml</tns2:ty_engine_code>
                        <tns2:ty_model_id>xml</tns2:ty_model_id>
                        <tns2:ty_name>xml</tns2:ty_name>
                        <tns2:ty_power>xml</tns2:ty_power>
                        <tns2:ty_start_year>xml</tns2:ty_start_year>
                        <tns2:ty_used>xml</tns2:ty_used>
                        <tns2:ty_volume>xml</tns2:ty_volume>
                    </intf:item>
                </tns1:typeArray>
            </intf:getAllTypesReturn>
        </intf:getAllTypesResponse>
    </soapenv:Body>
</soapenv:Envelope>