I am accessing a web service which provides a single method ProcessMessage this method looks like:
<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
This works fine, however, this method is to be used for various different functions. If the SoapDocumentMethodAttribute Action is changed ProcessMessage returns different values.
Example:
Change
System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://exampleurl/operations/ProcessMessage/v1_01/GetTest1"
To
System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://exampleurl/operations/ProcessMessage/v1_01/GetTest2"
Now the problem is, as far as I can see, this Action needs to be hard-coded into the file and therefore I can only run 1 method with each compiled program. Is there any way of dynamically changing the Action or should I be approaching this differently?
Ok I found a workaround, but it’s not exactly ideal. Basically, we were setting this attribute to populate the
SOAPActionheader. But we decided to change theSOAPActionheader directly rather than through the attributes. Much simpler but surely a hack-y method.