存储过程与节点规范

时间:2015-03-12 11:15:53

标签: xml sql-server-2008

Declare @Xmlresponse as XML
Set @Xmlresponse = CAST (@response as xml);

---- Check the response
Declare @Status as int

Set @Status =  @Xmlresponse.exist('declare namespace ns1="https://adweaintsrv.adweag.ae/";
declare namespace ns="http://AADC_GETCUSTOMERFULLDETAIL/";
/ns:UserDetail/ns1:AccountTypeEng')

---SELECT @Status [Status]

------ Shred the XML response and extract the status description value
    IF (@Status = 1) 
    --// BillID node exists so the transaction was successful and we can extract the Status Description for example

    BEGIN

        ---- Extract StatusCode
        ;with xmlnamespaces('https://adweaintsrv.adweag.ae/' as ns,  default 'http://AADC_GETCUSTOMERFULLDETAIL/')
        Select T.X.value('(ns:StatusCode/text())[1]', 'varchar(10)') as StatusCode
                from @Xmlresponse.nodes('/UserDetail') as T(X);
            ---- Insert into tracker table
             --INSERT INTO [dbo].[IVR_CCB_Webservices_Tracker] ([WS_Desc], [Date], [Result], [xmlResult])
                --VALUES
            -- ('CreateBillRouteFaxService', Getdate()  ,'Success', @response)
             ----Insert Response WS in Table BillFax_log
            ;with xmlnamespaces('https://adweaintsrv.adweag.ae/' as ns,  default 'http://AADC_GETCUSTOMERFULLDETAIL/')

0 个答案:

没有答案