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
#include <CkXml.h>
#include <CkHttp.h>
#include <CkHttpResponse.h>
void ChilkatSample(void)
{
CkXml xml;
xml.put_Tag("soap:Envelope");
xml.AddAttribute("xmlns:soap","http://www.w3.org/2003/05/soap-envelope");
xml.AddAttribute("xmlns:spr","http://www.springcm.com/atlas/webservices/v201308/scm/");
xml.UpdateChildContent("soap:Header","");
xml.UpdateChildContent("soap:Body|spr:ContactFind|spr:token","string");
xml.UpdateChildContent("soap:Body|spr:ContactFind|spr:SearchText","string");
xml.UpdateChildContent("soap:Body|spr:ContactFind|spr:IncludeDeleted","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.put_EmitXmlDecl(false);
const char *soapRequestBody = xml.getXml();
const char *endpoint = "https://soapna11.springcm.com/atlas/webservices/v201308/springcmservice.asmx";
const char *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"
const char *contentType = "text/xml";
CkHttp http;
http.ClearHeaders();
http.SetRequestHeader("Content-Type",contentType);
http.SetRequestHeader("SOAPAction",soapAction);
CkHttpResponse *resp = http.PostXml(endpoint,soapRequestBody,"utf-8");
if (http.get_LastMethodSuccess() == false) {
std::cout << http.lastErrorText() << "\r\n";
std::cout << "Failed to send SOAP request." << "\r\n";
return;
}
// Get the XML response body.
CkXml responseXml;
resp->GetBodyXml(responseXml);
int statusCode = resp->get_StatusCode();
std::cout << "response status code: " << statusCode << "\r\n";
delete resp;
// If the status code does not indicate succcess, then show the response XML,
// which probably contains error information.
if (statusCode != 200) {
std::cout << responseXml.getXml() << "\r\n";
return;
}
std::cout << responseXml.getXml() << "\r\n";
// 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).
const char *Id = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Id");
const char *Name = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Name");
const char *ObjectType = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:ObjectType");
const char *v_Email = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Email");
const char *FirstName = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:FirstName");
const char *LastName = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:LastName");
const char *PhoneNumber = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:PhoneNumber");
const char *FaxNumber = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:FaxNumber");
const char *Company = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Company");
const char *Department = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Department");
const char *Title = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Title");
const char *Address1 = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Address1");
const char *Address2 = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Address2");
const char *Address3 = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Address3");
const char *City = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:City");
const char *ProvinceState = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:ProvinceState");
const char *PostalCode = responseXml.getChildContent("*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:PostalCode");
const char *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>