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



        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/39497029058
>>>> 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.
**free
ctl-opt DFTACTGRP(*NO) BNDDIR('HTTPAPI');

/copy httpapi_h

dcl-c USERID    'xxxxxxx';
dcl-c PASSWORD  'xxxxxxx';
dcl-c NONCE     'nvLVj+qPJSJ2+eWuSvjtlg==';

dcl-ds Dequeue2Return qualified inz;
  count int(10);
  transactions varchar(65000);
  transactionIdOut varchar(20);
end-ds;

dcl-ds Fault qualified inz;
   faultCode varchar(50);
   faultString varchar(50);
end-ds;

dcl-s EndPoint varchar(1000);
dcl-s Input_SOAP varchar(32767: 4);
dcl-s Output_SOAP varchar(100000: 4);
dcl-s rc int(10);
dcl-s msg char(52);
dcl-s path varchar(300);
dcl-s options varchar(500);

http_debug(*ON);

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

http_setOption('network-ccsid': '1208');

// This URL identifies the End Point:

EndPoint = 'https://services.omnitracs.com/otsWebWS/services/OTSWebSvcs';

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

Input_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>';

// http_req() can do any HTTP operation.
//
//   POST = HTTP post method (almost always the one used for SOAP)
//   EndPoint = URL of the endpoint (above)
//   Output_SOAP = XML response from server
//   Input_SOAP = Input XML document (above)
//
//   The *OMIT-ed parameters would be used instead of the
//   Input_SOAP or Output_SOAP if we wanted the XML to come
//   from and go-to an IFS file.
//
http_setOption('soap-action': '""');

rc = http_req( 'POST'
             : EndPoint
             : *omit
             : Output_SOAP
             : *omit
             : Input_SOAP
             : 'text/xml' );

select;
when rc = 1;
   options = 'doc=string case=any ns=remove path='
           + 'Envelope/Body/dequeue2Response/dequeue2Return';
   xml-into dequeue2return %xml(Output_SOAP : options);
   msg = 'count = ' + %char(dequeue2return.count);
   dsply msg;
   msg = 'transactions = ' + dequeue2return.transactions;
   dsply msg;
   msg = 'transactionIdOut = ' +  dequeue2return.transactionIdOut;
   dsply msg;
when rc = 500;
   options = 'doc=string case=any ns=remove path='
           + 'Envelope/Body/Fault';
   xml-into Fault %xml(Output_SOAP : options);
   msg = fault.faultCode + ' ' + fault.faultString;
   dsply msg;
other;
   msg = http_error();
   dsply msg;
endsl;

*inlr = *on; 
-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi