× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



That's what I was trying to convey in my initial response regarding ENCTYPE


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of tegger@xxxxxxxxxxx
Sent: Tuesday, 16 July 2013 12:41 a.m.
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: http_url_post_xml and REST



Had a 'ah ha!' moment/email this morning.



Apparently, the server we've been trying to send XML data into does not support multipart-form settings.









----- Original Message -----


From: tegger@xxxxxxxxxxx
To: "RPG programming on the IBM i (AS/400 and iSeries)" <rpg400-l@xxxxxxxxxxxx>
Sent: Friday, July 12, 2013 4:42:32 PM
Subject: Re: http_url_post_xml and REST




Thanks for you all of your help.

 

I think the issue is on their side and until I can get their techs on the phone, this program will sit still. We can download XML directly from them with no issues at all. The upload is the issue.

 

 

1) I looked at my prototype and just added the missing field.

2) I figured the colon was missing. Not an issue.

3) The file appears the same on our side in the IFS. But, as you pointed out, it needed to be done.

 

 

Sorry about replying to the list and you. I've gotten so used to hitting REPLY-ALL while at work, I didn't think of it while replying on my personal email account.

 

Jay B

Marydel



 

----- Original Message -----




From: "Scott Klement" <rpg400-l@xxxxxxxxxxxxxxxx>
To: "RPG programming on the IBM i (AS/400 and iSeries)" <rpg400-l@xxxxxxxxxxxx>
Sent: Friday, July 12, 2013 2:05:46 PM
Subject: Re: http_url_post_xml and REST

Jay,

1) All of my IFS prototypes are here:
http://www.scottklement.com/rpg/copybooks/ifsio_h.rpgle.txt

2) Yes, I meant to have a colon, 1208: 0.  These are separate parameters.

3) As I said earlier, this will not make any difference to the problem you're having. The < character has the same hex value in UTF-8 that it has in ISO-8859-1.  So changing this to UTF-8 is the "right thing to do"
(because you explicitly say that your data is UTF-8 in the XML document), and may solve future problems down the road, but will not solve the immediate error.

When replying, please just reply to RPG400-L. You are sending your replies both to me privately and to the list, and it's confusing me.

Thanks!
-SK

On 7/12/2013 12:08 PM, tegger@xxxxxxxxxxx wrote:
How do you have your open function prototyped?



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

*From: *"Scott Klement" <rpg400-l@xxxxxxxxxxxxxxxx>
*To: *"RPG programming on the IBM i (AS/400 and iSeries)"
<rpg400-l@xxxxxxxxxxxx>
*Cc: *tegger@xxxxxxxxxxx
*Sent: *Friday, July 12, 2013 12:46:05 PM
*Subject: *Re: http_url_post_xml and REST

This won't work properly with CCSID 1208, since you are specifying
code pages (which was a limitation of the IFS in V4R5 and earlier, but
with
V5R1 CCSID support was added.)   Also, I would recommend using
O_TEXT_CREAT and eliminating the "two opens" scenario..  the "two opens"
situation would work fine if you're targeting the root or QOpenSys
file system, but does not work with, for example, /QNTC.  Best
practice is to use O_TEXT_CREAT if you are targeting V5R2 or later.

It's also very strange that you are granting execute permission to the
file -- this allows QShell or PASE shells to run your XML document as
a shell script -- which doesn't make any sense at all.

Here's what I would do (requires V5R2 or later):

     flags = O_RDWR + O_CREAT + O_TRUNC + O_TEXTDATA
           + O_CCSID + O_TEXT_CREAT;

     mode = S_IRUSR + S_IWUSR + S_IRGRP + S_IWGRP
           + S_IROTH;

     fd = open( %trimr(filename): flags: mode: 1208 0);

O_CCSID gives it support for CCSIDs (vs O_CODEPAGE which only supports
code pages) and O_TEXT_CREAT eliminates the need to open the file,
close it, and then re-open it.  The additional parameter to open()
tells which CCSID to translate from, so in my example, I used the
special value of 0=Job CCSID.  So it'll translate from the job's CCSID
to 1208 (which is
UTF-8)

-SK


