SOAP WSDL Generate Code

SpringCMServiceSoap / DocumentMergeCheck

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:spr",L"http://www.springcm.com/atlas/webservices/v201308/scm/");
    xml.UpdateChildContent(L"soapenv:Header",L"");
    xml.UpdateChildContent(L"soapenv:Body|spr:DocumentMergeCheck|spr:token",L"string");
    xml.UpdateChildContent(L"soapenv:Body|spr:DocumentMergeCheck|spr:merges|spr:DocumentMergeResult|spr:MergeId",L"string");
    xml.UpdateChildContent(L"soapenv:Body|spr:DocumentMergeCheck|spr:merges|spr:DocumentMergeResult|spr:IsReady",L"true");
    xml.UpdateChildContentInt(L"soapenv:Body|spr:DocumentMergeCheck|spr:merges|spr:DocumentMergeResult|spr:MaxIndex",1042);
    xml.UpdateChildContent(L"soapenv:Body|spr:DocumentMergeCheck|spr:merges|spr:DocumentMergeResult|spr:Warnings|spr:DocumentMergeWarning|spr:DocumentId",L"string");
    xml.UpdateChildContent(L"soapenv:Body|spr:DocumentMergeCheck|spr:merges|spr:DocumentMergeResult|spr:Warnings|spr:DocumentMergeWarning|spr:Reason",L"NoPDF");
    xml.UpdateChildContent(L"soapenv:Body|spr:DocumentMergeCheck|spr:merges|spr:DocumentMergeResult|spr:StoppedProcessing",L"true");
    xml.UpdateChildContent(L"soapenv:Body|spr:DocumentMergeCheck|spr:merges|spr:DocumentMergeResult|spr:StopReason",L"NoDocument");

    // 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/DocumentMergeCheck";
    //  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 *MergeId = responseXml.getChildContent(L"*:Body|*:DocumentMergeCheckResponse|*:DocumentMergeCheckResult|*:DocumentMergeResult|*:MergeId");
    const wchar_t *IsReady = responseXml.getChildContent(L"*:Body|*:DocumentMergeCheckResponse|*:DocumentMergeCheckResult|*:DocumentMergeResult|*:IsReady");
    int MaxIndex = responseXml.GetChildIntValue(L"*:Body|*:DocumentMergeCheckResponse|*:DocumentMergeCheckResult|*:DocumentMergeResult|*:MaxIndex");
    const wchar_t *DocumentId = responseXml.getChildContent(L"*:Body|*:DocumentMergeCheckResponse|*:DocumentMergeCheckResult|*:DocumentMergeResult|*:Warnings|*:DocumentMergeWarning|*:DocumentId");
    const wchar_t *Reason = responseXml.getChildContent(L"*:Body|*:DocumentMergeCheckResponse|*:DocumentMergeCheckResult|*:DocumentMergeResult|*:Warnings|*:DocumentMergeWarning|*:Reason");
    const wchar_t *StoppedProcessing = responseXml.getChildContent(L"*:Body|*:DocumentMergeCheckResponse|*:DocumentMergeCheckResult|*:DocumentMergeResult|*:StoppedProcessing");
    const wchar_t *StopReason = responseXml.getChildContent(L"*:Body|*:DocumentMergeCheckResponse|*:DocumentMergeCheckResult|*:DocumentMergeResult|*:StopReason");
    }
Request XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:spr="http://www.springcm.com/atlas/webservices/v201308/scm/">
    <soapenv:Header/>
    <soapenv:Body>
        <spr:DocumentMergeCheck>
            <spr:token>string</spr:token>
            <spr:merges>
                <spr:DocumentMergeResult>
                    <spr:MergeId>string</spr:MergeId>
                    <spr:IsReady>true</spr:IsReady>
                    <spr:MaxIndex>1042</spr:MaxIndex>
                    <spr:Warnings>
                        <spr:DocumentMergeWarning>
                            <spr:DocumentId>string</spr:DocumentId>
                            <spr:Reason>NoPDF</spr:Reason>
                        </spr:DocumentMergeWarning>
                    </spr:Warnings>
                    <spr:StoppedProcessing>true</spr:StoppedProcessing>
                    <spr:StopReason>NoDocument</spr:StopReason>
                </spr:DocumentMergeResult>
            </spr:merges>
        </spr:DocumentMergeCheck>
    </soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:spr="http://www.springcm.com/atlas/webservices/v201308/scm/">
    <soapenv:Header/>
    <soapenv:Body>
        <spr:DocumentMergeCheckResponse>
            <spr:DocumentMergeCheckResult>
                <spr:DocumentMergeResult>
                    <spr:MergeId>string</spr:MergeId>
                    <spr:IsReady>true</spr:IsReady>
                    <spr:MaxIndex>1042</spr:MaxIndex>
                    <spr:Warnings>
                        <spr:DocumentMergeWarning>
                            <spr:DocumentId>string</spr:DocumentId>
                            <spr:Reason>NoPDF</spr:Reason>
                        </spr:DocumentMergeWarning>
                    </spr:Warnings>
                    <spr:StoppedProcessing>true</spr:StoppedProcessing>
                    <spr:StopReason>NoDocument</spr:StopReason>
                </spr:DocumentMergeResult>
            </spr:DocumentMergeCheckResult>
        </spr:DocumentMergeCheckResponse>
    </soapenv:Body>
</soapenv:Envelope>