1. Lucía Quiñones
  2. PowerBuilder
  3. Tuesday, 13 September 2022 04:41 AM UTC

We have a functionality that consists of uploading attached files with a java servlet.
The way we are doing it is as follows:

      ole_object_upload.object.connecttonewobject("InternetExplorer.Application")
      ole_object_upload.object.Navigate(ls_url,0,4,lblobParam,lBlobHeader)
      ole_object_upload.object.disconnectobject( )

Being ls_url the URL of the servlet, for example "https://xxxxxxxxxxxxxxxxxx", in the BLOB field we send the attached file.

Using 'ole_browser' object of type 'Microsof Web Browser' and Internet Explorer as web browser works fine. However, we disabled Internet Explorer and set Edge web browser as default browser and with IE Compatibility Mode on it doesn't work for us, but it also doesn't give us any errors that we can see, just the document doesn't get attached.

In the software, we have tried to change the following when connecting, but it doesn't work either:

      ole_object_upload.object.connecttonewobject("Edge.Application")

Could you tell us if there is any other way to do it?

Thanks.

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 22 September 2022 09:00 AM UTC
  2. PowerBuilder
  3. # 1

Maybe the problem is that your application is 32 bit and the default internet explorer is 64 bit?

If I remember well, there are some settings you can apply to the registry to have and emulate Internet Explorer 32 bit being the default, but I'd have to look for it.

Later when I'm back from my short errand that I have to run, I'll post back.

regards.

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Wednesday, 14 September 2022 12:41 PM UTC
  2. PowerBuilder
  3. # 2

Do you really need a webbrowser (with a frontend) for what you want to do?

If you only want to upload data to a webserver you can also use HTTPClient (is available in PB 2017 R2).

Or you try the activex components Msxml2.XMLHTTP or Msxml2.ServerXMLHTTP that you can use with all PB versions.

 

Comment
  1. René Ullrich
  2. Thursday, 15 September 2022 05:26 AM UTC
Here you find an example to send files using HTTPClient:

https://community.appeon.com/index.php/qna/q-a/how-to-send-files-by-httpclient-object?limitstart=0#reply-24137

You can use it in a similar way using Msxml2.XMLHTTP. You may also find examples yere in forum or in Web.
  1. Helpful 2
  1. Lucía Quiñones
  2. Thursday, 22 September 2022 04:14 AM UTC
Hello,



the user selects the BLOB file from his computer and can select anything (PDF, TXT, PNG, ...). From what I see in the examples you have to know the type of file to specify the MimeType and we don't know that, besides we call via HTTPS not HTTP.



Thanks!
  1. Helpful
  1. René Ullrich
  2. Thursday, 22 September 2022 04:47 AM UTC
You can use Windows API to get the MIME type:

// external function

Function ulong FindMimeFromData ( &

ulong pBC, &

string pwzUrl, &

blob pBuffer, &

ulong cbSize, &

ulong pwzMimeProposed, &

ulong dwMimeFlags, &

ref ulong ppwzMimeOut, &

ulong dwReserved &

) Library "urlmon.dll"

------------------------------------------------------------------------------------------------------------------------------------------------------------

public function string of_findmimefromdata (string as_filename, blob ablob_filedata)



Constant ulong E_INVALIDARG = 2147942487 // &h80070057

Constant ulong E_OUTOFMEMORY = 2147942414 // &h8007000E

Constant ulong NOERROR = 0

String ls_mimetype

ULong lul_ptr, lul_rtn





lul_rtn = FindMimeFromData(0, as_filename, ablob_filedata, Len(ablob_filedata), 0, 0, lul_ptr, 0)

If lul_rtn = NOERROR Then

ls_mimetype = String(lul_ptr, "address")

Else

choose case lul_rtn

case E_INVALIDARG

MessageBox ("Error", "One or more of the arguments passed to the function were invalid.")

case E_OUTOFMEMORY

MessageBox ("Error", "The function could not allocate enough memory to complete the call.")

case else

MessageBox ("Error", "Undefined Error " + String(lul_rtn))

end choose

SetNull(ls_mimetype)

End If



Return ls_mimetype

  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 13 September 2022 17:36 PM UTC
  2. PowerBuilder
  3. # 3

Hi Lucia,

I would suggest upgrade to PB 2022 and use the new Web browser control: https://docs.appeon.com/pb2022/objects_and_controls/WebBrowser_control.html 

Upgrading would also get you Windows 11 compatibility plus many new features and IDE enhancements: 

Best regards,
Armeen

Comment
  1. Lucía Quiñones
  2. Wednesday, 14 September 2022 11:52 AM UTC
Hi Armeen,



Is there any plan to update PB17 with the new Web Browser controls?



Regards,

Lucia.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 14 September 2022 11:59 AM UTC
Hi Lucia;

No. PB2017 is now out of maintenance plus the new web browser internals are totally different & not compatible with PB2017.

Regards ... Chris
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 13 September 2022 17:03 PM UTC
  2. PowerBuilder
  3. # 4

Hi Lucia;

  AFAIK, the EDGE Web Browser does not support being an OCX (aka OLE Server) like in IE.

Regards ... Chris

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.