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

Re: [Ftpapi] Simple Soap Action . Used Example18 for a template (HTTP/1.1 500 Internal Server Error )



Ron,

I tried piecing together the various pieces of information that you sent. In one case, you sent the whole program, but the XML wasn't right (it stopped after the Nonce). In one case you had the security info where the soap action should've been (as previously discussed). In one place you created the document in what might've been right, but didn't have the rest of the program... and when I looked at the document, I found missing parts of the XML, missing spaces, etc.

I ended up giving up on piecing together your code, but instead guessed at where the WSDL for this service would be... and I guessed right, so I was able to run this example in SoapUI. Once I did that, I copied and pasted it into my own program and tried it out (using the userid/password that you sent me off-list) and it worked perfectly for me.

Also, none of your examples had the SoapAction right. The SoapAction (according to SoapUI) was just two double quotes -- an empty string in double quotes, that is. I think because this didn't work, you got confused and tried all sorts of irrelevant things. And since the service doesn't report a meaningful error, it was hard to tell what the problem was.

ANYWAY (this turned out more long-winded than I thought)...

I've attached the program that worked for me. Let me know if this works for you.

Later tonight if I have time, I'll re-do it using the newer capabilities in the newer HTTPAPI, and using IBM's built-in XML parser so you can see the difference.

-SK


On 6/2/2017 2:27 PM, Ron Koontz wrote:
The CRLF was it but now back to the same
"HTTP/1.1 500 Internal Server Error"


Thanks
Ron Koontz


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Friday, June 02, 2017 2:58 PM
To: FTPAPI/HTTPAPI mailing list
Subject: Re: [Ftpapi] Simple Soap Action . Used Example18 for a template (HTTP/1.1 500 Internal Server Error )

Ron,

HTTPAPI supports up to 16 kb for the soap action parameter.  Are you saying that your soap action is larger than 16 kb?!

Or are you using an extremely old version of HTTPAPI?  (The size was increased from 64 bytes to 16 kb in 2012.)

The callback method (your "add_soapaction" thing) will still work, too.
But, it's easier to make a mistake with that...  I suspect that's what happened in your case.  Maybe you didn't send the CRLF at the end of the header or something like that?

Its very hard for us to tell you what is wrong when you don't show us what you did.

-SK




On 6/2/2017 9:48 AM, Ron Koontz wrote:
So after looking into this in debug I noticed my SOAP field is not big
enough.. So I looked at Example 20 to send a “bigger” set of soap action.

It uses the “Add_SoapAction” to add the header stuff then the rest.

Its getting close, however I’m getting a “SetError() #43:
CommSSL_Read:  time-out!    “

So I’m not sure where to go from here.  Any ideas?

Thanks

Ron Koontz

*From:*ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] *On Behalf Of *Pargat
Singh
*Sent:* Thursday, June 01, 2017 3:28 PM
*To:* FTPAPI/HTTPAPI mailing list
*Subject:* Re: [Ftpapi] Simple Soap Action . Used Example18 for a
template (HTTP/1.1 500 Internal Server Error )

Just checking, are you able to connect to this URL from your IBMi or
you need to use proxy?

Thanks,

Pargat

On Thu, Jun 1, 2017 at 2:21 PM, Ron Koontz <rkoontz@xxxxxxxxx
<mailto:rkoontz@xxxxxxxxx>> wrote:

You are right.  My bad.  I actually sent the wrong stuff.  The xxxx is
my username and password.
I just got the SOAPUI today so I'm playing with that as well.

Here is the code and attached is the debug

SOAP =
  '<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>'
+'<SOAP:Envelope'
+'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";'
+'xmlns:web="http://websvcs.otswebws";>'
+'<SOAP:Header>'
+'<wsse:Security soapenv:mustUnderstand="1"'
+'<xmlns:wsse="http://docs.oasis-open.org/wss/'
+'2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"'
+'xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/'
+'oasis-200401-wss-wssecurity-utility-1.0.xsd">'
+'<wsse:UsernameToken wsu:Id="UsernameToken'
+'-01B51377495EE27AFE14613627051441">'
+'<wsse:Username>xxxxxx</wsse:Username>'
+'<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/'
+'/oasis-200401-wss-username-token-profile-1.0#Password'
+'Text">xxxxxxx</wsse:Password>'
+'wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01'
+'/oasis-200401-wss-soap-message-security'
+'-1.0#Base64Binary">nvLVj+qPJSJ2+eWuSvjtlg==</wsse:Nonce>'