On 7/12/2013 11:31 AM, tegger@xxxxxxxxxxx wrote:
 >
 >
 > I found the issue with writing the IFS file using codepage=1028...
 >
 >
 >
 > flags=O_RDWR+O_CREAT+O_TRUNC+O_TEXTDATA+O_CODEPAGE;
 > mode=S_IRWXU+S_IRWXG+S_IROTH+S_IXOTH;
 > codepage=819;   // 437 or 819  1208-UTF-8
 > fd=open(%trim(filename):flags:mode:codepage);
 > callp close(fd);
 >
 > flags=O_RDWR+O_TEXTDATA;
 > fd=open(%trim(filename):flags);
 >
 >
 >
 > The last calls to the flags needed to just be O_RDWR.
 >
 > Changing to 1208 on the write didn't make a difference. I still get
the same error. I'm trying to get up with the technical people on the
other end to see what was actually received to trigger the error. So
far, no luck.
 >
 >
 >
 >
 >
 >
 >
 > ----- Original Message -----
 >
 >
 > From: "Scott Klement" <rpg400-l@xxxxxxxxxxxxxxxx>
 > To: "RPG programming on the IBM i (AS/400 and iSeries)"
<rpg400-l@xxxxxxxxxxxx>
 > Sent: Friday, July 12, 2013 12:26:49 PM
 > Subject: Re: http_url_post_xml and REST
 >
 > Jay,
 >
 > 1208 isn't a code page, it's a CCSID.   UTF-8 is much more than
just a
 > single code page.
 >
 > When you say "nothing gets written", this sounds an awful lot like
a
 > coding error.  Can you show us how you're writing this XML?
 >
 > Having said that, I can't see why using 1208 vs 819 would have any
 > impact on the specific error you're getting. I agree that 1208 is
 > better, mind you -- but I don't think it'll be the solution to the
 > immediate problem.
 >
 > -SK
 >
 >
 > On 7/12/2013 8:36 AM, tegger@xxxxxxxxxxx wrote:
 >>
 >>
 >> I tried the 1208 codepage for the creation of the XML file. The
problem is that nothing gets written to the IFS file when set this way.
 >>
 >>
 >>
 >>
 >>
 >>
 >>
 >> ----- Original Message -----
 >>
 >>
 >> From: "thomas raddatz" <thomas.raddatz@xxxxxx>
 >> To: rpg400-l@xxxxxxxxxxxx
 >> Sent: Friday, July 12, 2013 2:28:14 AM
 >> Subject: Re: http_url_post_xml and REST
 >>
 >>
 >> Even if the file looks fine on your PC and is displayed nicely in
Firefox
 >> and IE, I would create it with codepage 1208, which is UTF-8.
Codepage 819
 >> matches ISO-8859-1 of the west European languages.
 >>
 >> Procedure http_url_post_stmf() does not do any character
translation and
 >> therefore there is no other option (beside the codepage of the
stmf) to
 >> change the codepage.
 >>
 >> Thomas.
 >>
 >>
 >> rpg400-l-bounces@xxxxxxxxxxxx schrieb am 11.07.2013 20:48:18:
 >>
 >>> Von: tegger@xxxxxxxxxxx
 >>> An: rpg400-l@xxxxxxxxxxxx,
 >>> Datum: 11.07.2013 20:48
 >>> Betreff: Re: http_url_post_xml and REST
 >>> Gesendet von: rpg400-l-bounces@xxxxxxxxxxxx
 >>>
 >>>
 >>>
 >>> The XML is created on the IFS using codepage 819.
 >>>
 >>> When it is downloaded to a PC, everything looks file. If I load
it
 >>> to IE or FIREFOX, everything comes up perfectly.
 >>>
 >>>
 >>>
 >>>
 >>>
 >>>
 >>>
 >>> ----- Original Message -----
 >>>
 >>>
 >>> From: tegger@xxxxxxxxxxx
 >>> To: "RPG programming on the IBM i (AS/400 and iSeries)" <rpg400-
 >>> l@xxxxxxxxxxxx>
 >>> Sent: Thursday, July 11, 2013 2:17:57 PM
 >>> Subject: Re: http_url_post_xml and REST
 >>>
 >>>
 >>>
 >>> Now that's a possibility.
 >>>
 >>>
 >>>
 >>> What's the best way to force the encoding?
 >>>
 >>>
 >>>
 >>>
 >>>
 >>> ----- Original Message -----
 >>>
 >>>
 >>> From: "thomas raddatz" <thomas.raddatz@xxxxxx>
 >>> To: rpg400-l@xxxxxxxxxxxx
 >>> Sent: Thursday, July 11, 2013 2:44:21 AM
 >>> Subject: Re: http_url_post_xml and REST
 >>>
 >>>
 >>> For me the error message implies that you do not send the XML in
