2009-04-22 41 views
0

考慮以下幾點:什麼時候在ASMX中實例化SoapHeader字段?

public MyCustomHeader MyHeader; 

public New() 
{ 
    //MyHeader is NOT instantiated 
} 


[SoapHeader("MyHeader")] 
[WebMethod()] 
public bool MyFunction() 
{ 
    //MyHeader is instantiated, but when was it instantiated? 
} 
+0

嗨,還有這個問題,還是米奇回答你的問題? – 2009-07-21 23:22:40

回答

0

在您的例子的情況下,它會被實例化前的那次MyFunction方法的執行。由於標題需要能夠執行MyFunction的操作。

+0

還有其他的可能性嗎?如果我將SoapHeader屬性添加到構造函數中,它會在那裏實例化嗎? – Larsenal 2009-04-22 20:43:05

+0

潛在的關鍵是肥皂頭是與消息一起出現的東西,所以在實際進行方法調用之前,它不會被值實例化。 – 2009-04-22 21:39:34

0
how to convert this part and attach to XML in android? 
POST /SharingpointCheckBarcode.asmx HTTP/1.1 
Host: awc.test.trin-it.nl 
Content-Type: text/xml; charset=utf-8 
Content-Length: length 
SOAPAction: "http://tempuri.org/checkBarcode" 
相關問題