何时在ASMX中实例化SoapHeader字段?

时间:2009-04-22 20:14:11

标签: asp.net soap asmx

请考虑以下事项:

public MyCustomHeader MyHeader;

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


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

2 个答案:

答案 0 :(得分:0)

对于您的示例,它将在执行MyFunction方法之前进行实例化。由于Header需要能够执行MyFunction的操作。

答案 1 :(得分: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"