SpringCMServiceSoap12 / ContactFind
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:soap" value: @"http://www.w3.org/2003/05/soap-envelope"];
[xml AddAttribute: @"xmlns:spr" value: @"http://www.springcm.com/atlas/webservices/v201308/scm/"];
[xml UpdateChildContent: @"soap:Header" value: @""];
[xml UpdateChildContent: @"soap:Body|spr:ContactFind|spr:token" value: @"string"];
[xml UpdateChildContent: @"soap:Body|spr:ContactFind|spr:SearchText" value: @"string"];
[xml UpdateChildContent: @"soap:Body|spr:ContactFind|spr:IncludeDeleted" 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://soapna11.springcm.com/atlas/webservices/v201308/springcmservice.asmx";
NSString *soapAction = @"http://www.springcm.com/atlas/webservices/v201308/scm/ContactFind";
// 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 *Id = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Id"];
NSString *Name = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Name"];
NSString *ObjectType = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:ObjectType"];
NSString *v_Email = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Email"];
NSString *FirstName = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:FirstName"];
NSString *LastName = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:LastName"];
NSString *PhoneNumber = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:PhoneNumber"];
NSString *FaxNumber = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:FaxNumber"];
NSString *Company = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Company"];
NSString *Department = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Department"];
NSString *Title = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Title"];
NSString *Address1 = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Address1"];
NSString *Address2 = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Address2"];
NSString *Address3 = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Address3"];
NSString *City = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:City"];
NSString *ProvinceState = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:ProvinceState"];
NSString *PostalCode = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:PostalCode"];
NSString *Country = [responseXml GetChildContent: @"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Country"];
Request XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:spr="http://www.springcm.com/atlas/webservices/v201308/scm/">
<soap:Header/>
<soap:Body>
<spr:ContactFind>
<spr:token>string</spr:token>
<spr:SearchText>string</spr:SearchText>
<spr:IncludeDeleted>true</spr:IncludeDeleted>
</spr:ContactFind>
</soap:Body>
</soap:Envelope>
Response XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:spr="http://www.springcm.com/atlas/webservices/v201308/scm/">
<soap:Header/>
<soap:Body>
<spr:ContactFindResponse>
<spr:ContactFindResult>
<spr:SCMContactInfo>
<spr:Id>string</spr:Id>
<spr:Name>string</spr:Name>
<spr:ObjectType>Document</spr:ObjectType>
<spr:Email>string</spr:Email>
<spr:FirstName>string</spr:FirstName>
<spr:LastName>string</spr:LastName>
<spr:PhoneNumber>string</spr:PhoneNumber>
<spr:FaxNumber>string</spr:FaxNumber>
<spr:Company>string</spr:Company>
<spr:Department>string</spr:Department>
<spr:Title>string</spr:Title>
<spr:Address1>string</spr:Address1>
<spr:Address2>string</spr:Address2>
<spr:Address3>string</spr:Address3>
<spr:City>string</spr:City>
<spr:ProvinceState>string</spr:ProvinceState>
<spr:PostalCode>string</spr:PostalCode>
<spr:Country>string</spr:Country>
</spr:SCMContactInfo>
</spr:ContactFindResult>
</spr:ContactFindResponse>
</soap:Body>
</soap:Envelope>