Hi Everyone!
I'm by no means an expert programmer, so if I get some of the terminology mixed up, please forgive me
The application I'm developing is a client application for a web service. The web service sends a tiff file as a fax to a standard fax number. This is working fine, no problems at all.
Now the problem... I would like to be able to log all outgoing faxes in a simple database (most likely a Random Access File), the information I would like to store is the Fax Number, Tiff Filename, and the Transaction ID returned from the web service.
The application uses an AsyncCallback to call SendSingleFaxCompleted() when the web service returns a result. Inside SendSingleFaxCompleted() I can get the Transaction ID, but how can I get the FaxNum and TifLoc from PrepareFax()? SendSingleFaxCompleted() has to have a certain signature to be run from the AsyncCallback, so I can't pass any additional values through it.
I've attached the code below. I'm sure I'm going about this the wrong way, so if someone could point me in the right direction I would really appreciate it.
I'm using VB.Net 2003.
Any ideas how I can do this?
Thanks.
-Peter
I'm by no means an expert programmer, so if I get some of the terminology mixed up, please forgive me
The application I'm developing is a client application for a web service. The web service sends a tiff file as a fax to a standard fax number. This is working fine, no problems at all.
Now the problem... I would like to be able to log all outgoing faxes in a simple database (most likely a Random Access File), the information I would like to store is the Fax Number, Tiff Filename, and the Transaction ID returned from the web service.
The application uses an AsyncCallback to call SendSingleFaxCompleted() when the web service returns a result. Inside SendSingleFaxCompleted() I can get the Transaction ID, but how can I get the FaxNum and TifLoc from PrepareFax()? SendSingleFaxCompleted() has to have a certain signature to be run from the AsyncCallback, so I can't pass any additional values through it.
I've attached the code below. I'm sure I'm going about this the wrong way, so if someone could point me in the right direction I would really appreciate it.
VB.NET:
Private Sub PrepareFax(ByVal FaxNum As String, ByVal TifLoc As String)
Dim XMLDoc As String = GenerateXMLFile(FaxNum, TifLoc, "")
webMessagingWebService.BeginSendSingleFax(XMLDoc, New AsyncCallback(AddressOf Me.SendSingleFaxCompleted), "SendSingleFax")
End Sub
Private Sub SendSingleFaxCompleted(ByVal ar As IAsyncResult)
If (ar.IsCompleted) Then
Dim SendSingleFaxResult As MessagingWebService.SendResponse = webMessagingWebService.EndSendSingleFax(ar)
If Not IsNothing(SendSingleFaxResult) Then
If Not IsNothing(SendSingleFaxResult.Header) Then
If SendSingleFaxResult.Header.ErrorFlag = True Then
MsgBox(String.Concat("ReturnMessage = ", SendSingleFaxResult.Header.ReturnMessage))
End If
Dim TransID as String = SendSingleFaxResult.TransactionID
'now that I have the transaction ID here, I want to write
'a database entry with the FaxNum and TifLoc, but I have
'no way of access them
End If
End If
Else
MsgBox("The call to SendSingleFax ended, but apparently never completed.", _
MsgBoxStyle.Exclamation And MsgBoxStyle.OKOnly, _
"SendSingleFax: An Error Occurred")
End If
End Sub
I'm using VB.Net 2003.
Any ideas how I can do this?
Thanks.
-Peter