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
-- Important: See this note about {{-https://cknotes.com/sql-sp_oamethod-string-length-return-value-limitations/|||string length limitations for strings returned by sp_OAMethod calls-}}.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    -- Important: Do not use nvarchar(max).  See the {{-https://www.example-code.com/sql/default.asp|||warning about using nvarchar(max)-}}.
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @xml int
    -- Use "Chilkat_9_5_0.Xml" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.Xml', @xml OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    EXEC sp_OASetProperty @xml, 'Tag', 'soapenv:Envelope'
    DECLARE @success int
    EXEC sp_OAMethod @xml, 'AddAttribute', @success OUT, 'xmlns:soapenv', 'http://schemas.xmlsoap.org/soap/envelope/'
    EXEC sp_OAMethod @xml, 'AddAttribute', @success OUT, 'xmlns:v3', 'http://oneclickforapp.dpag.de/V3'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Header', ''
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|v3:RetrievePageFormatsRequest', ''

    -- In a SOAP HTTP request, including the XML declaration (<?xml version="1.0" encoding="UTF-8"?>) in the XML body is generally not required. 
    EXEC sp_OASetProperty @xml, 'EmitXmlDecl', 0
    DECLARE @soapRequestBody nvarchar(4000)
    EXEC sp_OAMethod @xml, 'GetXml', @soapRequestBody OUT

    DECLARE @endpoint nvarchar(4000)
    SELECT @endpoint = 'https://internetmarke.deutschepost.de/OneClickForApp/OneClickForAppServiceV3/OneClickForAppV3EJB'
    DECLARE @soapAction nvarchar(4000)
    SELECT @soapAction = ' '
    --  For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
    DECLARE @contentType nvarchar(4000)
    SELECT @contentType = 'text/xml'

    DECLARE @http int
    -- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT

    EXEC sp_OAMethod @http, 'ClearHeaders', NULL
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Content-Type', @contentType
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'SOAPAction', @soapAction

    DECLARE @resp int
    EXEC sp_OAMethod @http, 'PostXml', @resp OUT, @endpoint, @soapRequestBody, 'utf-8'
    EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
    IF @iTmp0 = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Failed to send SOAP request.'
        EXEC @hr = sp_OADestroy @xml
        EXEC @hr = sp_OADestroy @http
        RETURN
      END

    -- Get the XML response body.
    DECLARE @responseXml int
    -- Use "Chilkat_9_5_0.Xml" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.Xml', @responseXml OUT

    EXEC sp_OAMethod @resp, 'GetBodyXml', @success OUT, @responseXml

    DECLARE @statusCode int
    EXEC sp_OAGetProperty @resp, 'StatusCode', @statusCode OUT

    PRINT 'response status code: ' + @statusCode

    EXEC @hr = sp_OADestroy @resp

    -- If the status code does not indicate succcess, then show the response XML,
    -- which probably contains error information.
    IF @statusCode <> 200
      BEGIN
        EXEC sp_OAMethod @responseXml, 'GetXml', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @xml
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @responseXml
        RETURN
      END

    EXEC sp_OAMethod @responseXml, 'GetXml', @sTmp0 OUT
    PRINT @sTmp0

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

    DECLARE @id nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @id OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:id'
    DECLARE @isAddressPossible nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @isAddressPossible OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:isAddressPossible'
    DECLARE @isImagePossible nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @isImagePossible OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:isImagePossible'
    DECLARE @name nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @name OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:name'
    DECLARE @description nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @description OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:description'
    DECLARE @pageType nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @pageType OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageType'
    DECLARE @x nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @x OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:size|*:x'
    DECLARE @y nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @y OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:size|*:y'
    DECLARE @orientation nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @orientation OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:orientation'
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @x OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:labelSpacing|*:x'
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @y OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:labelSpacing|*:y'
    DECLARE @labelX nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @labelX OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:labelCount|*:labelX'
    DECLARE @labelY nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @labelY OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:labelCount|*:labelY'
    DECLARE @top nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @top OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:margin|*:top'
    DECLARE @bottom nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @bottom OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:margin|*:bottom'
    DECLARE @left nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @left OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:margin|*:left'
    DECLARE @right nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @right OUT, '*:Body|*:RetrievePageFormatsResponse|*:pageFormat|*:pageLayout|*:margin|*:right'

    EXEC @hr = sp_OADestroy @xml
    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @responseXml


END
GO
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>