Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Send UBL 2.1 via API POST
Message
From
30/11/2021 09:53:11
 
 
To
29/11/2021 15:00:12
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
01682832
Message ID:
01682870
Views:
58
>Hi Antonio,
>

>I've try (many solution, this is one), but this code in VFP - not working:
>
>
>srcFile = [MyUBL2-1-File.xml]
>data = Filetostr(m.srcFile)
>fileName = justfName(m.srcFile)
>boundary = "----WebKitFormBoundary7MA4YWxkTrZu0gW"   
>
>TEXT TO m.lcContent TEXTMERGE NOSHOW
>----WebKitFormBoundary7MA4YWxkTrZu0gW
>Content-Disposition: form-data; name="data"; filename="MyUBL2-1-File.xml"
>Content-Type: text/xml
>
><<data>>
>----WebKitFormBoundary7MA4YWxkTrZu0gW
>Content-Disposition: form-data; name="type"
>
>0
>----WebKitFormBoundary7MA4YWxkTrZu0gW
>Content-Disposition: form-data; name="sef"
>
>1
>----WebKitFormBoundary7MA4YWxkTrZu0gW
>Content-Disposition: form-data; name="contacts[0][email]"
>
>MyEmailAddress@MyDomen4Email.rs
>----WebKitFormBoundary7MA4YWxkTrZu0gW
>Content-Disposition: form-data; name="contacts[0][name]"
>
>FirstName LastName
>----WebKitFormBoundary7MA4YWxkTrZu0gW
>ENDTEXT
>
[...]

>
>But if I make it from a cURL (from PostMan) .bat file - then it works
>

Two things for you to try with your VFP solution:

a) the last boundary must be

----WebKitFormBoundary7MA4YWxkTrZu0gW--

(note the two final dashes '--').

b) you must insert a final blank line so that the TEXT .. ENDTEXT construct creates an additional (but required) CRLF.

That is:
----WebKitFormBoundary7MA4YWxkTrZu0gW--

ENDTEXT
>
>If you have an idea how to convert C # code to VFP - it would be great.
>

Porting the C# code into VFP requires writing a REST class for VFP, similar in specs to the .NET class. I think there are a few classes or functions out there for the urlencoding EncType, adding the multipart EncType wouldn't be too difficult, probably.
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform