Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web Service W/Attachments Question

Status
Not open for further replies.

dtqbterror

Programmer
May 17, 2001
87
US
I have been doing research regarding the consumption of a .NET web service with VB6. I have found that you need to us the SOAP Toolkit 3.0 in order to do this. In the documentation of the SDK I have found info regarding attachments and some example code. The thing is that all of the example code showes the web service being written in VB6 and not in .NET so my question is.

Do I need to use interop to import that MSSOAPLib30.dll into my .NET web service and write a function specific for use by VB6 or do some of the objects contained within the MSSOAPLib30.dll map to objects contained in the Microsoft.Web.Services.Dime assembly?

Thanks for any info
 
What language will the actual server part of the service be written in? VB6 or VB.NET?

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
The web service itself was written in .NET Here is my VB6 testing code that is working as far as getting to the service. The service creates a PDF file so I a know it is working. The problem I have is that the PDF is being returned as an attachment and I need to now how to retrieve it.

On Error Resume Next
Dim m_oSoap As MSSOAPLib30.SoapClient30
Dim m_oAttach As New MSSOAPLib30.FileAttachment30
Dim m_fQuote As Boolean
Dim p_oFSO As Scripting.FileSystemObject
Dim p_oFile As Scripting.File
Dim p_oStream As TextStream
Dim p_sData As String

Set m_oSoap = New MSSOAPLib30.SoapClient30
Set m_oAttach = New MSSOAPLib30.FileAttachment30
Set p_oFSO = New Scripting.FileSystemObject

Set p_oFile = p_oFSO.GetFile("C:\APF Quote Source\APF_Quote_Test_Client\Good Request.xml")
Set p_oStream = p_oFile.OpenAsTextStream
p_sData = Trim(p_oStream.ReadAll)

m_oAttach.FileName = "C:\APF Quote Source\APF_Quote_Test_Client\Good Request.xml"
With m_oSoap
.MSSoapInit " m_fQuote = m_oSoap.GetQuoteVB6(p_sData)
End With
 
I was able to figure this out if anyone is interested in how it works let me know.
 
hey dtqbterror, I get an XML Parser failed error when executing the mssoapinit line. Do you mind if I send you my codes and see if you can spot the problem?

thanks.

 
I have been attempting to upload binary files (pdb) from VB6 back to the .NET webservice with not much luck.

Am able to download ZIP files without issues.

How have you overcome the issue of advising .NET that files are on the way?

regards

Graeme Anderson
 
gpeterds

Have you been able to resolve this issue. Sorry I did not get back to you sooner for some reason I was not nofified of your reply in this thread.
 
Rhinoman can you post a snippet of your code so I can see what exactly you are doing?
 
Guys,

If you are interested, here is some VB6 code that sends a file to .NET webservice. No MSXML - all hand coded.

Graeme Rhinoman

Dim serializer As New MSSOAPLib30.SoapSerializer30
Dim Connector As MSSOAPLib30.HttpConnector30
Dim Parser As New MSSOAPLib30.DimeParser30
Dim composer As New MSSOAPLib30.DimeComposer30
Dim Reader As MSSOAPLib30.SoapReader30
Dim inputStr As String
Dim sNewFileName As String
Dim sActualFileName As String

sNewFileName = OrigFileName
sActualFileName = Mid(sNewFileName, InStrRev(sNewFileName, "\") + 1)

Set Connector = New MSSOAPLib30.HttpConnector30
Connector.Property("EndPointURL") = Connector.Property("SoapAction") = " Connector.BeginMessage
serializer.InitWithComposer Connector.InputStream, composer

serializer.StartEnvelope
serializer.StartBody
serializer.WriteXml &quot;<UploadFile xmlns=' serializer.WriteXml &quot;<UFN>&quot; & sActualFileName & &quot;</UFN>&quot;
serializer.WriteXml &quot;<KeyCode>&quot; & KeyCode & &quot;</KeyCode>&quot;
serializer.WriteXml &quot;<UserId>&quot; & UserId & &quot;</UserId>&quot;
serializer.WriteXml &quot;</UploadFile>&quot;

serializer.EndBody
serializer.EndEnvelope

' attach the file to SOAP
Dim m_oAttach As New MSSOAPLib30.FileAttachment30
m_oAttach.FileName = sNewFileName
m_oAttach.Property(&quot;DimeType&quot;) = &quot;application/x-zip-compressed, charset=utf-8&quot;
m_oAttach.Property(&quot;DimeTNF&quot;) = &quot;media-type&quot;

serializer.AddAttachment m_oAttach
serializer.Finished

Connector.EndMessage

Set Reader = New MSSOAPLib30.SoapReader30
On Error Resume Next
If Reader.Load(Connector.OutputStream) Then
If Not Reader.Fault Is Nothing Then
inputStr = Reader.FaultString.Text
Else
If IsObject(Reader.RpcResult) Then
inputStr = Reader.RpcResult.Text
Else
inputStr = &quot;No Object&quot;
GoTo UploadFail
End If
End If
Else
inputStr = &quot;Reader Failed to load&quot;
GoTo UploadFail
End If

UploadExit:
On Error Resume Next
If FileExists(sNewFileName) Then
Kill sNewFileName
End If
frmInetMain.MsgStatus.Caption = inputStr
frmInetMain.MsgStatus.Refresh
Exit Function
UploadFail:
inputStr = &quot;An Upload error occurred, please contact Technical Support&quot;
Resume UploadExit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top