SOAP WSDL Generate Code

DataServiceEndpointSoapBinding / getIdentificationTreeV2

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
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.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:intf', 'http://data.webservice.workshop.vivid.nl'
    EXEC sp_OAMethod @xml, 'AddAttribute', @success OUT, 'xmlns:soapenv', 'http://schemas.xmlsoap.org/soap/envelope/'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Header', ''
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|intf:getIdentificationTreeV2|intf:vrid', 'xml'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|intf:getIdentificationTreeV2|intf:descriptionLanguage', 'xml'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|intf:getIdentificationTreeV2|intf:vehicle_id', 'xml'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|intf:getIdentificationTreeV2|intf:vehicle_level', 'xml'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|intf:getIdentificationTreeV2|intf:filter_dataset', 'xml'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|intf:getIdentificationTreeV2|intf:filter_category', 'xml'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|intf:getIdentificationTreeV2|intf:filter_toVehicleLevel', 'xml'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|intf:getIdentificationTreeV2|intf:filter_criteriaKeys', 'xml'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|intf:getIdentificationTreeV2|intf:filter_criteriaValues', 'xml'

    -- 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 = 'http://www.haynespro-services.com/workshopServices3/services/DataServiceEndpoint'
    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
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.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
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.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 @capacity nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @capacity OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:capacity'
    DECLARE @dataType nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @dataType OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:criteria|*:item|*:dataType'
    DECLARE @description nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @description OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:criteria|*:item|*:description'
    DECLARE @id nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @id OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:criteria|*:item|*:id'
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @id OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:criteria|*:item|*:values|*:item|*:id'
    DECLARE @value nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @value OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:criteria|*:item|*:values|*:item|*:value'
    DECLARE @engineCode nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @engineCode OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:engineCode'
    DECLARE @item nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @item OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:fuelType|*:item'
    DECLARE @fullName nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @fullName OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:fullName'
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @id OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:id'
    DECLARE @image nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @image OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:image'
    DECLARE @level nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @level OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:level'
    DECLARE @madeFrom nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @madeFrom OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:madeFrom'
    DECLARE @madeUntil nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @madeUntil OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:madeUntil'
    DECLARE @name nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @name OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:name'
    DECLARE @order nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @order OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:order'
    DECLARE @output nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @output OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:output'
    DECLARE @confirmationLink nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @confirmationLink OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:status|*:confirmationLink'
    DECLARE @statusCode nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @statusCode OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:status|*:statusCode'
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @item OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:subjects|*:item'
    DECLARE @key nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @key OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:subjectsByGroup|*:mapItems|*:item|*:key'
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @value OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:subjectsByGroup|*:mapItems|*:item|*:value'
    DECLARE @superElementId nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @superElementId OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:superElementId'
    DECLARE @superElementLevel nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @superElementLevel OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:superElementLevel'
    DECLARE @tonnage nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @tonnage OUT, '*:Body|*:getIdentificationTreeV2Response|*:getIdentificationTreeV2Return|*:tonnage'

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


END
GO
Request XML
<soapenv:Envelope xmlns:intf="http://data.webservice.workshop.vivid.nl" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header/>
    <soapenv:Body>
        <intf:getIdentificationTreeV2>
            <intf:vrid>xml</intf:vrid>
            <intf:descriptionLanguage>xml</intf:descriptionLanguage>
            <intf:vehicle_id>xml</intf:vehicle_id>
            <intf:vehicle_level>xml</intf:vehicle_level>
            <intf:filter_dataset>xml</intf:filter_dataset>
            <intf:filter_category>xml</intf:filter_category>
            <intf:filter_toVehicleLevel>xml</intf:filter_toVehicleLevel>
            <intf:filter_criteriaKeys>xml</intf:filter_criteriaKeys>
            <intf:filter_criteriaValues>xml</intf:filter_criteriaValues>
        </intf:getIdentificationTreeV2>
    </soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:intf="http://data.webservice.workshop.vivid.nl" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header/>
    <soapenv:Body>
        <intf:getIdentificationTreeV2Response>
            <intf:getIdentificationTreeV2Return>
                <intf:capacity>xml</intf:capacity>
                <intf:criteria>
                    <intf:item>
                        <intf:dataType>xml</intf:dataType>
                        <intf:description>xml</intf:description>
                        <intf:id>xml</intf:id>
                        <intf:values>
                            <intf:item>
                                <intf:id>xml</intf:id>
                                <intf:value>xml</intf:value>
                            </intf:item>
                        </intf:values>
                    </intf:item>
                </intf:criteria>
                <intf:engineCode>xml</intf:engineCode>
                <intf:fuelType>
                    <intf:item>xml</intf:item>
                </intf:fuelType>
                <intf:fullName>xml</intf:fullName>
                <intf:id>xml</intf:id>
                <intf:image>xml</intf:image>
                <intf:level>xml</intf:level>
                <intf:madeFrom>xml</intf:madeFrom>
                <intf:madeUntil>xml</intf:madeUntil>
                <intf:name>xml</intf:name>
                <intf:order>xml</intf:order>
                <intf:output>xml</intf:output>
                <intf:status>
                    <intf:confirmationLink>xml</intf:confirmationLink>
                    <intf:statusCode>xml</intf:statusCode>
                </intf:status>
                <intf:subElements>
                    <intf:item/>
                </intf:subElements>
                <intf:subjects>
                    <intf:item>xml</intf:item>
                </intf:subjects>
                <intf:subjectsByGroup>
                    <intf:mapItems>
                        <intf:item>
                            <intf:key>xml</intf:key>
                            <intf:value>xml</intf:value>
                        </intf:item>
                    </intf:mapItems>
                </intf:subjectsByGroup>
                <intf:superElementId>xml</intf:superElementId>
                <intf:superElementLevel>xml</intf:superElementLevel>
                <intf:tonnage>xml</intf:tonnage>
            </intf:getIdentificationTreeV2Return>
        </intf:getIdentificationTreeV2Response>
    </soapenv:Body>
</soapenv:Envelope>