2015-04-16 93 views
0

在SQL Server中,我調用Web服務,但無法在提琴手上看到。我如何跟蹤從小提琴手的SQL服務器的請求?Fiddler上的SQL Server Web服務請求

PS:我試過setProxy,但沒有改變。

這是我的代碼:

--DROP PROCEDURE [dbo].[WS_IsEInvoiceUser] 
CREATE PROCEDURE [dbo].[WS_IsEInvoiceUser] 
    @vkn varchar(20), 
    @username VARCHAR(50)='FreseniusMedikal', 
    @password VARCHAR(50)='xxxx', 
    @ResponseText as Varchar(8000) OUTPUT 
AS 
BEGIN 
    SET NOCOUNT ON; 

    DECLARE @Request INT 
    Declare @Body as varchar(8000) = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
     <s:Header> 
      <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 
       <o:UsernameToken> 
        <o:Username>'[email protected]+'</o:Username> 
        <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">'[email protected]+'</o:Password> 
       </o:UsernameToken> 
      </o:Security> 
     </s:Header> 
     <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
      <IsEInvoiceUser xmlns="http://tempuri.org/"> 
       <vknTckn>'[email protected]+'</vknTckn> 
       <alias/> 
      </IsEInvoiceUser> 
     </s:Body> 
    </s:Envelope>' 
    EXEC sp_OACreate 'MSXML2.ServerXMLHTTP', @Request OUT; 
    EXEC sp_OAMethod @Request, 'setProxy', NULL, '2', 'http://127.0.0.1:8888' 
    EXEC sp_OAMethod @Request, 'open', NULL, 'post','https://efatura.uyumsoft.com.tr/Services/Integration', 'false' 
    EXEC sp_OAMethod @Request, 'setRequestHeader', null, 'SOAPAction', 'http://tempuri.org/IIntegration/IsEInvoiceUser' 
    EXEC sp_OAMethod @Request, 'setRequestHeader', null, 'Content-Type', 'text/xml; charset=utf-8' 
    EXEC sp_OAMethod @Request, 'send', null, @body 

    EXEC sp_OAMethod @Request, 'responseText', @ResponseText OUTPUT 
    SELECT CHARINDEX('true', SUBSTRING(@ResponseText, CHARINDEX('IsSucceded="true" Value="', @ResponseText)+LEN('IsSucceded="true" Value="'), 5)) 


    Exec sp_OADestroy @Request 
END 
+0

Fiddler在您當前的登錄會話中工作,但SQL Server在不同的會話中作爲服務運行。有一些方法可以將Fiddler作爲系統運行(需要同樣的東西來攔截IIS內的請求)。 – Richard

回答

0

首先,你絕對要叫setProxy否則你ServerXMLHTTPRequest將通過提琴手不會路由通信,所以你在正確的軌道上存在。話雖如此,我不知道您的參數是正確的,每this example他們應該是:

EXEC sp_OAMethod @Request, 'setProxy', '2', 'http://127.0.0.1:8888', '' 

...這符合declaration on MSDN

要使HTTPS請求成功,您需要確保FOUNDER的根證書在MACHINE的受信任根存儲中受信任。在Fiddler中,選擇工具> Fiddler選項> HTTPS,然後單擊「將根證書導出到桌面」。然後運行MMC.exe並添加「證書」管理單元。選擇「計算機帳戶」。將FiddlerRoot.cer從您的桌面拖放到mmc控制檯中的「受信任的根證書頒發機構」文件夾並接受提示。