UTF-8
 >> but
 >>> any other encoding. That way the server can not find the "<"
character
 >> at
 >>> the first position of the XML.
 >>>
 >>> The error message:
 >>>
 >>>      <?xml version="1.0" encoding="UTF-8"?><error>XML Error:
Fatal
error:
 >>>      Start tag expected, '&lt;' not found at :1.</error>
 >>>
 >>> What the server tries to read:
 >>>
 >>>      <?xml version="1.0" encoding="UTF-8"?>
 >>>      <service_orders>
 >>>
 >>> Because of the wrong encoding it can not find the "<" of "<?xml ...".
 >>>
 >>> Nothing more than a guess.
 >>>
 >>> Thomas.
 >>>
 >>> rpg400-l-bounces@xxxxxxxxxxxx schrieb am 10.07.2013 21:53:58:
 >>>
 >>>> Von: tegger@xxxxxxxxxxx
 >>>> An: rpg400-l@xxxxxxxxxxxx,
 >>>> Datum: 10.07.2013 21:54
 >>>> Betreff: Re: http_url_post_xml and REST
 >>>> Gesendet von: rpg400-l-bounces@xxxxxxxxxxxx
 >>>>
 >>>>
 >>>>
 >>>> I have that in there. Thanks though!
 >>>>
 >>>> I hard coded it just during my original attempts to get it running.
 >>>>
 >>>>
 >>>>
 >>>> It's running now. Just have an error with the XML (or their
server
 >>>> says there's an error).
 >>>>
 >>>>
 >>>>
 >>>> I was looking in the httpapi_debug.txt file and noticed that the
 >>>> filename line is missing a double quote at the end of the filename.
 >>>> I doubt that is causing my issue...
 >>>>
 >>>>
 >>>> <?xml version="1.0" encoding="UTF-8"?><error>XML Error: Fatal error:
 >>>> Start tag expected, '&lt;' not found at :1.</error>
 >>>>
 >>>>
 >>>> <?xml version="1.0" encoding="UTF-8"?>
 >>>> <service_orders>
 >>>> <service_order>
 >>>> <number>1-610615B</number>
 >>>> <account>2311960</account>
 >>>> <service_type>Delivery</service_type>
 >>>> <customer>
 >>>> <customer_id>2311960</customer_id>
 >>>> <first_name>HENRY</first_name>
 >>>> <last_name>MILLER</last_name>
 >>>> <phone1>301-555-1212</phone1>
 >>>> <phone2>301-555-1213</phone2>
 >>>> <address1>SOME STREET</address1>
 >>>> <city>BOWIE</city>
 >>>> <state>MD</state>
 >>>> <zip>20716</zip>
 >>>> </customer>
 >>>> <items>
 >>>> <item>
 >>>> <sale_sequence>1</sale_sequence>
 >>>> <item_id>1055746</item_id>
 >>>> <serial_number>001999188</serial_number>
 >>>> <description><![CDATA[P992050BD SOFA PAULA DEEN SOLITUDE 09/CW
BRO
 >>>> NCO 31/BOL LENA 22/PIL RE]]></description>
 >>>> <quantity>1</quantity>
 >>>> <location>Warehouse#1</location>
 >>>> <cube>3</cube>
 >>>> <price>1334.95</price>
 >>>> <countable>1</countable>
 >>>> </item>
 >>>> </items>
 >>>> <cube>1</cube>
 >>>> <pieces>1</pieces>
 >>>> <delivery_date>7/09/2014</delivery_date>
 >>>> </service_order>
 >>>> </service_orders>
 >>>>
 >>>>
 >>>>
 >>>> ----- Original Message -----
 >>>>
 >>>>
 >>>> From: "Scott Klement" <rpg400-l@xxxxxxxxxxxxxxxx>
 >>>> To: "RPG programming on the IBM i (AS/400 and iSeries)" <rpg400-
 >>>> l@xxxxxxxxxxxx>
 >>>> Sent: Wednesday, July 10, 2013 2:39:02 PM
 >>>> Subject: Re: http_url_post_xml and REST
 >>>>
 >>>> Jay,
 >>>>
 >>>> I know you've gotten past this point already, but... one tip for
