房產

2011-12-14 72 views
1

我訪問一個Web服務,它提供了一個方法ProcessMessage此方法動態改變屬性的樣子:房產

<System.Web.Services.Protocols.SoapHeaderAttribute("payloadManifest", Direction:=System.Web.Services.Protocols.SoapHeaderDirection.InOut), _ 
    System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://exampleurl/operations/ProcessMessage/v1_01/GetTest1" & _ 
     "", RequestNamespace:="http://exampleurl", ResponseNamespace:="http://exampleurl", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _ 
Public Sub ProcessMessage(ByRef payload As Payload) 
    Try 
     Dim results() As Object = Me.Invoke("ProcessMessage", New Object() {payload}) 
     payload = CType(results(0), Payload) 
     Dim i As Integer = 0 
    Catch ex As Exception 

    End Try 
End Sub 

這工作得很好,但是,這種方法被用於各種不同的功能。如果SoapDocumentMethodAttributeAction更改ProcessMessage返回不同的值。

例子:

變化

System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://exampleurl/operations/ProcessMessage/v1_01/GetTest1" 

System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://exampleurl/operations/ProcessMessage/v1_01/GetTest2" 

現在的問題是,據我所看到的,這Action需要被硬編碼到該文件,因此我只能對每個編譯好的程序運行1個方法。是否有任何動態更改Action的方法,還是應該以不同的方式處理這些問題?

回答

0

好的我找到了一個解決方法,但它不完全理想。基本上,我們將這個屬性設置爲填充SOAPAction標題。但我們決定直接更改SOAPAction標題,而不是通過屬性。更簡單但肯定是一種黑客法。