From: richard.townsendrose on
Norbert, or
may be some comments from Geoff please

I now need some more help please ...

I have the basic data being sent up to the script for it to process
and that is in fact sending emails fine ...

Now i want to add some attachments ... so I have looked your function
called sample_post_file().

this has boundaries. i note that VO has a define called ATTACH_BEGIN
for the critical leading "--".

How do i put a boundary around the basic data that is posted as well
as the file to be uploaded. thats in effect merging your FUNCTION
Sample_Post() that i am using with the one to post a file ... which I
wnat to be collected by PHP's $_FILE array which is where they arrive
when one uses an html form ...

I looked at the Sample_Post_MultipleData() fucntion but i dont
understand how it all goes together .. despite spending many hours
reading
http://en.wikipedia.org/wiki/MIME
is a good place ...

below is my code to which i want to add ome attachments ehich is based
on your sample for which i am very greatful

i suppose the questions are:
a) what goes in the cHeader
b) what is the content_disposition etc of the text data ?

regards

richard

ps: cserver is www.tdocplus.co.uk
cscript is \tdoc_scripts_510\tdocsend5.php
edi_ver is '510'
doctype is 'TDOC HTTP Mail'

METHOD SendHTTPPost() CLASS EmailSend
LOCAL lOk:=FALSE AS LOGIC
LOCAL oHttp AS cHttp
LOCAL cPostData AS STRING
LOCAL cPHPPath AS STRING
LOCAL dwPos AS DWORD
LOCAL cServer AS STRING
LOCAL cScript AS STRING
LOCAL cPage AS STRING
LOCAL cText AS STRING

cPHPPath:=SysObject():GetSet(PHPPath)
// get the third '/' out of typically: http://www.s.s.ss.sss.sss/
dwPos:=At3('/', cPHPPath, 15) // 123456789012345
cServer:=SubStr(cPHPPath, 8, dwPos - 8)
cScript:=SubStr(cPHPPath, dwPos)

