I've read through Hervey's blog entry on EndpointReference.Via. Here's an
entry that seems pretty unequivocal regarding semantics:
-----------------------------------
* urn:MyService
* soap.tcp://mycomputer/MyService
The first URI becomes the EndpointReference.Address, the second
EndpointReference.Via
-----------------------------------
Since the first URI doesn't specify an actual transport, the Via MUST be the
specifier for the ACTUAL network location to which the proxy will connect.
Out of desperation, I gave up on using the EnpointReference constructor and
set the Via explicitly:
Private Shared Function DumpAddr(ByVal oAddr As Address) As String
If oAddr Is Nothing Then
Return "Addr = NOTHING"
Else
Return "Addr = " & oAddr.Value.ToString()
End If
End Function
Private Shared Function DumpAddr(ByVal oAddr As Via) As String
If oAddr Is Nothing Then
Return "Via = NOTHING"
Else
Return "Via = " & oAddr.Value.ToString()
End If
End Function
Public Sub New()
MyBase.New()
Dim uriInternal As Uri = New Uri("http://target:8080/MyService.asmx")
Dim uriExternal As Uri = New Uri("http://target/MyService.asmx")
MyBase.Url = uriInternal.ToString()
MyBase.Destination.Via = New Via(uriExternal)
MsgBox("URL = " & MyBase.Url & ", " & DumpAddr(MyBase.Destination.Address)
& ", " & DumpAddr(MyBase.Destination.Via))
End Sub
The message box reports:
URL = http://target:8080/MyService.asmx, Addr =
http://target:8080/MyService.asmx, Via = http://target/MyService.asmx
All looks as it should?!? But the actual connection attempt is made to
target:8080 (NOT REACHABLE) and NOT target:80 as specified by the Via? Maybe
WebServicesClientProtocol uses URL above all else? Fine, here's another try:
MyBase.Url = uriExternal.ToString()
MyBase.Destination.Address = New Address(uriInternal)
MyBase.Destination.Via = New Via(uriExternal)
MsgBox("URL = " & MyBase.Url & ", " &
DumpAddr(MyBase.Destination.Address) & ", " &
DumpAddr(MyBase.Destination.Via))
The message box reports:
URL = http://target:8080/MyService.asmx, Addr =
http://target:8080/MyService.asmx, Via = http://target/MyService.asmx
Darn, setting the Address property overwrote the Url property! Connection
failed!
Okay, how about this:
MyBase.Url = uriExternal.ToString()
MyBase.Destination.Address = New Address(uriInternal)
MyBase.Url = uriExternal.ToString()
MyBase.Destination.Via = New Via(uriExternal)
MsgBox("URL = " & MyBase.Url & ", " &
DumpAddr(MyBase.Destination.Address) & ", " &
DumpAddr(MyBase.Destination.Via))
The message box reports:
URL = http://target/MyService.asmx, Addr = http://target/MyService.asmx, Via
= http://target/MyService.asmx
Darn, setting the Url property overwrote the Address property! WSE816!
THERE IS NO WAY TO GET THE URL TO BE THE CORRECT TRANSPORT WITHOUT
DESTROYING THE "TO" HEADER IN THE DESTINATION ADDRESS! THIS IS A BUG IN
Microsoft.Web.Services2.WebServicesClientProtocol!
So, what are my alternatives?
Thomas S. Trias
Senior Developer
Afni Insurance Services
http://www.afniinc.com/
> Hello Thomas,
> I think the semantics may be confusing. This [0] might be helpful
[quoted text clipped - 42 lines]
> > Afni Insurance Services
> > http://www.afniinc.com/
Dilip Krishnan - 02 Mar 2005 03:23 GMT
Hello Thomas,
You would need to set the Via in the request soap context. NOT in the
Destination
HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
> I've read through Hervey's blog entry on EndpointReference.Via.
> Here's an entry that seems pretty unequivocal regarding semantics:
[quoted text clipped - 135 lines]
>>> Afni Insurance Services
>>> http://www.afniinc.com/