http_debug(*ON);

rc = http_url_post_xml(
            'https://services.omnitracs.com/otsWebWS/services/OTSWebSvcs'
                   : %addr(SOAP) + 2
                   : %len(SOAP)
                   : *NULL
                   : %paddr(Incoming)
                   : %addr(rate)
                   : HTTP_TIMEOUT
                   : HTTP_USERAGENT
                   : '/tmp/geoptest.xml'
:'https://services.omnitracs.com/otsWebWS/services/OTSWebSvcs'
<https://services.omnitracs.com/otsWebWS/services/OTSWebSvcs%27>);

Thanks
Ron Koontz


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
<mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx>
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
<mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx>] On Behalf Of Scott
Klement
Sent: Thursday, June 01, 2017 2:10 PM
To: FTPAPI/HTTPAPI mailing list

Subject: Re: [Ftpapi] Simple Soap Action . Used Example18 for a
template (HTTP/1.1 500 Internal Server Error )

Are you sure this is the correct SOAP message for this web service? It
refers to WebserviceX.NET, which is highly suspicious...

You should be running the WSDL file through a tool to see what the
SOAP message should look like.  Do NOT just copy another unrelated web
service's SOAP message and assume it's correct.

A good tool for this is SoapUI.


On 6/1/2017 12:37 PM, Ron Koontz wrote:
Here is my debug dump.

Thanks

Ron Koontz

*From:*ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
<mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx>
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
<mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx>] *On Behalf Of *Pargat
Singh
*Sent:* Thursday, June 01, 2017 1:15 PM
*To:* FTPAPI/HTTPAPI mailing list
*Subject:* Re: [Ftpapi] Simple Soap Action . Used Example18 for a
template (HTTP/1.1 500 Internal Server Error )

Ron,

Can you advise how are you invoking WS request?

Thanks

Pargat

On Jun 1, 2017 12:09 PM, "Ron Koontz" <rkoontz@xxxxxxxxx
<mailto:rkoontz@xxxxxxxxx>
<mailto:rkoontz@xxxxxxxxx <mailto:rkoontz@xxxxxxxxx>>> wrote:

Hello all,

I’m getting a HTTP/1.1 500 Internal Server Error …

I not sure 100% what is wrong.  I’m new to sending the SOAP stuff
this way.  Ideas?

Protocol Used: TLS Version 1

http_persist_post(): entered

http_long_ParseURL(): entered

do_post(): entered

POST /qtracsWebWS/services/QTWebSvcs HTTP/1.1

POST /qtracsWebWS/services/QTWebSvcs HTTP/1.1

Host: www.cnrportal.com <http://www.cnrportal.com>
<http://www.cnrportal.com>
User-Agent: http-api/1.23

Content-Type: /tmp/geoptest.xml

SOAPAction: https://www.cnrportal.com/qtracsWebWS/services/QTWebSvcs

Expect: 100-continue

Content-Length: 604

recvresp(): entered

HTTP/1.1 100 Continue

SetError() #13: HTTP/1.1 100 Continu

senddoc(): entered

<?xml version="1.0" encoding="iso-88………….much other stuff here

recvresp(): entered

HTTP/1.1 500 Internal Server Error

Date: Thu, 01 Jun 2017 15:37:14 GMT

Date: Thu, 01 Jun 2017 15:37:14 GMT

X-Powered-By: Servlet/3.0

Content-Length: 399

Cneonction: close

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

Content-Language: en-US

SetError() #13: HTTP/1.1 500 Internal

recvdoc parms: identity 399

header_load_cookies() entered

recvdoc(): entered

SetError() #0:

<soapenv:Envelope xmlns:soapenv="http…other stuff

SetError() #13: HTTP/1.1 500 Internal

http_close(): entered

http_persist_open(): entered

http_long_ParseURL(): entered




*Ron Koontz | IT Manager | Continental Express, Inc*

*10450 State Rt 47 W Sidney, Ohio 45365*

