SOAP WSDL Generate Code

SpringCMServiceSoap / UserGetByAccountId

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:soapenv', 'http://schemas.xmlsoap.org/soap/envelope/'
    EXEC sp_OAMethod @xml, 'AddAttribute', @success OUT, 'xmlns:spr', 'http://www.springcm.com/atlas/webservices/v201308/scm/'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Header', ''
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|spr:UserGetByAccountId|spr:token', 'string'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'soapenv:Body|spr:UserGetByAccountId|spr:accountId', '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://soapna11.springcm.com/atlas/webservices/v201308/springcmservice.asmx'
    DECLARE @soapAction nvarchar(4000)
    SELECT @soapAction = 'http://www.springcm.com/atlas/webservices/v201308/scm/UserGetByAccountId'
    --  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 @Id nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @Id OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:Id'
    DECLARE @Name nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @Name OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:Name'
    DECLARE @ObjectType nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @ObjectType OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:ObjectType'
    DECLARE @v_Email nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @v_Email OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:Email'
    DECLARE @FirstName nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @FirstName OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:FirstName'
    DECLARE @LastName nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @LastName OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:LastName'
    DECLARE @PhoneNumber nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @PhoneNumber OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:PhoneNumber'
    DECLARE @FaxNumber nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @FaxNumber OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:FaxNumber'
    DECLARE @Company nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @Company OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:Company'
    DECLARE @Department nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @Department OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:Department'
    DECLARE @Title nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @Title OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:Title'
    DECLARE @Address1 nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @Address1 OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:Address1'
    DECLARE @Address2 nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @Address2 OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:Address2'
    DECLARE @Address3 nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @Address3 OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:Address3'
    DECLARE @City nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @City OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:City'
    DECLARE @ProvinceState nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @ProvinceState OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:ProvinceState'
    DECLARE @PostalCode nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @PostalCode OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:PostalCode'
    DECLARE @Country nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @Country OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:Country'
    DECLARE @Role nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @Role OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:Role'
    DECLARE @Status nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @Status OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:Status'
    DECLARE @PersonaUid nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @PersonaUid OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:PersonaUid'
    DECLARE @ManagedByUid nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @ManagedByUid OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:ManagedByUid'
    DECLARE @EnabledUTCStartDate nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @EnabledUTCStartDate OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:EnabledUTCStartDate'
    DECLARE @EnabledUTCEndDate nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @EnabledUTCEndDate OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:EnabledUTCEndDate'
    DECLARE @UserId nvarchar(4000)
    EXEC sp_OAMethod @responseXml, 'GetChildContent', @UserId OUT, '*:Body|*:UserGetByAccountIdResponse|*:UserGetByAccountIdResult|*:SCMUserAccount|*:UserId'

    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:spr="http://www.springcm.com/atlas/webservices/v201308/scm/">
    <soapenv:Header/>
    <soapenv:Body>
        <spr:UserGetByAccountId>
            <spr:token>string</spr:token>
            <spr:accountId>string</spr:accountId>
        </spr:UserGetByAccountId>
    </soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:spr="http://www.springcm.com/atlas/webservices/v201308/scm/">
    <soapenv:Header/>
    <soapenv:Body>
        <spr:UserGetByAccountIdResponse>
            <spr:UserGetByAccountIdResult>
                <spr:SCMUserAccount>
                    <spr:Id>string</spr:Id>
                    <spr:Name>string</spr:Name>
                    <spr:ObjectType>Document</spr:ObjectType>
                    <spr:Email>string</spr:Email>
                    <spr:FirstName>string</spr:FirstName>
                    <spr:LastName>string</spr:LastName>
                    <spr:PhoneNumber>string</spr:PhoneNumber>
                    <spr:FaxNumber>string</spr:FaxNumber>
                    <spr:Company>string</spr:Company>
                    <spr:Department>string</spr:Department>
                    <spr:Title>string</spr:Title>
                    <spr:Address1>string</spr:Address1>
                    <spr:Address2>string</spr:Address2>
                    <spr:Address3>string</spr:Address3>
                    <spr:City>string</spr:City>
                    <spr:ProvinceState>string</spr:ProvinceState>
                    <spr:PostalCode>string</spr:PostalCode>
                    <spr:Country>string</spr:Country>
                    <spr:Role>Primary</spr:Role>
                    <spr:Status>Unknown</spr:Status>
                    <spr:PersonaUid>string</spr:PersonaUid>
                    <spr:ManagedByUid>string</spr:ManagedByUid>
                    <spr:EnabledUTCStartDate>dateTime</spr:EnabledUTCStartDate>
                    <spr:EnabledUTCEndDate>dateTime</spr:EnabledUTCEndDate>
                    <spr:UserId>string</spr:UserId>
                </spr:SCMUserAccount>
            </spr:UserGetByAccountIdResult>
        </spr:UserGetByAccountIdResponse>
    </soapenv:Body>
</soapenv:Envelope>