SOAP WSDL Generate Code

DataServiceEndpointSoapBinding / filterFaultCodesWithDiagnosticStepsForType

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:filterFaultCodesWithDiagnosticStepsForType|intf:vrid', 'xml'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|intf:filterFaultCodesWithDiagnosticStepsForType|intf:typeId', 'xml'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|intf:filterFaultCodesWithDiagnosticStepsForType|intf:codesin', 'xml'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|intf:filterFaultCodesWithDiagnosticStepsForType|intf:language', '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 @ct_text nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @ct_text OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:ct_text'
    DECLARE @loDirection nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @loDirection OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:diagnosticComponents|*:item|*:component|*:loDirection'
    DECLARE @loX nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @loX OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:diagnosticComponents|*:item|*:component|*:loX'
    DECLARE @loY nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @loY OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:diagnosticComponents|*:item|*:component|*:loY'
    DECLARE @name nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @name OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:diagnosticComponents|*:item|*:component|*:name'
    DECLARE @shieldPinId nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @shieldPinId OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:diagnosticComponents|*:item|*:component|*:shieldPinId'
    DECLARE @slImagesId nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @slImagesId OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:diagnosticComponents|*:item|*:component|*:slImagesId'
    DECLARE @symbolInstanceId nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @symbolInstanceId OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:diagnosticComponents|*:item|*:component|*:symbolInstanceId'
    DECLARE @systemTypeId nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @systemTypeId OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:diagnosticComponents|*:item|*:component|*:systemTypeId'
    DECLARE @couplingType nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @couplingType OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:diagnosticComponents|*:item|*:couplingType'
    DECLARE @system_group_id nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @system_group_id OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:diagnosticComponents|*:item|*:system_group_id'
    DECLARE @system_type_id nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @system_type_id OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:diagnosticComponents|*:item|*:system_type_id'
    DECLARE @fc_code nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @fc_code OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:fc_code'
    DECLARE @fc_code2 nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @fc_code2 OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:fc_code2'
    DECLARE @fc_fault_code_system_id nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @fc_fault_code_system_id OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:fc_fault_code_system_id'
    DECLARE @fd_component_name_id nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @fd_component_name_id OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:fd_component_name_id'
    DECLARE @fd_id nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @fd_id OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:fd_id'
    DECLARE @fd_plausible nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @fd_plausible OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:fd_plausible'
    DECLARE @fd_si_number nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @fd_si_number OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:fd_si_number'
    DECLARE @ft_text nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @ft_text OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:ft_text'
    DECLARE @id nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @id OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:faultCode2Array|*:item|*:id'
    DECLARE @confirmationLink nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @confirmationLink OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:status|*:confirmationLink'
    DECLARE @statusCode nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @statusCode OUT, '*:Body|*:filterFaultCodesWithDiagnosticStepsForTypeResponse|*:filterFaultCodesWithDiagnosticStepsForTypeReturn|*:status|*:statusCode'

    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:filterFaultCodesWithDiagnosticStepsForType>
            <intf:vrid>xml</intf:vrid>
            <intf:typeId>xml</intf:typeId>
            <intf:codesin>xml</intf:codesin>
            <intf:language>xml</intf:language>
        </intf:filterFaultCodesWithDiagnosticStepsForType>
    </soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns2="http://datatypes.webservice.elecdata.vivid.nl" xmlns:tns1="http://datamodel.webservice.elecdata.vivid.nl" xmlns:intf="http://data.webservice.workshop.vivid.nl">
    <soapenv:Header/>
    <soapenv:Body>
        <intf:filterFaultCodesWithDiagnosticStepsForTypeResponse>
            <intf:filterFaultCodesWithDiagnosticStepsForTypeReturn>
                <tns1:faultCode2Array>
                    <intf:item>
                        <tns2:ct_text>xml</tns2:ct_text>
                        <tns2:diagnosticComponents>
                            <intf:item>
                                <tns2:component>
                                    <tns2:loDirection>xml</tns2:loDirection>
                                    <tns2:loX>xml</tns2:loX>
                                    <tns2:loY>xml</tns2:loY>
                                    <tns2:name>xml</tns2:name>
                                    <tns2:shieldPinId>xml</tns2:shieldPinId>
                                    <tns2:slImagesId>xml</tns2:slImagesId>
                                    <tns2:symbolInstanceId>xml</tns2:symbolInstanceId>
                                    <tns2:systemTypeId>xml</tns2:systemTypeId>
                                </tns2:component>
                                <tns2:couplingType>xml</tns2:couplingType>
                                <tns2:system_group_id>xml</tns2:system_group_id>
                                <tns2:system_type_id>xml</tns2:system_type_id>
                            </intf:item>
                        </tns2:diagnosticComponents>
                        <tns2:fc_code>xml</tns2:fc_code>
                        <tns2:fc_code2>xml</tns2:fc_code2>
                        <tns2:fc_fault_code_system_id>xml</tns2:fc_fault_code_system_id>
                        <tns2:fd_component_name_id>xml</tns2:fd_component_name_id>
                        <tns2:fd_id>xml</tns2:fd_id>
                        <tns2:fd_plausible>xml</tns2:fd_plausible>
                        <tns2:fd_si_number>xml</tns2:fd_si_number>
                        <tns2:ft_text>xml</tns2:ft_text>
                        <tns2:id>xml</tns2:id>
                    </intf:item>
                </tns1:faultCode2Array>
                <tns1:status>
                    <intf:confirmationLink>xml</intf:confirmationLink>
                    <intf:statusCode>xml</intf:statusCode>
                </tns1:status>
            </intf:filterFaultCodesWithDiagnosticStepsForTypeReturn>
        </intf:filterFaultCodesWithDiagnosticStepsForTypeResponse>
    </soapenv:Body>
</soapenv:Envelope>