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

Re: 500 Server Error



Hi Mauricio,

It does not matter what language a web service is written in. What matters is that you send the data to the web service formatted correctly. As long as it gets the data it expects, it'll return the proper data in response.

I can't tell you where you might've made a mistake in your code, since I'm not familiar with the web service you're calling. Posting the WSDL would help a lot, here, because I could use the WSDL to see what's expected.

You say your data works in SoapUI. Well... what's the difference between what SoapUI is sending and what your program is sending? That should tell you the solution.





On 4/18/2013 11:12 AM, Mauricio Diaz-Lapham wrote:
Hello,

I am getting the 500 internal error. On this web service.
The log from the server that I am trying to consume the service is reporting that it can't convert the  NilClass into String.
It's in RUBY on RAILS class.
This works in SOAPui.

Thanks a bunch.

Here is my program.

d Setup           pr
d WebService pr 10i 0 D Incoming PR
d   @ClientID                 9000a
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 GETCLTID pr ExtPgm('GETCLTID')
d  ClientID                      5A
d GETCLTID pi
d  ClientID                      5A
  *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
c*====================================================================
c* Copybooks
c*====================================================================
/copy config_h
  /copy httpapi_h
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
c* Stand Alone Fields
d ErrMsg          s           1024a   varying
d Soap            s          32767a   varying
d @ClientID       s           9000a
d ReturnCode      s             10i 0
dVariableRecords...
d                 ds                  Qualified
d Number                        10i 0
c*====================================================================
c* Main
c*====================================================================
  /free
Setup();
/end-free
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
**********************************************************************
* Main processing - Call the Webservice to update CMA
**********************************************************************
/Free // Call the web service that will update the client smart file.
      ReturnCode = WebService();
      If ReturnCode <> 1;
         ErrMsg = http_error();
         ReturnCode = -1;
      Else;
         ErrMsg = 'HTTP/1.1 200 OK';
      EndIf;
       *inLr = *on;
       Return;
/end-free
c*====================================================================
c* Setup();
c*
c* General setup.
c*====================================================================
p Setup b
  /free
VariableRecords.Number = 4; // Number of keys. // Turn HTTP debug on or off
   http_debug(*ON);
   // Set the correct CCSID.
   http_setCCSIDs(1208:0);
// Strip off back end CRLFs on the returned XMLs.
   http_XmlStripCRLF(*ON);
/end-free
p Setup           e
c*====================================================================
c* WebService(); Call The Web Service.
c*====================================================================
p WebService b
d WebService      pi            10i 0
  /free
Soap =
'<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>'
+'<soapenv:Envelope'
+'    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";'
+'    xmlns:xsd="http://www.w3.org/2001/XMLSchema";'
+'    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; '
+'    xmlns:urn="urn:ActionWebService">'
+'      <soapenv:Header/>'
+'      <soapenv:Body>'
+'         <urn:get_client '
+'soapenv:encodingStyle='
+'"http://schemas.xmlsoap.org/soap/encoding/";>'
+'  <client_id xsi:type="xsd:int">'+ClientID+'</client_id>'
+'      </urn:get_client>'
+'   </soapenv:Body>'
+'</soapenv:Envelope>';

// Consume the web service.
ReturnCode = http_url_post_xml(
   'http://172.16.255.7:5001/client_smart/api'
   : %addr(SOAP) + 2
   : %len(SOAP)
   : *NULL
   : %paddr(Incoming)
   : %addr(@ClientID)
   : HTTP_TIMEOUT
   : HTTP_USERAGENT
   : 'text/xml'
   : 'http://172.16.255.7:5001/client_smart/api/get_client');
return ReturnCode;
/end-free
p WebService      e
c*====================================================================
c* Incoming1();
c* Parse the XML coming in to see what the client ID we received is.
c*====================================================================
p Incoming B
d Incoming        PI
d   @ClientID                 9000a
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 = 'get_Client');
     @ClientID = value;
   endif;
/end-free
p Incoming        E
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------


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