I am unsure of what you are trying to do here. It appears you have both
request and response type headers (i.e. POST and filename). Though it may
be that I just haven't ever tried to use that combination of headers or
approach.
I am guessing you are trying to do an HTTP POST with an XML file to a remote
web service? You should end up sending something like below:
POST /folder/calcprc HTTP/1.0
Accept: text/xml
User-Agent: xml4rpg
Host: 192.168.123.123
Content-type: text/xml
Content-length: 79
<calcPriceRequest><item id="HDR4423" /><customer id="123"
/></calcPriceRequest>
<vendor>
BTW, if you are looking to get around the details of doing an HTTP post you
can use RPG-XML Suite (www.rpg-xml.com) which wrap a lot of the complexities
into simple API calls.
</vendor>
HTH,
Aaron Bartell (lead developer of RPG-XML Suite)
http://mowyourlawn.com
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of balasubramanian.p.sundaram@xxxxxxxxxxxxx
Sent: Monday, January 28, 2008 8:52 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: XML request
All,
Can you please look at the piece of code...
Client Request:
C eval request = 'POST '+ %trim(file) +
C ' HTTP/1.1' + x'0D25'
C exsr sendDta
C eval request = 'Host: ' + %trim(host) +
C x'0D25'
C exsr sendDta
C eval request='Content-Type: multipart/form-dat
C 'boundary=' +
C 'AaB03x' +
C x'0D25'
C exsr sendDta
C eval request = 'Content-Length: 59' + x'0D25'
C exsr sendDta
C eval request ='--AaB03x' + x'0D25'
C exsr sendDta
C eval request = 'Content-Disposition: '+
C 'form-data; name='+'"version"'+
C x'0D25'
C exsr sendDta
C eval request ='--AaB03x' + x'0D25'
C exsr sendDta
C eval request = 'Content-Disposition:'+
C ' form-data; name='+
C ' "forx"' + x'0D25'
C exsr sendDta
C eval request = 'Content-Type: text/xml;' +
C ' charset= utf-8, boundary = BbC04y' +
C x'0D25'
C exsr sendDta
C eval request ='--BbC04y' + x'0D25'
C exsr sendDta
C eval request = 'Content-Disposition:'+
C ' attachment; filename = ' +
C '"/bala/test.xml"' +
C x'0D25'+ x'0D25'
C exsr sendDta
C exsr sendFile (Reading IFS file and send thro
socket)
C eval request = x'0D25'
C exsr sendDta
In sendDta is converting ascii to ebcdic format and write thro socket.
Response from the server
HTTP/1.1 400 Bad Request
Date: Mon, 28 Jan 2008 14:16:28 GMT
Server: Apache
Content-Length: 302
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>400 Bad Request</TITLE>
</HEAD><BODY>
<H1>Bad Request</H1>
<P>Your browser sent a request that this server could not understand. <BR
/>
Request header field is missing ':' separator.<br/>
<pre>
--AaB03x</pre>
</P>
</body></html>
XML File
<?xml version="1.0" encoding="utf-8"?><ReqMsg>Z</ReqMsg>
What could be the problem? I'm trying for the past two days... Help
Plz....
Regards
Balasubramanian PS
----------------------------------------------------------------------------
---------------------------------------
Dream!!! is not what you see in sleep.... is the thing which does not let
you sleep
As an Amazon Associate we earn from qualifying purchases.