2015-01-20 50 views
1

我正在面對一個CLR存儲過程調用的WCF服務的一個非常奇怪的問題。clr存儲過程調用wcf服務缺少參數值

基本上我的服務期望元件的陣列如下:

[ServiceContract] 
public class ServiceFoo 
{ 
    [OperationContract] 
    bool ImportFoos(IEnumerable<Foo> foos); 
} 

public class Foo 
{ 
    public int a {get;set;} 
    public int b {get;set;} 
    public string c {get;set;} 
    public int d {get;set;} 
    public string e {get;set;} 
} 

public class wsClient 
    { 
     public static void ImportFoos(int a, int b, string c, int d, string e) 
     { 
      ws.ServiceFoo ws = new ws.ServiceFoo(); 

      bool ImportFooResult = false; 
      bool ImportFooResultSpecified = false; 

      ws.ImportFoos(new ws.Foo[] 
      { 
       new ws.Foo 
       { 
        a= a, 
        b = b, 
        c = c, 
        d = d, 
        e = e 
       } 

      }, out ImportFooResult, out ImportFooResultSpecified); 
     } 
    } 

// SQL/CLR

public partial class StoredProcedures 
{ 
    [Microsoft.SqlServer.Server.SqlProcedure] 
    public static void sp_import_foo(int a, int b, string c, int d, string e) 
    {   
     try 
     { 
      SqlPipe sqlPipe = SqlContext.Pipe; 

      wsClient.ImportFoos(a, b, c, d, e); 

      SqlContext.Pipe.Send("OK"); 
     } 
     catch (Exception ex) 
     { 
      SqlContext.Pipe.Send(ex.Message + " - " + ex.StackTrace); 
     } 
    } 
} 


CREATE PROCEDURE [spWcfCall] 
    @a int, 
    @b int, 
    @c nvarchar(max), 
    @d int, 
    @e nvarchar(max) 

WITH EXECUTE AS CALLER 
AS 
    EXTERNAL NAME CLRSample.StoredProcedures.sp_import_foo 

把我的服務內的斷點,我可以檢查,只有C和E參數與值。

任何線索?

回答