SOAP WSDL Generate Code

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 <CkXmlW.h>
#include <CkHttpW.h>
#include <CkHttpResponseW.h>

void ChilkatSample(void)
    {
    CkXmlW xml;
    xml.put_Tag(L"soap:Envelope");
    xml.AddAttribute(L"xmlns:soap",L"http://www.w3.org/2003/05/soap-envelope");
    xml.AddAttribute(L"xmlns:spr",L"http://www.springcm.com/atlas/webservices/v201308/scm/");
    xml.UpdateChildContent(L"soap:Header",L"");
    xml.UpdateChildContent(L"soap:Body|spr:ContactFind|spr:token",L"string");
    xml.UpdateChildContent(L"soap:Body|spr:ContactFind|spr:SearchText",L"string");
    xml.UpdateChildContent(L"soap:Body|spr:ContactFind|spr:IncludeDeleted",L"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 wchar_t *soapRequestBody = xml.getXml();

    const wchar_t *endpoint = L"https://soapna11.springcm.com/atlas/webservices/v201308/springcmservice.asmx";
    const wchar_t *soapAction = L"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 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).

    const wchar_t *Id = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Id");
    const wchar_t *Name = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Name");
    const wchar_t *ObjectType = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:ObjectType");
    const wchar_t *v_Email = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Email");
    const wchar_t *FirstName = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:FirstName");
    const wchar_t *LastName = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:LastName");
    const wchar_t *PhoneNumber = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:PhoneNumber");
    const wchar_t *FaxNumber = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:FaxNumber");
    const wchar_t *Company = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Company");
    const wchar_t *Department = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Department");
    const wchar_t *Title = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Title");
    const wchar_t *Address1 = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Address1");
    const wchar_t *Address2 = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Address2");
    const wchar_t *Address3 = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:Address3");
    const wchar_t *City = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:City");
    const wchar_t *ProvinceState = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:ProvinceState");
    const wchar_t *PostalCode = responseXml.getChildContent(L"*:Body|*:ContactFindResponse|*:ContactFindResult|*:SCMContactInfo|*:PostalCode");
    const wchar_t *Country = responseXml.getChildContent(L"*: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>