SOAP WSDL Generate Code

WageFileServicesSOAP12Binding / getWageFileStatus

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', 'soap:Envelope'
    DECLARE @success int
    EXEC sp_OAMethod @xml, 'AddAttribute', @success OUT, 'xmlns:soap', 'http://www.w3.org/2003/05/soap-envelope'
    EXEC sp_OAMethod @xml, 'AddAttribute', @success OUT, 'xmlns:impl', 'urn:parameters.v3.ewr.ws.ssa.gov'
    EXEC sp_OAMethod @xml, 'AddAttribute', @success OUT, 'xmlns:ns0', 'urn:skeleton.v3.ewr.ws.ssa.gov'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soap:Header', ''
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soap:Body|ns0:GetWageFileStatusRequest|impl:confirmationNumber', 'string'

    -- 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://ws.ssa.gov/ewrwsv3/services/WageFileServices'
    DECLARE @soapAction nvarchar(4000)
    SELECT @soapAction = 'getWageFileStatus'
    --  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 @wfid nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @wfid OUT, '*:Body|*:GetWageFileStatusResponse|*:wfid'
    DECLARE @receiptYear int
    EXEC sp_OAMethod @responseXml, 'GetChildIntValue', @receiptYear OUT, '*:Body|*:GetWageFileStatusResponse|*:receiptYear'
    DECLARE @version nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @version OUT, '*:Body|*:GetWageFileStatusResponse|*:version'
    DECLARE @receiptDate nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @receiptDate OUT, '*:Body|*:GetWageFileStatusResponse|*:receiptDate'
    DECLARE @statusCode nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @statusCode OUT, '*:Body|*:GetWageFileStatusResponse|*:statusCode'
    DECLARE @statusDescription nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @statusDescription OUT, '*:Body|*:GetWageFileStatusResponse|*:statusDescription'
    DECLARE @statusDate nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @statusDate OUT, '*:Body|*:GetWageFileStatusResponse|*:statusDate'
    DECLARE @filingMethod nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @filingMethod OUT, '*:Body|*:GetWageFileStatusResponse|*:filingMethod'
    DECLARE @w3Count int
    EXEC sp_OAMethod @responseXml, 'GetChildIntValue', @w3Count OUT, '*:Body|*:GetWageFileStatusResponse|*:w3Count'
    DECLARE @originalFilename nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @originalFilename OUT, '*:Body|*:GetWageFileStatusResponse|*:originalFilename'
    DECLARE @returnCode nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @returnCode OUT, '*:Body|*:GetWageFileStatusResponse|*:response|*:returnCode'
    DECLARE @transactionTimestamp nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @transactionTimestamp OUT, '*:Body|*:GetWageFileStatusResponse|*:response|*:transactionTimestamp'
    DECLARE @errorInfo nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @errorInfo OUT, '*:Body|*:GetWageFileStatusResponse|*:response|*:errorInfo'
    DECLARE @errorDateInfo nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @errorDateInfo OUT, '*:Body|*:GetWageFileStatusResponse|*:response|*:errorDateInfo'
    DECLARE @deprecationDate nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @deprecationDate OUT, '*:Body|*:GetWageFileStatusResponse|*:response|*:deprecationDate'
    DECLARE @sunsetDate nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @sunsetDate OUT, '*:Body|*:GetWageFileStatusResponse|*:response|*:sunsetDate'

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


END
GO
Request XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:impl="urn:parameters.v3.ewr.ws.ssa.gov" xmlns:ns0="urn:skeleton.v3.ewr.ws.ssa.gov">
    <soap:Header/>
    <soap:Body>
        <ns0:GetWageFileStatusRequest>
            <impl:confirmationNumber>string</impl:confirmationNumber>
        </ns0:GetWageFileStatusRequest>
    </soap:Body>
</soap:Envelope>
Response XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ns0="urn:skeleton.v3.ewr.ws.ssa.gov" xmlns:impl="urn:parameters.v3.ewr.ws.ssa.gov">
    <soap:Header/>
    <soap:Body>
        <ns0:GetWageFileStatusResponse>
            <impl:wfid>string</impl:wfid>
            <impl:receiptYear>1042</impl:receiptYear>
            <impl:version>string</impl:version>
            <impl:receiptDate>dateTime</impl:receiptDate>
            <impl:statusCode>string</impl:statusCode>
            <impl:statusDescription>string</impl:statusDescription>
            <impl:statusDate>dateTime</impl:statusDate>
            <impl:filingMethod>string</impl:filingMethod>
            <impl:w3Count>1042</impl:w3Count>
            <impl:originalFilename>string</impl:originalFilename>
            <impl:response>
                <impl:returnCode>string</impl:returnCode>
                <impl:transactionTimestamp>dateTime</impl:transactionTimestamp>
                <impl:errorInfo>string</impl:errorInfo>
                <impl:errorDateInfo>dateTime</impl:errorDateInfo>
                <impl:deprecationDate>dateTime</impl:deprecationDate>
                <impl:sunsetDate>dateTime</impl:sunsetDate>
            </impl:response>
        </ns0:GetWageFileStatusResponse>
    </soap:Body>
</soap:Envelope>