PxPlus User Forum

Twitter Twitter Twitter

Recent Posts

Pages: [1] 2 3 ... 10
Web Services / Re: Posting a File to a Web Service
« Last post by HendersonS on May 24, 2024, 05:01:04 PM »

I tested both ways that you showed me and I still get the same "invalid file" response, I will continue trying...
Web Services / Re: Posting a File to a Web Service
« Last post by Jeffrey Ferreira on May 24, 2024, 04:41:42 PM »
i think the problem is this line
Content-Disposition: form-data; name="xmlsing"; filename="xmlsing.xml"

Mine looks like this
Content-Disposition: form-data; name="filename"; filename="s:\jeff\Cleary_Quote.xml"

i feel like your line should like something like this:

Content-Disposition: form-data; name="filename"; filename="xmlsing.xml"
in other words
the value that name =  points to should be the key in the next key value pair
i have to head out but i'll try to check back in again later on this.
Web Services / Re: Posting a File to a Web Service
« Last post by HendersonS on May 24, 2024, 04:23:52 PM »
jeff, this is what it returns:

1>print mid(body$,1,300)
Content-Disposition: form-data; name="xmlsing"; filename="xmlsing.xml"
Content-Type: text/xml

<?xml version="1.0" encoding="utf-8"?>
<SemillaModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="h
Web Services / Re: Posting a File to a Web Service
« Last post by Jeffrey Ferreira on May 24, 2024, 04:10:23 PM »
Henderson, for me the problem was that keyword file/filename that i had to pass in.
i feel like you might have to pass in the word "xml"
i could be wrong.
do me a favor - you know where i have
1080 let BODY$=UPLOAD'BODY$() ! Calling Stephane's code
after you execute this method
print the mid(body$,1,300) and then send the contents to this thread...
Web Services / Re: Posting a File to a Web Service
« Last post by HendersonS on May 24, 2024, 03:58:55 PM »
Jeff thanks for your help,

I have something very similar to what you showed, I also added Stephane's program to calculate the boundaries but when I send it with pxplus the API returns an "invalid file" error, I tried it with CURL and the api receives the file correctly, does it work? How could I replicate it? in Pxplus?

Example with CURL:
Code: [Select]
curl -X 'POST' \
  'https://url/api' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F 'xml=@xmldata.xml;type=text/xml'
Web Services / Re: Posting a File to a Web Service
« Last post by Jeffrey Ferreira on May 24, 2024, 02:55:03 PM »
Hi Henderson,

here was is my best try to scale down with no extra stuff
you need Stephane's program http.upload.pvc for this to work. The other stuff is standard pxplus.
if you can't get it working let me know.

0010 begin
0020 precision 4
0030 let XML_FILE$="s:\jeff\Cleary_Quote.xml" ! Your File would be different
0040 let RAW_CREDENTIALS$="login:password" ! Using Basic Credentials then separate your login and password with a colon before calling base64 program
0060 let EXTRA_HEADERS$="Authorization: Basic "+BASE64_CREDENTIALS$
0070 let URI$="https://staging.saberis.com:9000/api/v1/documents/modules/21/upload"
0080 gosub HELPER
0110 print RESPONSE$
0120 msgbox "Done"
0130 end
1000 ! ^1000
1010 HELPER:
1020 let FIELD_NAME$="filename" ! This part was custom for my api / yours will probably be different
1040 call "*tools/readfile",(XML_FILE$),FILE_CONTENTS$
1050 let FILE_MIME_TYPE$="multipart/form-data"
1060 let UPLOAD=new("http.upload",FIELD_NAME$,XML_FILE$,FILE_CONTENTS$,FILE_MIME_TYPE$) ! This is Stephane's program http.upload.pvc that handles the boundaries (this is part i was messing up (the boundaries))
1080 let BODY$=UPLOAD'BODY$()
1090 return
Web Services / Re: Posting a File to a Web Service
« Last post by HendersonS on May 24, 2024, 02:36:43 PM »
Hi Jeff, I'm stuck in the same place trying to send a file via API, could you post the final solution? Maybe it can help me too!
General Announcements / Announcing PxPlus 2024
« Last post by PxPlus on May 24, 2024, 09:20:06 AM »
We are pleased to announce that PxPlus 2024 (v21) is available for download.

PxPlus 2024 includes new features to keep your applications safe, secure and modern

  • The Harvard Business Review reported a 20% increase in cyber security data breaches from 2022 to 2023. To protect your application and your customers' data, PxPlus 2024 is updated with the latest Security modules.

  • In speaking with the developer community, we learned that many developers are using Visual Studio Code in other areas of their development teams. PxPlus 2024 includes a new extension to Visual Studio Code, an industry-leading code editor that is the preferred choice for many developers.

  • In today’s competitive environment, the look and feel of an application is equally important as the functionality. PxPlus 2024 includes modern PxPlus toolkit interfaces showcasing Dark and Light modes, and new tools to update the look of your Nomads and non-Nomads based applications.

  • Webster+, launched in 2021, provides developers with the optimal toolset to convert your application to browser based. PxPlus 2024 continues to enhance Webster+ with the ability to create and maintain screen library objects using a Web browser with Webster+ Inspector.

  • We made it even easier for you to design your application screens for NOMADS and Webster+ with the new File Maintenance Generator Enhanced Layout.

For a complete overview of new features in this release, see the What’s New section.

Watch our short video introducing PxPlus 2024

Additional Resources

To download the software for PxPlus 2024, go to our Download Center.

To download the software for v8.00 PxPlus SQL ODBC Driver and PxPlus SQL Server , go to our Download Center.

For additional technical information, see our Documentation website.

The PVX Plus Team
Programming / Re: Copy Data Definitions
« Last post by Tom Anderson on May 23, 2024, 05:08:05 PM »

I may be looking at this incorrectly but it looks like this simply copies file 'A' to file 'B'.

What I need is to copy the file definition as contained in the files 'providex.dde and providex.ddf leaving the original data definition unchanged.

Programming / Re: Copy Data Definitions
« Last post by Jim Morton on May 23, 2024, 03:11:45 PM »
Here is a routine I use on Windows to copy all files in a directory.
You can tweak it to change the filenames.

40400 COPY_DIR:! ^0200
40410 local fr_file$,to_file$,file_list$,command$
40420 ! needs fully pathed source$ and dest$
40430 source$=sub(source$,"/","\")
40440 call "*dirtree",source$,file_list$,sep,0
40450 while not(nul(file_list$))
40460 fr_file$=file_list$(1,pos(sep=file_list$)-1),file_list$=file_list$(pos(sep=file_list$)+1)
40470 to_file$=sub(fr_file$,source$,dest$)
40472 module$=fr_file$(pos("\"=fr_file$,-2)+1,2)
40474 if pos(module$=module_skip_list$,2) then continue
40480 ! Create any sub directories needed
40490 for i=1 to pos("\"=to_file$,1,0)
40500 directory to_file$(1,pos("\"=to_file$,1,i)),err=*next
40510 next i
40520 erase to_file$,err=*next
40530 command$=env("comspec")+" /c copy "+fr_file$+" "+to_file$
40540 invoke wait hide command$
40550 wend
40560 return
Pages: [1] 2 3 ... 10