I translated a IEndPointBehavior Class from c# to VB
Pretty sure I got it right, but haven't been able to test it yet.
I just want to hook up the bahavior to the SendAndCommit so I can test the outcome of the HMAC Calculation, and see if my translation works correctly, but I can't find the ServiceSoapClient called before SendAndCommit.
I'm not sure if it's part of the Service Reference, or if it's part of .Net.
I thought perhaps that I have to create my own endpoint, and wrap it in a service host, So I experimented with writing a serivce endpoint, but I think I'm on the wrong track here, and need to go back to the ServiceSoapClient.
Sample Code in c#:
var client = new ServiceSoapClient(new BasicHttpBinding(BasicHttpSecurityMode.Transport),
new EndpointAddress(_isDemo ? TestUrl : ProdUrl));
client.ChannelFactory.Endpoint.Behaviors.Add(new HmacHeaderBehaivour(_hmac,_keyId));
TransactionResult result = client.SendAndCommit(new Transaction
What I wrote, based on research
Dim m_endPoint_Url As String = My.Resources.endPoint_Url_Demo
Dim hmac_behavior As New HMAC_Header_Behavior(m_key, m_keyID)
Dim svcCcontractDesc As New ContractDescription("firstData_G4_V14")
Dim svcEndPoint As New ServiceEndpoint(svcCcontractDesc)
Dim svcBinding As New BasicHttpBinding()
svcEndPoint.Address = New EndpointAddress(New Uri(m_endPoint_Url))
svcEndPoint.Behaviors.Add(hmac_behavior)
svcEndPoint.Binding = svcBinding
Dim ws As com.firstdata.globalgatewaye4.V14.Service
Dim rxn As com.firstdata.globalgatewaye4.V14.TransactionResult
Using host As New ServiceHost(hmac_behavior)
With host
.Open()
'Transmit the Card Authorization Request
ws = New com.firstdata.globalgatewaye4.V14.Service
rxn = New com.firstdata.globalgatewaye4.V14.TransactionResult
rxn = ws.SendAndCommit(txn)
.Close()
End With
End Using