[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,

base64_decode has no limit, aside from the 16mb limit of single-level store. How did you come to the conclusion that your variable was too big for it?

QDCXLATE is a bad choice. This API has a severe limit on its size (I think it was 32k?) and doesn't support mixed encodings like UTF-8. Consider using the iconv() API, or calling one of HTTPAPI's translation functions.

-SK


On 6/9/2017 8:18 AM, Ron Koontz wrote:
All,
Thank you for showing me the way. This was a great learning experience.
Of course I have one more issue.  The field I'm getting back is huge.  So when I convert it with the base64_decode I get an error b/c (*from what I can tell ) it is too big.  Is there a limit on how big a field can be passing it to the base64_decode?  Then the same question for using QDXLATE to convert it to EBCIDIC.  Is there a field length I cannot go over?

Thanks
Ron Koontz

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

The "garbage" you get seems to be XML but encoded to utf-8. That is why you cannot read it. It is not EBCDIC. I suggest to follow these steps:

a) Decode the Base64 data with base64_decode().
b) Convert the data from utf-8 to the CCSID of your current job using iconv().
c) Use whatever XML parser to parse the XML.

Thomas.


-----Ursprüngliche Nachricht-----
Von: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] Im Auftrag von Ron Koontz
Gesendet: Donnerstag, 8. Juni 2017 22:05
An: FTPAPI/HTTPAPI mailing list
Betreff: Re: [Ftpapi] Simple Soap Action . Used Example18 for a template (HTTP/1.1 500 Internal Server Error )

When I run the base64_decode. I get weird stuff converted.  With that said its not even readable.  I can copy and paste the result of the request inside a free online converter and it works and shows the data just fine.
So what I did was just truncated 200 characters out of the "transactions"  I did this b/c the base64 program blows up if I give it the entire string.
        msg2 = %subst(msg1:1:200);
          base64_decode( %addr(msg2)
           : %len(%trimr(msg2))
           : %addr(Output)
           : %size(Output) );


Msg2 shows this:
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48dHJhbkJs
b2NrPjx0cmFuIElEPSIxIiBjb21wYW55SUQ9IkNPTlRFWFAiIGF1eElEPSIx'
ODkzOTI1MjUxIj48VC41LjAxLjA+PGV2ZW50VFM+MjAxNy0wNS0zMFQyMzoz
NTo1Mlo8L2V2ZW50VFM+

After it runs through bas65_decode
It looks like this:
%ÎÁÊËÑ?>Á>Ä?ÀÑ>ÅíèãÈÊ/>â%?Ä,ÈÊ/>ñàÄ?
_ø/>`ñàä|+èáì&/ÍÌñàèÁÎÁ>Èèë
è!ÁÎÁ>Èèë

It should show this:
<?xml version="1.0" encoding="UTF-8"?><tranBlock><tran ID="1" companyID="CONTEXP" auxID="1893925251"><T.5.01.0><eventTS>2017-05-30T23:35:52Z</eventTS>


If I leave the entire string go through the base64_decode I get this error that is attached to the email.

So I have tried a bunch of things with lots of examples tried. Not sure where to go with it.





Thanks
Ron Koontz


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

People have posted examples, here, and a link to an article... Bryan
posted the code for the article...   is there still more that you need?


On 6/8/2017 2:23 PM, Ron Koontz wrote:
Wow, yes that worked. Argg...  sometimes it’s the simple things.

Now to get it to convert so I can see the actual data. The data is in base64 and when its converted it will look like XML code.

So is there a quick trick to do that?


Thanks
Ron Koontz


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott
Klement
Sent: Thursday, June 08, 2017 3: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 )

Hi Ron,

You are getting an XML error code 300, as it says in the message. You can look up the error codes here:
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzasc/xmlpars
erc.htm

Looks like it means that the XML document was incomplete.  Maybe the string variable that you're receiving the response into isn't large enough for the whole XML document?  Just a guess.

-SK

On 6/8/2017 12:50 PM, Ron Koontz wrote:
           Ok I'm feeling real challenged here and stupid...  I did
this exact program Scott wrote and it works all till it does the
xml-into dequeue2return %xml(Output_SOAP : options); Then I get this error in the joblog.  I have NO idea what this means. I run it in debug and I can see the data I'm getting out from the request.
Any explanations would be awesome.

Also do I need to convert the data from ascii to Ebcidic before converting the data from base64?  Or does this code do that already?
I'm so confused.


                            Additional Message Information

    Message ID . . . . . . :   RNX0351       Severity . . . . . . . :   50
    Message type . . . . . :   Escape
    Date sent  . . . . . . :   06/08/17      Time sent  . . . . . . :   13:39:06

    Message . . . . :   The XML parser detected error code 300.
    Cause . . . . . :   While parsing an XML document for an RPG procedure, the
      parser detected an error at offset 99999 with reason code 300. The actual
      document is *N; *N indicates that the XML document was not an external file.
    Recovery  . . . :   Contact the person responsible for program maintenance to
      determine the cause of the problem.


Thanks
Ron


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

Hello again,

As promised, here is the same program converted to free format, using the newer http_req() API (requires a current version of HTTPAPI) and using RPG's XML-INTO.  Notice that doing it this way, I don't need to use any pointers... which cleans things up a bit, imho.

The basic idea is the same, though.

-SK

On 6/2/2017 5:16 PM, Scott Klement wrote:
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/394970290
5
8
2
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.
________________________________

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.
--
_______________________________________________
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.
--
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.
--
_______________________________________________
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.

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