473,811 Members | 3,532 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create Web Services

Hi I want to create a Web Services where I receive a Template DOT word

a file XML and with these I create a Document that a I'll Send as Dime
Attachment.

<WebMethod()> _
Public Function CreateDimeWord( ByVal DotName As String, ByVal
sXML As String) As String
Dim respContext As SoapContext =
ResponseSoapCon text.Current
Try
Dim wrdAPP As Object
Dim oWordDoc As Object
Dim strdocPath As String
Dim sr As System.IO.Strea m
Dim i As Integer
Dim DocumentName As String
Dim sFileName As String
If respContext.Att achments.Count = 1 Then
sr = respContext.Att achments(0).Str eam
DocumentName =
respContext.Att achments(0).Id. ToString.Split( ":").GetValue(1 ).ToString
strdocPath = Application("Up loadPath") +
DocumentName
Dim objfilestream = New
System.IO.FileS tream(strdocPat h, System.IO.FileM ode.Create)
Dim buf(sr.Length) As Byte
While ((i =
respContext.Att achments(0).Str eam.Read(buf, 0, buf.Length)) > 0)
objfilestream.W rite(buf, 0, i)
End While
sFileName = "c:\temp\" & DotName & ".doc"
wrdAPP = CreateObject("W ord.Application ")
oWordDoc = wrdAPP.Document s.Open(strdocPa th, ,
True)
oWordDoc.SaveAs (sFileName)
wrdAPP.Run("Wor dHelper.Run", sXML)
oWordDoc.Save()
oWordDoc.Close( )
oWordDoc = Nothing
Dim dimeAttach As New
DimeAttachment( "applicatio n/msword", TypeFormat.Medi aType, sFileName)
respContext.Att achments.Add(di meAttach)
Return "1"
Else
Return "0"
End If
Catch ex As FieldAccessExce ption
Return ex.ToString
End Try
End Function
this is the client...in VB6
Private Sub Command1_Click( )
On Error GoTo errcode
Dim SOAPReader As MSSOAPLib30.Soa pReader30
Dim SOAPSerializer As MSSOAPLib30.Soa pSerializer30
Dim SOAPConnector As MSSOAPLib30.Soa pConnector30
Dim SOAPParser As DimeParser30
Dim SOAPRcvdAttachm ents As MSSOAPLib30.IRe ceivedAttachmen t
Dim SOAPComposer As DimeComposer30
Dim DownLoadFile As String
Dim SOAPFileAttachm ent As FileAttachment3 0
Dim sNomeAllegato As String
Dim allegato As String
Set SOAPConnector = New MSSOAPLib30.Htt pConnector30
SOAPConnector.P roperty("EndPoi ntURL") =
"http://ibcl14/GestioneModelli WS/GestModelli.asm x"
SOAPConnector.C onnect
' Set Method Call
SOAPConnector.P roperty("SoapAc tion") =
"http://tempuri.org/GestioneModelli WS/GestModelli/CreateDimeWord"
allegato = "E:\COM.dot "
Set SOAPFileAttachm ent = CreateObject("M SSOAP.FileAttac hment30")
SOAPFileAttachm ent.FileName = allegato
SOAPFileAttachm ent.DeleteAfter Sending = False
'For j = 3 To Len(allegato)
' strTestChar = Mid(allegato, Len(allegato) - j, 1)
' If strTestChar = "\" Then
' sNomeAllegato = Right(allegato, j)
' Exit For
' End If
'Next
SOAPConnector.B eginMessage
' Create DIME composer and serializer objects, then initialize the
' serializer with the composer.
Set SOAPComposer = CreateObject("M SSOAP.DimeCompo ser30")
Set SOAPSerializer = CreateObject("M SSOAP.SoapSeria lizer30")
SOAPSerializer. InitWithCompose r SOAPConnector.I nputStream,
SOAPComposer
' Serializer.Init Connector.Input Stream
' Write out the SOAP Envelope and Body start tags.
SOAPSerializer. StartEnvelope
SOAPSerializer. StartBody
' Start the method element.
SOAPSerializer. StartElement "CreateDimeWord ",
"http://tempuri.org/"
SOAPSerializer. StartElement "DotName"
SOAPSerializer. WriteString "Prova"
SOAPSerializer. EndElement
SOAPSerializer. StartElement "sXML"
SOAPSerializer. WriteString
"LIBRANET><COMU NICAZIONI><RECO RDS><RECORD><id _Comunicazione> 62</id_Comunica*zio ne><id_Installa zione>111111</id_Installazion e><c_TipoDelibe ra>DG

