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

Bad Request when use HTTPS - SOAP



   Hi,


   I have a problem when try to use web service with SOAP. Here is my
   code:


         * Test Datamatic
   reads

         *

        H DFTACTGRP(*NO)
   BNDDIR('HTTPAPI':'QC2LE')



        D EXAMPLE18       PR                  ExtPgm('DTMTC_TST')

        D   Acc_num                     10A
   const

        D   MTR_num                     11A   const

        D   Login                       15A   const

        D   Passw                       15A   const

        D   UtilityID                   15A   const

        D EXAMPLE18
   PI

        D   Acc_num                     10A   const

        D   MTR_num                     11A
   const

        D   Login                       15A   const

        D   Passw                       15A   const

        D   UtilityID                   15A   const



         /copy
   httpapi_h



        D Incoming
   PR

        D   rate                         8F

        D   depth                       10I 0
   value

        D   name                      1024A   varying
   const

        D   path                     24576A   varying
   const

        D   value                    65535A   varying
   const

        D   attrs                         *   dim(32767)

        D                                     const
   options(*varsize)



        D SOAP            s          32767A
   varying

        D rc              s             10I
   0

        D rate            s
   8F

        D Result          s             12P
   2




   /free



          if ( %parms < 3 );

             http_comp( 'Please pass parms. e.g. CALL EXAMPLE18
   '

                      + 'PARM(USD JPY
   12.00)');


   return;


   endif;



          // Note:  http_debug(*ON/*OFF) can be used to turn
   debugging

          //        on and off.  When debugging is turned on,
   diagnostic

          //        info is written to an IFS file
   named

          //
   /tmp/httpapi_debug.txt



          http_debug(*ON);



          // Note:  http_XmlStripCRLF(*ON/*OFF) controls whether or
   not

          //        the XML parser removes CR and LF characters from
   the

          //        Xml data that's passed to your 'Incoming'
   procedure.




   http_XmlStripCRLF(*ON);


          SOAP
   =

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


   +'<SOAP:Envelope'

          +'    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";'

          +'    xmlns:xsd="http://www.w3.org/2001/XMLSchema";'

          +'    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";'

          +'    xmlns:dws="http://www.datamaticmosaic.com/";> '


   +'<SOAP:Body>'

          +'  <dws:GetLatestRead>'

          +'      <dws:Login>'+ %trim(Login) +'</dws:Login>'

          +'      <dws:Password>'+ %trim(Passw) + '</dws:Password>'

          +'      <dws:UtilityID>'+ %trim(UtilityID) + '</dws:UtilityID>'

          +'      <dws:AccountID>'+ %trim(Acc_num) + '</dws:AccountID>'

          +'      <dws:MeterID>'+ %trim(MTR_num) + '</dws:MeterID>'

          +'  </dws:GetLatestRead>'


   +'</SOAP:Body>'


   +'</SOAP:Envelope>';



          http_debug(*ON);


          HTTP_setCCSIDs(1208: 0);  // CCSID 1208 = UTF-8



          rc =
   http_url_post_xml(


   'https://www.datamaticmosaic.com:8143/Mosaic_Data_WS.asmx'

                            : %addr(SOAP) +
   2

                            :
   %len(SOAP)

                            :
   *NULL

                            :
   %paddr(Incoming)

                            : %addr(rate)

                            :
   HTTP_TIMEOUT

                            :
   HTTP_USERAGENT

                            : 'text/xml; charset=utf-8'

                     : 'http://www.datamaticmosaic.com/GetLatestRead');



          if (rc <> 1);


   http_crash();


   else;

          //   Result = %dech(Amount * rate: 12:
   2);

             http_comp(%trim(Acc_num) +

                       ' ' + %trim(MTR_num) + '= OK! ');


   endif;



          *inlr = *on;




   /end-free



        P Incoming
   B

        D Incoming        PI

        D   rate
   8F

        D   depth                       10I 0
   value

        D   name                      1024A   varying
   const

        D   path                     24576A   varying
   const

        D   value                    65535A   varying const

        D   attrs                         *
   dim(32767)

        D                                     const
   options(*varsize)



        D atof            PR             8F
   extproc('atof')

        D   string                        *   value
   options(*string)




   /free

             if (name =
   'ConversionRateResult');

                rate =
   atof(value);


   endif;


   /end-free

        P
   E

   ======================================================================
   =====================


   And here is the httpapi_dump.txt:


   HTTPAPI Ver 1.23 released 2008-04-24

   OS/400 Ver V5R3M0


   New iconv() objects set, PostRem=1208. PostLoc=0. ProtRem=819.
   ProtLoc=0

   http_persist_open(): entered

   http_long_ParseURL(): entered

   DNS resolver retrans: 2

   DNS resolver retry  : 2

   DNS resolver options: x'00000136'

   DNS default domain: PADRE.ORG

   DNS server found: 172.20.10.1

   DNS server found: 172.20.10.2

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

   Dump of server-side certificate information:

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

   Cert Validation Code = 6000

   -----BEGIN CERTIFICATE-----

   MIIFcjCCBNugAwIBAgIERp6FszANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC

   ... I deleted part of certificate info

   3colQcFdICAwojxCI9vBMwUadRJ6V0VoXd5Cxkjcn7AzlXFr3qX2oNMlWG1sM4La

   Y4txwQEx

   -----END CERTIFICATE-----

   Serial Number: 46:9E:85:B3

   Common Name: www.datamaticmosaic.com

   Country: US

   State/Province: TEXAS

   Locality: Plano

   Org Unit: Datamatic, Ltd.

   Org: Business Systems Development

   Issuer CN: Entrust.net Secure Server Certification Authority

   Issuer Country: US

   Issuer Org: Entrust.net

   Issuer Org Unit: (c) 1999 Entrust.net Limited, OU=www.entrust.net/CPS
   incorp. by ref. (limits liab.)

   Version: 03

   not before: 20090306072857

   not after: 20100327075853

   pub key alg: 1.2.840.113549.1.1.5


   Protocol Used: TLS Version 1

   http_persist_post(): entered

   http_long_ParseURL(): entered

   do_post(): entered

   POST /Mosaic_Data_WS.asmx HTTP/1.1

   Host: www.datamaticmosaic.com:8143

   User-Agent: http-api/1.23

   Content-Type: text/xml; charset=utf-8

   SOAPAction: http://www.datamaticmosaic.com/GetLatestRead

   Expect: 100-continue

   Content-Length: 560



   recvresp(): entered

   HTTP/1.1 100 Continue



   SetError() #13: HTTP/1.1 100 Continue

   senddoc(): entered

   <?xml version="1.0" encoding="utf-8"?><SOAP:Envelope
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xmlns:xsd="http://www.w3.org/2001/XMLSchema";
   xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
   xmlns:dws="http://www.datamaticmosaic.com/";> <SOAP:Body>
   <dws:GetLatestRead>      <dws:Login>xxxxx</dws:Login>
   <dws:Password>xxxxxx</dws:Password>
   <dws:UtilityID>99999</dws:UtilityID>
   <dws:AccountID>1234567890</dws:AccountID>
   <dws:MeterID>123456789012</dws:MeterID>
   </dws:GetLatestRead></SOAP:Body></SOAP:Envelope>

   recvresp(): entered

   HTTP/1.1 400 Bad Request

   Date: Wed, 10 Feb 2010 22:45:04 GMT

   Server: Microsoft-IIS/6.0

   X-Powered-By: ASP.NET

   X-AspNet-Version: 2.0.50727

   Cache-Control: private

   Content-Length: 0



   SetError() #13: HTTP/1.1 400 Bad Request

   recvdoc parms: identity 0

   header_load_cookies() entered

   recvdoc(): entered

   SetError() #0:

   SetError() #13: HTTP/1.1 400 Bad Request

   http_close(): entered

   ======================================================================
   =========================


   Any help would be really appreciated.


   Thanks,

   Alex
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------