you
 >>>> with regard to the following code:
 >>>>
 >>>>>
 >>>>> if (rc <> 1);
 >>>>>        msg = http_error(err);
 >>>>>        dsply msg;
 >>>>>        if err<>36;
 >>>>>           callp http_crash();
 >>>>>           return;
 >>>>>        endif;
 >>>>>        exsr $getPassword;
 >>>>> endif;
 >>>>
 >>>>
 >>>> There are named constants in HTTPAPI_H for each error number.  
So
 >>>> instead of coding err<>36, you could code err<>HTTP_NDAUTH.  
This is
 >>>> just easier to read...  HTTP_NDAUTH visually looks like 'Need
 >>>> Authentication", whereas it's hard to say what '36' means.  Even
I
 >>>> didn't know what it was without looking it up...
 >>>>
 >>>> It's just a small tip, though... what you have will work okay,
it's
 >> just
 >>>
 >>>> not as nice to read.
 >>>> --
 >>>> This is the RPG programming on the IBM i (AS/400 and iSeries)
 >>>> (RPG400-L) mailing list
 >>>> To post a message email: RPG400-L@xxxxxxxxxxxx
 >>>> To subscribe, unsubscribe, or change list options,
 >>>> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
 >>>> or email: RPG400-L-request@xxxxxxxxxxxx
 >>>> Before posting, please take a moment to review the archives
 >>>> at http://archive.midrange.com/rpg400-l.
 >>>>
 >>>> --
 >>>> This is the RPG programming on the IBM i (AS/400 and iSeries)
 >>>> (RPG400-L) mailing list
 >>>> To post a message email: RPG400-L@xxxxxxxxxxxx
 >>>> To subscribe, unsubscribe, or change list options,
 >>>> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
 >>>> or email: RPG400-L-request@xxxxxxxxxxxx
 >>>> Before posting, please take a moment to review the archives
 >>>> at http://archive.midrange.com/rpg400-l.
 >>>>
 >>>
 >>>
 >>> --
 >>> IMPORTANT NOTICE:
 >>> This email is confidential, may be legally privileged, and is for
the
 >>> intended recipient only. Access, disclosure, copying,
distribution, or
 >>> reliance on any of it by anyone else is prohibited and may be a
criminal
 >>
 >>> offence. Please delete if obtained in error and email
confirmation
 >>> to the sender.
 >>> --
 >>> This is the RPG programming on the IBM i (AS/400 and iSeries)
 >>> (RPG400-L) mailing list
 >>> To post a message email: RPG400-L@xxxxxxxxxxxx
 >>> To subscribe, unsubscribe, or change list options,
 >>> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
 >>> or email: RPG400-L-request@xxxxxxxxxxxx
 >>> Before posting, please take a moment to review the archives
 >>> at http://archive.midrange.com/rpg400-l.
 >>>
 >>> --
 >>> This is the RPG programming on the IBM i (AS/400 and iSeries)
 >>> (RPG400-L) mailing list
 >>> To post a message email: RPG400-L@xxxxxxxxxxxx
 >>> To subscribe, unsubscribe, or change list options,
 >>> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
 >>> or email: RPG400-L-request@xxxxxxxxxxxx
 >>> Before posting, please take a moment to review the archives
 >>> at http://archive.midrange.com/rpg400-l.
 >>>
 >>> --
 >>> This is the RPG programming on the IBM i (AS/400 and iSeries)
 >>> (RPG400-L) mailing list
 >>> To post a message email: RPG400-L@xxxxxxxxxxxx
 >>> To subscribe, unsubscribe, or change list options,
 >>> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
 >>> or email: RPG400-L-request@xxxxxxxxxxxx
 >>> Before posting, please take a moment to review the archives
 >>> at http://archive.midrange.com/rpg400-l.
 >>>
 >>
 >>

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.


#####################################################################################

This correspondence is for the named person's use only. It may contain confidential
or legally privileged information, or both. No confidentiality or privilege is waived
or lost by any mistransmission. If you receive this correspondence in error, please
immediately delete it from your system and notify the sender. You must not disclose,
copy or rely on any part of this correspondence if you are not the intended recipient.
Any views expressed in this message are those of the individual sender, except where
the sender expressly, and with authority, states them to be the views of Veda.
If you need assistance, please contact Veda on either :-
Australia 1300-762-207 or New Zealand +64 9 367 6200

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.