</c_TipoDelibera> </RECORD></RECORDS></COMUNICAZIONI></LIBRANET>"
SOAPSerializer. EndElement
SOAPSerializer. AddAttachment SOAPFileAttachm ent
SOAPSerializer. EndElement
' Write out the SOAP Envelope and Body end tags.
SOAPSerializer. EndBody
SOAPSerializer. EndEnvelope
' Tell the serializer that we are finished providing all message
' content (both the SOAP envelope and all attachments).
SOAPSerializer. Finished
SOAPConnector.E ndMessage
''''SOAPConnect or.BeginMessage
''''
''''Set SOAPComposer = CreateObject("M SSOAP.DimeCompo ser30")
''''Set SOAPSerializer = New MSSOAPLib30.Soa pSerializer30
''''SOAPSeriali zer.InitWithCom poser SOAPConnector.I nputStream,
SOAPComposer
''''
''''' Create/Send SOAP Message with Parameter "Number"
''''
''''SOAPSeriali zer.StartEnvelo pe
'''' SOAPSerializer. StartBody
'''' SOAPSerializer. StartElement "DownloadFi le",
"http://tempuri.org/"
'''' SOAPSerializer. StartElement "DocumentNa me"
'''' SOAPSerializer. WriteString sNomeAllegato
'''' SOAPSerializer. EndElement
''''' SOAPSerializer. StartElement "sXML"
''''' SOAPSerializer. WriteString "XX"
''''' SOAPSerializer. EndElement
'''' SOAPSerializer. AddAttachment SOAPFileAttachm ent
'''' SOAPSerializer. EndElement
'''' SOAPSerializer. EndBody
''''SOAPSeriali zer.EndEnvelope
''''
''''SOAPConnect or.EndMessage
Set SOAPReader = New SoapReader30
SOAPReader.Load SOAPConnector.O utputStream
If Not SOAPReader.Faul t Is Nothing Then
DownLoadFile = "0"
Else
DownLoadFile = "1"
End If
'Set SOAPReader = New SoapReader30
'Set SOAPParser = New DimeParser30
'If SOAPReader.Load WithParser(SOAP Connector.Outpu tStream, SOAPParser)
Then
' Set SOAPRcvdAttachm ents = SOAPReader.Atta chments.Item(0)
' SOAPRcvdAttachm ents.SaveToFile "C:\downloaded. doc"
' DownLoadFile = "OK"
'Else
' DownLoadFile = "no attachment"
'End If
'MsgBox DownLoadFile
Exit Sub
errcode:
MsgBox Err.Description
Unload Me
End Sub
The Web Services don't work
Why? Thanks a Lot

Mar 14 '06 #1
1 2318
please do not crosspost in multiple groups. It's considered rude

Mar 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2811
by: Benny Dein | last post by:
Hi I want to create a servlet or something similar by which im able to create virtual webservices. Lets say i would like to create a webservice with a method called 'getDate' which returnes the current date. This could be done by making a wsdl file (or whatever the name is) and via a wizard in some java tool make a real webservice. This webservice would be static since it creates a class in which i can make my code to return the
2
2515
by: Peter | last post by:
Firstly let me be very clear about this, I do not want to create a web service proxy nor do I want to do anything with web services. Basically, I have a shrink wrapped desktop application which downloads data from a web site. Unfortunately the application has a fixed timeout and the web server regularly exceeds this, causing the application to shut the connection and subsequently not receive any data. The desktop application also uploads...
3
1966
by: Mark B | last post by:
I want to create a top navigation bar: Home Products Services About Contact I have been trying to use web.sitemap as the source for a menu control as show in the example: <?xml version="1.0" encoding="utf-8" ?> <siteMap>
5
3575
by: krasman | last post by:
hi everyone, i hope you might help me on this one. i need to create a contact in a exchange public folder using dotnet (vb or c#) and exchange 2003, without using outlook object model. i'm searching for a few hours and can't find a clear example on how to do it. i've already seen code blocks using webdav, directory services, but always related with creating active directory users or mail enabling users, not exactly what i'm looking for....
5
3774
by: krasman | last post by:
hi everyone, i hope you might help me on this one. i need to create a contact in a exchange public folder using dotnet (vb or c#) and exchange 2003, without using outlook object model. i'm searching for a few hours and can't find a clear example on how to do it. i've already seen code blocks using webdav, directory services, but always related with creating active directory users or mail enabling users, not exactly what i'm looking for....
0
9604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10394
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10127
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9201
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7665
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.