SOAP WSDL Generate Code

OneClickForAppBindingV3 / retrievePageFormats

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 <C_CkXmlW.h>
#include <C_CkHttpW.h>
#include <C_CkHttpResponseW.h>

void ChilkatSample(void)
    {
    HCkXmlW xml;
    const wchar_t *soapRequestBody;
    const wchar_t *endpoint;
    const wchar_t *soapAction;
    const wchar_t *contentType;
    HCkHttpW http;
    HCkHttpResponseW resp;
    HCkXmlW responseXml;
    int statusCode;
    const wchar_t *id;
    const wchar_t *isAddressPossible;
    const wchar_t *isImagePossible;
    const wchar_t *name;
    const wchar_t *description;
    const wchar_t *pageType;
    const wchar_t *x;
    const wchar_t *y;
    const wchar_t *orientation;
    const wchar_t *labelX;
    const wchar_t *labelY;
    const wchar_t *top;
    const wchar_t *bottom;
    const wchar_t *left;
    const wchar_t *right;

    xml = CkXmlW_Create();
    CkXmlW_putTag(xml,L"soapenv:Envelope");
    CkXmlW_AddAttribute(xml,L"xmlns:soapenv",L"http://schemas.xmlsoap.org/soap/envelope/");
    CkXmlW_AddAttribute(xml,L"xmlns:v3",L"http://oneclickforapp.dpag.de/V3");
    CkXmlW_UpdateChildContent(xml,L"soapenv:Header",L"");
    CkXmlW_UpdateChildContent(xml,L"soapenv:Body|v3:RetrievePageFormatsRequest",L"");

    // In a SOAP HTTP request, including the XML declaration (<?xml version="1.0" encoding="UTF-8"?>) in the XML body is generally not required. 
    CkXmlW_putEmitXmlDecl(xml,FALSE);
    soapRequestBody = CkXmlW_getXml(xml);

    endpoint = L"https://internetmarke.deutschepost.de/OneClickForApp/OneClickForAppServiceV3/OneClickForAppV3EJB";
    soapAction = L" ";
    //  For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
    contentType = L"text/xml";

    http = CkHttpW_Create();

    CkHttpW_ClearHeaders(http);
    CkHttpW_SetRequestHeader(http,L"Content-Type",contentType);
    CkHttpW_SetRequestHeader(http,L"SOAPAction",soapAction);

    resp = CkHttpW_PostXml(http,endpoint,soapRequestBody,L"utf-8");
    if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        wprintf(L"Failed to send SOAP request.\n");
        CkXmlW_Dispose(xml);
        CkHttpW_Dispose(http);
        return;
    }

    // Get the XML response body.
    responseXml = CkXmlW_Create();
    CkHttpResponseW_GetBodyXml(resp,responseXml);

    statusCode = CkHttpResponseW_getStatusCode(resp);
    wprintf(L"response status code: %d\n",statusCode);

    CkHttpResponseW_Dispose(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",CkXmlW_getXml(responseXml));
        CkXmlW_Dispose(xml);
        CkHttpW_Dispose(http);
        CkXmlW_Dispose(responseXml);
        return;
    }

    wprintf(L"%s\n",CkXmlW_getXml(responseXml));

    // 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).

    id = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:id");
    isAddressPossible = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:isAddressPossible");
    isImagePossible = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:isImagePossible");
    name = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:name");
    description = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:description");
    pageType = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageType");
    x = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:size|*:x");
    y = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:size|*:y");
    orientation = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:orientation");
    x = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:labelSpacing|*:x");
    y = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:labelSpacing|*:y");
    labelX = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:labelCount|*:labelX");
    labelY = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:labelCount|*:labelY");
    top = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:margin|*:top");
    bottom = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:margin|*:bottom");
    left = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:margin|*:left");
    right = CkXmlW_getChildContent(responseXml,L"*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:margin|*:right");


    CkXmlW_Dispose(xml);
    CkHttpW_Dispose(http);
    CkXmlW_Dispose(responseXml);

    }
Request XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://oneclickforapp.dpag.de/V3">
    <soapenv:Header/>
    <soapenv:Body>
        <v3:RetrievePageFormatsRequest/>
    </soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://oneclickforapp.dpag.de/V3">
    <soapenv:Header/>
    <soapenv:Body>
        <v3:RetrievePageFormatsResponse>
            <v3:pageFormat>
                <v3:id>int</v3:id>
                <v3:isAddressPossible>true</v3:isAddressPossible>
                <v3:isImagePossible>true</v3:isImagePossible>
                <v3:name>string</v3:name>
                <v3:description>string</v3:description>
                <v3:pageType>REGULARPAGE</v3:pageType>
                <v3:pageLayout>
                    <v3:size>
                        <v3:x>456.00</v3:x>
                        <v3:y>456.00</v3:y>
                    </v3:size>
                    <v3:orientation>LANDSCAPE</v3:orientation>
                    <v3:labelSpacing>
                        <v3:x>456.00</v3:x>
                        <v3:y>456.00</v3:y>
                    </v3:labelSpacing>
                    <v3:labelCount>
                        <v3:labelX>int</v3:labelX>
                        <v3:labelY>int</v3:labelY>
                    </v3:labelCount>
                    <v3:margin>
                        <v3:top>456.00</v3:top>
                        <v3:bottom>456.00</v3:bottom>
                        <v3:left>456.00</v3:left>
                        <v3:right>456.00</v3:right>
                    </v3:margin>
                </v3:pageLayout>
            </v3:pageFormat>
        </v3:RetrievePageFormatsResponse>
    </soapenv:Body>
</soapenv:Envelope>