(: Direct: (937) 419.8118 <tel:%28937%29%20419-8118>*| *(: Tel (800)
497.2100 x118 <tel:%28800%29%20497-2100>*|*Ê: Fax (937) 498.2155
<tel:%28937%29%20498-2155>**

*:_rkoontz@xxxxxxxxx <mailto:rkoontz@xxxxxxxxx>
<mailto:rkoontz@xxxxxxxxx <mailto:rkoontz@xxxxxxxxx>>_ Visit us on the
web:
www.ceioh.com <http://www.ceioh.com> <http://www.ceioh.com/> FB
<https://www.facebook.com/pages/Continental-Express-Inc/394970290582
85
5>Twitter
<https://twitter.com/CEIOHIO>

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


The information contained in this e-mail is intended only for the
individual or entity to whom it is addressed. Its contents
(including any attachments) may contain confidential and/or
privileged information. If you are not an intended recipient you
shall not use, disclose, disseminate, copy or print its contents. If
you receive this e-mail in error, please notify the sender by reply
e-mail and delete and destroy the message. Continental Express, Inc.
and its subsidiaries and affiliates will not be held liable for the
unintended or unauthorized use of any information contained in this
email or as a result of any additions or deletions of information
originally contained in this email.


--
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx <mailto:Ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
<mailto:Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
<mailto:Ftpapi@xxxxxxxxxxxxxxxxxxxxxx>>
http://scottklement.com/mailman/listinfo/ftpapi


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

The information contained in this e-mail is intended only for the
individual or entity to whom it is addressed. Its contents
(including any attachments) may contain confidential and/or
privileged information. If you are not an intended recipient you
shall not use, disclose, disseminate, copy or print its contents. If
you receive this e-mail in error, please notify the sender by reply
e-mail and delete and destroy the message. Continental Express, Inc.
and its subsidiaries and affiliates will not be held liable for the
unintended or unauthorized use of any information contained in this
email or as a result of any additions or deletions of information
originally contained in this email.


--
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx <mailto:Ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
http://scottklement.com/mailman/listinfo/ftpapi

________________________________


The information contained in this e-mail is intended only for the
individual or entity to whom it is addressed. Its contents (including
any attachments) may contain confidential and/or privileged
information. If you are not an intended recipient you shall not use,
disclose, disseminate, copy or print its contents. If you receive this
e-mail in error, please notify the sender by reply e-mail and delete
and destroy the message. Continental Express, Inc. and its
subsidiaries and affiliates will not be held liable for the unintended
or unauthorized use of any information contained in this email or as a
result of any additions or deletions of information originally
contained in this email.


--
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx <mailto:Ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
http://scottklement.com/mailman/listinfo/ftpapi


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

The information contained in this e-mail is intended only for the
individual or entity to whom it is addressed. Its contents (including
any attachments) may contain confidential and/or privileged
information. If you are not an intended recipient you shall not use,
disclose, disseminate, copy or print its contents. If you receive this
e-mail in error, please notify the sender by reply e-mail and delete
and destroy the message. Continental Express, Inc. and its
subsidiaries and affiliates will not be held liable for the unintended
or unauthorized use of any information contained in this email or as a
result of any additions or deletions of information originally
contained in this email.


--
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi

________________________________

The information contained in this e-mail is intended only for the individual or entity to whom it is addressed. Its contents (including any attachments) may contain confidential and/or privileged information. If you are not an intended recipient you shall not use, disclose, disseminate, copy or print its contents. If you receive this e-mail in error, please notify the sender by reply e-mail and delete and destroy the message. Continental Express, Inc. and its subsidiaries and affiliates will not be held liable for the unintended or unauthorized use of any information contained in this email or as a result of any additions or deletions of information originally contained in this email.

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

      /copy httpapi_h

     D Incoming        PR
     D   res                               likeds(result)
     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 result          ds                  qualified inz
     D   count                       10i 0
     D   trans                    65000a   varying
     D   transIdOut                  20a   varying
     D   faultCode                   50a   varying
     D   faultString                 50a   varying

     D SOAP            s          32767A   varying
     D rc              s             10I 0
     D msg             s             52a

     D USERID          c                   'xxxxx'
     D PASSWORD        c                   'xxxxx'
     D NONCE           c                   'nvLVj+qPJSJ2+eWuSvjtlg=='

      /free

       http_debug(*ON);

       // this tells HTTPAPI to use UTF-8 (CCSID 1208 = UTF-8)

       http_setCCSIDs(1208: 0);

       // Here's the SOAP message.  We got this by running the
       // WSDL through the SoapUI program:

       SOAP=
       '<?xml version="1.0" encoding="UTF-8"?>+
        <soapenv:Envelope +
           xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; +
           xmlns:web="http://websvcs.otswebws";> +
          <soapenv:Header> +
            <wsse:Security +
              soapenv:mustUnderstand="1" +
              xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401+
                -wss-wssecurity-secext-1.0.xsd" +
              xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401+
                -wss-wssecurity-utility-1.0.xsd">+
              <wsse:UsernameToken +
                wsu:Id="UsernameToken-01B51377495EE27AFE14613627051441">+
                <wsse:Username>'+
                  USERID +
               '</wsse:Username>+
                <wsse:Password +
                   Type="http://docs.oasis-open.org/wss/2004/01/+
                   oasis-200401-wss-username-token-profile-1.0#PasswordText">'+
                   PASSWORD +
                '</wsse:Password>+
                <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss+
                  /2004/01/oasis-200401-wss-soap-message-security-1.0+
                  #Base64Binary">' +
                  NONCE +
               '</wsse:Nonce>+
                <wsu:Created>2016-04-22T22:05:05.142Z</wsu:Created>+
              </wsse:UsernameToken>+
            </wsse:Security>+
          </soapenv:Header>+
          <soapenv:Body>+
            <web:dequeue2>+
              <subscriberId>1</subscriberId>+
              <transactionIdIn>0</transactionIdIn>+
            </web:dequeue2>+
          </soapenv:Body>+
        </soapenv:Envelope>';

       // The results will be loaded into this
       // "result" data structure.  So clear it to start with.

       reset result;


       // Send the XML, get back the response, and parse it:
       //
       //  NOTE:
       //     rc < 0 means there was an error on our side
       //     rc = 0 means "time out"
       //     rc = 1 means "success"
       //     rc > 1 means the server found an error
       //
       //  The most common server-side error will be "500".
       //  When that happens, we should check for a
       //  "Fault" XML tag
       //

       rc = http_url_post_xml(
       'https://services.omnitracs.com/otsWebWS/services/OTSWebSvcs'
                         : %addr(SOAP) + 2
                         : %len(SOAP)
                         : *NULL
                         : %paddr(Incoming)
                         : %addr(result)
                         : HTTP_TIMEOUT
                         : HTTP_USERAGENT
                         : 'text/xml'
                         : '""');

       // NOTE: DSPLY is used to print the results below
       //       because it is "quick and dirty".
       //       However in a "real" application you should not use it
       //       but instead use a log file or display the message on
       //       the screen, or whatever.
       //
       // ALSO: DSPLY limits us to 52 characters... when you use a better
       //       way of showing the error, please use a bigger field :-)

       select;
       when rc < 0;
          msg = http_error();
       when rc = 0;
          msg = 'Time out!';
       when rc > 1;
          msg = result.faultCode
              + ' '
              + result.faultString;
       other;
          msg = 'count = ' + %char(result.count);
          dsply msg;
          msg = 'transactions = ' + result.trans;
          dsply msg;
          msg = 'transactionIdOut = ' +  result.transIdOut;
       endsl;

       dsply msg;

       *inlr = *on;
      /end-free

      // Incoming(): is called by the XML parser IN A LOOP (!!)
      //             it is called once for each XML tag found
      //             so we check the tag name and if it's
      //             something we're interested in, save it to
      //             a variable.

     P Incoming        B
     D                 PI
     D   res                               likeds(result)
     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)

      /free

       select;
       when name = 'count';
         monitor;
            res.count = %int(value);
         on-error;
            res.count = 0;
         endmon;
       when name = 'transactions';
         res.trans = value;
       when name = 'transactionIdOut';
         res.transIdOut = value;
       when name = 'faultcode';
          res.faultcode = value;
       when name = 'faultstring';
          res.faultstring = value;
       endsl;

      /end-free
     P                 E 
-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi