[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FW: Help with: http_url_post_stmf



   Hi,
   First of all thanks Scott for this project.

   I am new one to Web Services and you and entire HTTPAPI community is a
   great help for me.
   I installed HTTP v 1.23 and tried example 18, works great (exchange
   rate).
   Using the same web service, I modified (example18) it to use
   http_url_post_stmf (from IFS to IFS).
   It looks like I have a problem with the correct encoding for file to
   be sent.

   I tried several combinations with CCSID for file and data in the file,
   the same error response from WS.


   Please help,


   Thank you.

   ----------------------------------------------------------------------
   -------------------------------
   Source code:
   0001.00 H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('HTTPAPI')
   BNDDIR('QC2LE')
   0002.00 H
   DEBUG(*YES)


   0015.00

   0016.00 D/copy
   qrpglesrc,httpapi_h
   0017.00 D/copy
   qrpglesrc,ifsio_h
   0018.00 D/copy
   qrpglesrc,errno_h


   0051.00 D rc                 s             10I 0
   0052.00 D msg              s             52A
   0053.00 D p_data         S               *
   0054.00 D mystat          S                   like(statds)
   0055.00
   0055.01 D fileout          S            256A
   0055.02 D filein            S            256A
   0055.03 D urlname       S            256A
   0056.00
   0056.01 D content        S             64A
   0056.02 D uagent          S             64A
   0056.03 D soapAction   S             64A

   0056.04 D timeout         S             10I 0

   0057.00

   0058.00 c                   eval      *inlr =
   *on
   0059.00
   /free

   0059.01
   http_debug(*ON);
   0059.02
   /end-free

   0060.00  ** whatever data is in this stream file
   will
   0061.00  ** be POSTed to the URL
   below.
   0062.00 c                   eval      urlname =
   'http://www.webservicex.net/+
   0062.01 c
   CurrencyConvertor.asmx'
   0062.03 c                   eval      fileout =
   '/xml/Out/XMLout204'
   0062.04 c                   eval      filein  =
   '/xml/in/XMLin204'

   0062.05 c                   eval      timeout =
   100
   0062.06 c                   eval      uagent  =
   'HTTP_USERAGENT'
   0062.07 c                   eval      content =
   'text/xml'
   0062.09 c                   eval      soapAction =
   'http://www.webserviceX.NET/+
   0062.10 c
   ConversionRate'
   0067.00

   0068.00 c                   eval      rc =
   http_url_post_stmf(%trim(urlname)
   0069.00 c
   :%trim(fileout)
   0070.00 c
   :%trim(filein)
   0071.00 c
   :timeout
   0071.01 c
   :%trim(uagent)
   0071.02 c
   :%trim(content)

   0071.03 c
   :%trim(soapAction))
   0071.04
   c
   0072.00 c                   if        rc <>
   1
   0073.00 c                   eval      msg =
   http_error
   0074.00 c                   dsply
   msg
   0075.00 c
   return
   0076.00 c
   endif
   0077.00

   0078.00  ** This should be the XML data that UPS returns to
   us:
   0079.00 c                   callp     cmd('DSPF ''/xml/in/XMLin204''':
   200)
   0080.00 c
   return
   0081.00
   0082.00
   0153.00
   0154.00  /define ERRNO_LOAD_PROCEDURE
   0155.00  /copy qrpglesrc,errno_h
   ----------------------------------------------------------------------

   File to be sent:

   Browse : /xml/Out/XMLout204
   Record :       1   of      11 by  18                      C
   Control :

   ...+....1....+....2....+....3....+....4....+....5....+....6
   ************Beginning of data**************
   <?xml version="1.0" encoding="iso-8859-1" standalone="NO"?>
   <soap:envelope
       xmlns:soap="[1]http://schemas.xmlsoap.org/soap/envelope/";
       xmlns:tns="[2]http://www.webservicex.net/";>
   <soap:body>
     <tns:conversionrate>
         <tns:fromcurrency>USD</tns:fromcurrency>
         <tns:tocurrency>JPY</tns:tocurrency>
     </tns:conversionrate>
   </soap:body>
   </soap:envelope>
   ************End of Data********************


   F3=Exit   F10=Display Hex   F12=Cancel   F15=Services   F16
   File CCSID incorrect. <--------- see here


    Message . . . . :   File CCSID
   incorrect.
   Cause . . . . . :   The file CCSID was 01208, but the data in the file
   looks like EBCDIC. A CCSID of 00500 is being
   used.
   Recovery  . . . :   If another CCSID is needed, use F15 to change to
   the desired
   CCSID.

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

   Data received to file from web service:

    Browse :
   /xml/In/xmlin204

    Record :       1   of      18 by  18                      Column :
   1    193 by 131
    Control
   :



   ....+....1....+....2....+....3....+....4....+....5....+....6....+....7
   ....+....8....+....9....+....
    ************Beginning of
   data**************

   <?xml version="1.0"
   encoding="utf-8"?>

   <soap:Envelope
   xmlns:soap="[3]http://schemas.xmlsoap.org/soap/envelope/";
   xmlns:xsi="[4]http://www.w3.org/

   <soap:Body>


   <soap:Fault>


   <faultcode>soap:Server</faultcode>

         <faultstring>System.Web.Services.Protocols.SoapException: Server
   was unable to process request.

                            ---&gt; System.Xml.XmlException: The data at
   the root level is invalid. Line 1, position 1.
      at
   System.Xml.XmlTextReader.ParseRoot()

      at
   System.Xml.XmlTextReader.Read()

      at
   System.Xml.XmlReader.MoveToContent()

      at
   System.Web.Services.Protocols.SoapServerProtocolHelper.GetHelper(SoapS
   erverProtocol protocol)
      at
   System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()

      at
   System.Web.Services.Protocols.WebServiceHandler.Invoke()

      at
   System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

      --- End of inner exception stack trace
   ---</faultstring>
         <detail
   />


   </soap:Fault>


   </soap:Body>

   </soap:Envelope>

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

   HTTPAPI log file:

    Browse :
   /tmp/httpapi_debug.txt
    Record :       1   of      80 by  18                      Column :
   1
    Control
   :


   ....+....1....+....2....+....3....+....4....+....5....+....6....+....7
   ...
    ************Beginning of
   data**************
   HTTPAPI Ver 1.23 released
   2008-04-24
   OS/400 Ver
   V5R4M0


   New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819.
   ProtLoc=0
   http_url_post_stmf():
   entered
   getting post file
   size...
   opening file to be
   sent...
   opening file to be
   received
   http_persist_open():
   entered
   http_long_ParseURL():
   entered
   DNS resolver retrans:
   2
   DNS resolver retry  :
   2
   DNS resolver options:
   x'00000136'
   DNS default domain:
   SAMUEL.COM
   WARNING: No name servers are configured for DNS resolution!
   http_persist_post():
   entered
   http_long_ParseURL():
   entered
   do_post(): entered

   do_post():
   entered
   POST /CurrencyConvertor.asmx
   HTTP/1.1
   Host:
   [5]www.webservicex.net
   User-Agent:
   HTTP_USERAGENT
   Content-Type:
   text/xml
   SOAPAction:
   [6]http://www.webserviceX.NET/ConversionRate
   Expect:
   100-continue
   Content-Length:
   2837




   recvresp():
   entered
   HTTP/1.1 100
   Continue




   SetError() #13: HTTP/1.1 100
   Continue
   sendraw():
   entered
   @Lo§  @¥  ¢   ~ ñKð @        ~  ¢ `øøõù`ñ @¢£        ~ ÕÖ
   on@@@@@@@@@@@@
   L¢   z  ¥
   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   @@@@§   ¢z¢   ~  ££ zaa¢     ¢K§  ¢   K   a¢   a  ¥     a
   @@@@@@@@@@@@@@

   @@@@§   ¢z¢   ~  ££ zaa¢     ¢K§  ¢   K   a¢   a  ¥     a @@@
   @@@@§   ¢z£ ¢~  ££ zaa¦¦¦K¦  ¢  ¥   §K  £a n@@@@@@@@@@@@@@@@@
   L¢   z   ¨n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   @@L£ ¢z   ¥  ¢     £ n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   @@@@@@L£ ¢z     ¤     ¨näâÄLa£ ¢z     ¤     ¨n@@@@@@@@@@@@@@@
   @@@@@@L£ ¢z£  ¤     ¨nÑ×èLa£ ¢z£  ¤     ¨n@@@@@@@@@@@@@@@@@@@
   @@La£ ¢z   ¥  ¢     £ n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   La¢   z   ¨n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   La¢   z  ¥     n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   recvresp(): entered
   HTTP/1.1 500 Internal Server Error.
   Date: Sun, 25 May 2008 00:57:46 GMT
   Server: Microsoft-IIS/6.0
   X-Powered-By: ASP.NET
   X-AspNet-Version: 1.1.4322
   Cache-Control: private
   Content-Type: text/xml; charset=utf-8
   Content-Length: 1052



   SetError() #13: HTTP/1.1 500 Internal Server
   Error.

   recvdoc parms: identity
   1052

   header_load_cookies()
   entered

   recvdoc():
   entered

   SetError()
   #0:

   <?xml version="1.0"
   encoding="utf-8"?>

   <soap:Envelope
   xmlns:soap="[7]http://schemas.xmlsoap.org/soap/envelope/";
   xmlns:xsi="[8]http://www.w3.org/2001/XMLSchema-instance"; xmlns:xs

   <soap:Body>


   <soap:Fault>


   <faultcode>soap:Server</faultcode>

         <faultstring>System.Web.Services.Protocols.SoapException: Server
   was unable to process request.

                            ---&gt; System.Xml.XmlException: The data at
   the root level is invalid. Line 1, position 1.
      at
   System.Xml.XmlTextReader.ParseRoot()

      at
   System.Xml.XmlTextReader.Read()

      at
   System.Xml.XmlReader.MoveToContent()

      at
   System.Web.Services.Protocols.SoapServerProtocolHelper.GetHelper(SoapS
   erverProtocol protocol)
      at
   System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()

      at System.Web.Services.Protocols.WebServiceHandler.Invoke()

       at
   System.Web.Services.Protocols.WebServiceHandler.Invoke()
      at
   System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
      --- End of inner exception stack trace
   ---</faultstring>
         <detail
   />

   </soap:Fault>

   </soap:Body>

   </soap:Envelope>

   SetError() #13: HTTP/1.1 500 Internal Server
   Error.
   http_close():
   entered
    ************End of
   Data********************

References

   1. http://schemas.xmlsoap.org/soap/envelope/
   2. http://www.webservicex.net/
   3. http://schemas.xmlsoap.org/soap/envelope/
   4. http://www.w3.org/
   5. http://www.webservicex.net/
   6. http://www.webserviceX.NET/ConversionRate
   7. http://schemas.xmlsoap.org/soap/envelope/
   8. http://www.w3.org/2001/XMLSchema-instance
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------