cPostData:= "ver=" + EDI_VER + ;
"&doctype=" + HTTP_MAIL_NAME + ;
"&movtype=None" + ;
"&senderemail=" + AllTrim(LookupName(SELF:cSenderRef, #EMAIL))
+ ;
"&recipemail=" + SELF:GetRecipList() + ;
"&jobtitle=" + SELF:cTitle + ;
"&content=" + SELF:cMessage

oHttp := CHttp{"TDOC HTTP Mail Sender"}

cPage := oHttp:GetDocumentByGetOrPost( ;
cServer,;
cScript,;
cPostData,;
/*cHeader*/,;
"POST",;
/*INTERNET_DEFAULT_HTTPS_PORT*/,;
/*INTERNET_FLAG_SECURE*/ ;
)

// check status from server process
IF ! IsNil(oHttp:ResponseHeader)
cText:=oHttp:ResponseHeader
lOk:=TRUE
ELSE
cText:='No response from Server: ' + cServer + CRLF + 'Using script:
' + cScript
lOk:=FALSE
ENDIF
MemoWrit(SysObject():GetSet(SpoolPath) + 'EmailStat.txt', cText)
TextBox{SysObject(), 'Info', cText}:show()

// publish response
IF IsNil(cPage)
cPage:='Email Sender failed to generate a message'
SELF:cErrorMsg:=cPage
lOk:=FALSE
ELSEIF Instr('#FB9491', cPage) // its red !
lOk:=FALSE
ENDIF
MemoWrit(SysObject():GetSet(SpoolPath) + 'EmailAns.htm', cPage)
ShellExecute(NULL, String2Psz("open"),
String2Psz(SysObject():GetSet(SpoolPath) + 'EmailAns.htm'), NULL,
NULL, SW_SHOW )

oHttp:CloseRemote()
oHttp:Axit()

RETURN lOk
From: Geoff Schaller on
R.

I have no idea what you're talking about nor what this has to do with
web services.

Geoff


"richard.townsendrose" <richard.townsendrose(a)googlemail.com> wrote in
message
news:d67fc3d7-89e8-4801-bb26-f6c303ec01a5(a)e21g2000vbl.googlegroups.com:

> Norbert, or
> may be some comments from Geoff please
>
> I now need some more help please ...
>
> I have the basic data being sent up to the script for it to process
> and that is in fact sending emails fine ...
>
> Now i want to add some attachments ... so I have looked your function
> called sample_post_file().
>
> this has boundaries. i note that VO has a define called ATTACH_BEGIN
> for the critical leading "--".
>
> How do i put a boundary around the basic data that is posted as well
> as the file to be uploaded. thats in effect merging your FUNCTION
> Sample_Post() that i am using with the one to post a file ... which I
> wnat to be collected by PHP's $_FILE array which is where they arrive
> when one uses an html form ...
>
> I looked at the Sample_Post_MultipleData() fucntion but i dont
> understand how it all goes together .. despite spending many hours
> reading
> http://en.wikipedia.org/wiki/MIME
> is a good place ...
>
> below is my code to which i want to add ome attachments ehich is based
> on your sample for which i am very greatful
>
> i suppose the questions are:
> a) what goes in the cHeader
> b) what is the content_disposition etc of the text data ?
>
> regards
>
> richard
>
> ps: cserver is www.tdocplus.co.uk
> cscript is \tdoc_scripts_510\tdocsend5.php
> edi_ver is '510'
> doctype is 'TDOC HTTP Mail'
>
> METHOD SendHTTPPost() CLASS EmailSend
> LOCAL lOk:=FALSE AS LOGIC
> LOCAL oHttp AS cHttp
> LOCAL cPostData AS STRING
> LOCAL cPHPPath AS STRING
> LOCAL dwPos AS DWORD
> LOCAL cServer AS STRING
> LOCAL cScript AS STRING
> LOCAL cPage AS STRING
> LOCAL cText AS STRING
>
> cPHPPath:=SysObject():GetSet(PHPPath)
> // get the third '/' out of typically: http://www.s.s.ss.sss.sss/
> dwPos:=At3('/', cPHPPath, 15) // 123456789012345
> cServer:=SubStr(cPHPPath, 8, dwPos - 8)
> cScript:=SubStr(cPHPPath, dwPos)
>
> cPostData:= "ver=" + EDI_VER + ;
> "&doctype=" + HTTP_MAIL_NAME + ;
> "&movtype=None" + ;
> "&senderemail=" + AllTrim(LookupName(SELF:cSenderRef, #EMAIL))
> + ;
> "&recipemail=" + SELF:GetRecipList() + ;
> "&jobtitle=" + SELF:cTitle + ;
> "&content=" + SELF:cMessage
>
> oHttp := CHttp{"TDOC HTTP Mail Sender"}
>
> cPage := oHttp:GetDocumentByGetOrPost( ;
> cServer,;
> cScript,;
> cPostData,;
> /*cHeader*/,;
> "POST",;
> /*INTERNET_DEFAULT_HTTPS_PORT*/,;
> /*INTERNET_FLAG_SECURE*/ ;
> )
>
> // check status from server process
> IF ! IsNil(oHttp:ResponseHeader)
> cText:=oHttp:ResponseHeader
> lOk:=TRUE
> ELSE
> cText:='No response from Server: ' + cServer + CRLF + 'Using script:
> ' + cScript
> lOk:=FALSE
> ENDIF
> MemoWrit(SysObject():GetSet(SpoolPath) + 'EmailStat.txt', cText)
> TextBox{SysObject(), 'Info', cText}:show()
>
> // publish response
> IF IsNil(cPage)
> cPage:='Email Sender failed to generate a message'
> SELF:cErrorMsg:=cPage
> lOk:=FALSE
> ELSEIF Instr('#FB9491', cPage) // its red !
> lOk:=FALSE
> ENDIF
> MemoWrit(SysObject():GetSet(SpoolPath) + 'EmailAns.htm', cPage)
> ShellExecute(NULL, String2Psz("open"),
> String2Psz(SysObject():GetSet(SpoolPath) + 'EmailAns.htm'), NULL,
> NULL, SW_SHOW )
>
> oHttp:CloseRemote()
> oHttp:Axit()
>
> RETURN lOk

From: richard.townsendrose on
Geoff

Web Services to me is some php or asp or ... code which receives some
data, process's it and thats it .....

so filling in an html form is calling a "web service"
agreed that there are such things as SOAP - as wikipedia says

"
As a layman's example of how SOAP procedures can be used, a SOAP
message could be sent to a web-service-enabled web site (for example,
a real-estate price database) with the parameters needed for a search.
The site would then return an XML-formatted document with the
resulting data (prices, location, features, etc). Because the data is
returned in a standardized machine-parseable format, it could then be
integrated directly into a third-party web site or application.
"

viz you fill in a form, and you get back a page of data ! been doing a
lot of that lately

richard
From: Geoff Schaller on
Richard,

You didn't read your own definition very well.

Reading a page, filling in a form and receiving data back is NOT a web
service. That is an http request and this has been going on for years.

A SOAP request is used to engage a web service, yes, and it sends and
receives only XML data. There is no form to fill out and no "page" or
data to receive. Only xml. The web service will live on a URL somewhere
and will be executable code. You will be using OLE usually from VO.

What we do is go one step further and wrap the SOAP stuff in a DLL and
expose this through COM. That way the VO client only has to deal with an
object oriented and strongly typed layer to access functionality. This
is so much easier to do in C# and the reason for COM.

Geoff



"richard.townsendrose" <richard.townsendrose(a)googlemail.com> wrote in
message
news:0d2cdc2e-e351-440c-82a2-af522e64b7fc(a)j27g2000vbp.googlegroups.com:

> Geoff
>
> Web Services to me is some php or asp or ... code which receives some
> data, process's it and thats it .....
>
> so filling in an html form is calling a "web service"
> agreed that there are such things as SOAP - as wikipedia says
>
> "
> As a layman's example of how SOAP procedures can be used, a SOAP
> message could be sent to a web-service-enabled web site (for example,
> a real-estate price database) with the parameters needed for a search.
> The site would then return an XML-formatted document with the
> resulting data (prices, location, features, etc). Because the data is
> returned in a standardized machine-parseable format, it could then be
> integrated directly into a third-party web site or application.
> "
>
> viz you fill in a form, and you get back a page of data ! been doing a
> lot of that lately
>
> richard

From: John Martens on
Richard,

This is what I do in Norberts code to add files:

FOR dwIndexNrPost := 1 UPTO ALen(aPostData)
cPostData += 'Content-Disposition: form-data;
name="'+aPostData[dwIndexNrPost,1]+'"' + CrLf + CrLf +
aPostData[dwIndexNrPost,2] + CrLf + "--" + cBoundary
IF dwIndexNrPost == ALen(aPostData)
cPostData += "--"
ELSE
cPostData += CrLf
ENDIF
NEXT

aPostData[1] is the filename
aPostdata[2] is the filecontent

Filecontent is then send to a PHP script that gets the files and it's
content.

Cheers,
John



Op 16-5-2010 13:28, richard.townsendrose schreef:
> Norbert, or
> may be some comments from Geoff please
>
> I now need some more help please ...
>
> I have the basic data being sent up to the script for it to process
> and that is in fact sending emails fine ...
>
> Now i want to add some attachments ... so I have looked your function
> called sample_post_file().
>
> this has boundaries. i note that VO has a define called ATTACH_BEGIN
> for the critical leading "--".
>
> How do i put a boundary around the basic data that is posted as well
> as the file to be uploaded. thats in effect merging your FUNCTION
> Sample_Post() that i am using with the one to post a file ... which I
> wnat to be collected by PHP's $_FILE array which is where they arrive
> when one uses an html form ...
>
> I looked at the Sample_Post_MultipleData() fucntion but i dont
> understand how it all goes together .. despite spending many hours
> reading
> http://en.wikipedia.org/wiki/MIME
> is a good place ...
>
> below is my code to which i want to add ome attachments ehich is based
> on your sample for which i am very greatful
>
> i suppose the questions are:
> a) what goes in the cHeader
> b) what is the content_disposition etc of the text data ?
>
> regards
>
> richard
>
> ps: cserver is www.tdocplus.co.uk
> cscript is \tdoc_scripts_510\tdocsend5.php
> edi_ver is '510'
> doctype is 'TDOC HTTP Mail'
>
> METHOD SendHTTPPost() CLASS EmailSend
> LOCAL lOk:=FALSE AS LOGIC
> LOCAL oHttp AS cHttp
> LOCAL cPostData AS STRING
> LOCAL cPHPPath AS STRING
> LOCAL dwPos AS DWORD
> LOCAL cServer AS STRING
> LOCAL cScript AS STRING
> LOCAL cPage AS STRING
> LOCAL cText AS STRING
>
> cPHPPath:=SysObject():GetSet(PHPPath)
> // get the third '/' out of typically: http://www.s.s.ss.sss.sss/
> dwPos:=At3('/', cPHPPath, 15) // 123456789012345
> cServer:=SubStr(cPHPPath, 8, dwPos - 8)
> cScript:=SubStr(cPHPPath, dwPos)
>
> cPostData:= "ver=" + EDI_VER + ;
> "&doctype=" + HTTP_MAIL_NAME + ;
> "&movtype=None" + ;
> "&senderemail=" + AllTrim(LookupName(SELF:cSenderRef, #EMAIL))
> + ;
> "&recipemail=" + SELF:GetRecipList() + ;
> "&jobtitle=" + SELF:cTitle + ;
> "&content=" + SELF:cMessage
>
> oHttp := CHttp{"TDOC HTTP Mail Sender"}
>
> cPage := oHttp:GetDocumentByGetOrPost( ;
> cServer,;
> cScript,;
> cPostData,;
> /*cHeader*/,;
> "POST",;
> /*INTERNET_DEFAULT_HTTPS_PORT*/,;
> /*INTERNET_FLAG_SECURE*/ ;
> )
>
> // check status from server process
> IF ! IsNil(oHttp:ResponseHeader)
> cText:=oHttp:ResponseHeader
> lOk:=TRUE
> ELSE
> cText:='No response from Server: ' + cServer + CRLF + 'Using script:
> ' + cScript
> lOk:=FALSE
> ENDIF
> MemoWrit(SysObject():GetSet(SpoolPath) + 'EmailStat.txt', cText)
> TextBox{SysObject(), 'Info', cText}:show()
>
> // publish response
> IF IsNil(cPage)
> cPage:='Email Sender failed to generate a message'
> SELF:cErrorMsg:=cPage
> lOk:=FALSE
> ELSEIF Instr('#FB9491', cPage) // its red !
> lOk:=FALSE
> ENDIF
> MemoWrit(SysObject():GetSet(SpoolPath) + 'EmailAns.htm', cPage)
> ShellExecute(NULL, String2Psz("open"),
> String2Psz(SysObject():GetSet(SpoolPath) + 'EmailAns.htm'), NULL,
> NULL, SW_SHOW )
>
> oHttp:CloseRemote()
> oHttp:Axit()
>
> RETURN lOk