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

Re: REST WS Problem



   Here's a working example of a USPS address validation, hope it helps.
   �
     url = '[1]http://production.shippingapis.com/ShippingAPI.dll?';
     xml = � � � � � � � � '<AddressValidateRequest ' + � � �     � � � ��     � � � � � � � � � � � 'USERID="xxxxxxxxxx">'; � � � �     � � � � �     xml = xml + � � � � � '<Address ID=' � �+ '"0">'; � � � �     � � � �     xml = xml + � � � � � '<Address1>' �+
     %trim(adrs2)+'</Address1>';
     xml = xml + � � � � � '<Address2>' �+
     %trim(adrs)+'</Address2>';�     xml = xml + � � � � � '<City>' � � �+ %trim(city)+
     '</City>'; � �     xml = xml + � � � � � '<State>' � � + %trim(state)+
     '</State>'; �     xml = xml + � � � � � '<Zip5>' �+ %trim(zip)+'</Zip5>'; � �     � � �     xml = xml + � � � � � '<Zip4' � + ' />'; � � � � � � �     � � � � ��     xml = xml + � � � � � '</Address>' + ''; � � � � � � �     � � � � ��     xml = xml + � � � � � '</AddressValidateRequest>' + ''; � �     � � �     Form = WEBFORM_open(); � � � � � � � � � ��     WEBFORM_setVar(Form : 'API' : 'Verify'); ��     WEBFORM_setVar(Form : 'XML' : xml); � � � �     � � � � � � � � � � � � � � � � � � � � � �     url = url + WEBFORM_getData(Form); � � � ��     � � � � � � � � � � � � � � � � � � � � � �     WEBFORM_Close(Form); � � � � � � � � � � ��
   On Sun, Oct 4, 2015 at 7:58 AM, Donna Herald
   <[2]donna.g.herald@xxxxxxxxx> wrote:

     Scott,
     Once the data is encoded how do you add it to the end of the url
     string?� Is this added like a paramater?
     Donna
     On 10/3/15, Scott Klement <[3]sk@xxxxxxxxxxxxxxxx> wrote:
     > Donna,
     >
     > When data is provided as part of the URL in a GET request, it has
     to be
     > encoded.� Otherwise, you will confuse the HTTP server (as you've
     done
     > here) into thinking your XML document is part of the HTTP
     protocol.
     >
     > Please use the "webform" routines to encode your data before
     adding it
     > to the URL.
     >
     >
     > On 10/3/2015 12:26 PM, Donna Herald wrote:
     >> Scott,
     >>
     >> The java programmer sugested just doing a 'get' passing him the
     xml
     >> and he can send me back error or success.� I am not sure this
     will
     >> work as I belive there is a size limit of a little over 2K that
     can be
     >> sent with a get.� He created a get and I am getting the attached
     >> error with the get.� Currently I just have my xml hard coded
     into the
     >> get.
     >>
     >>
     >>
     >> On 10/2/15, Scott Klement <[4]sk@xxxxxxxxxxxxxxxx> wrote:
     >>> Yep, I agree....
     >>>
     >>> Donna, it's important to understand that the string
     >>> "java.lang.NullPointerException" is not coming from HTTPAPI
     directly.
     >>> It is being sent by the web service as a description of what's
     wrong.,
     >>> and HTTPAPI is simply relaying the message to your program.�     �All it
     >>> tells me is that the Java program on the web service server is
     >>> crashing...� �you'll need to ask the Java programmer to debug
     his code
     >>> and see why that's happening.
     >>>
     >>>
     >>>
     >>>
     >>> On 10/2/2015 2:40 PM, Michael Ryan wrote:
     >>>>� � � Talk to your Java developer and find out why you're
     getting
     >>>>� � � this:� java.lang.NullPointerException
     >>>>� � � Something is either expected and not provided, or
     provided and not
     >>>>� � � expected.
     >>>>
     >>>>� � � On Fri, Oct 2, 2015 at 3:30 PM, Donna Herald
     >>>>� � � <[1][5]donna.g.herald@xxxxxxxxx> wrote:
     >>>>
     >>>>� � � � This is what is in the debug text.
     >>>>� � � � HTTPAPI Ver 1.23 released 2008-04-24
     >>>>� � � � OS/400 Ver V6R1M0
     >>>>� � � � New iconv() objects set, PostRem=819. PostLoc=0.
     ProtRem=819.
     >>>>� � � � ProtLoc=0
     >>>>� � � � http_url_post(): entered
     >>>>� � � � http_persist_open(): entered
     >>>>� � � � http_long_ParseURL(): entered
     >>>>� � � � DNS resolver retrans: 2
     >>>>� � � � DNS resolver retry�� : 2
     >>>>� � � � DNS resolver options: x'00000136'
     >>>>� � � � DNS default domain: [2][6]AD.CHURCHMUTUAL.COM
     >>>>� � � � DNS server found: 10.20.4.2
     >>>>� � � � DNS server found: 10.20.4.3
     >>>>� � � � http_persist_post(): entered
     >>>>� � � � http_long_ParseURL(): entered
     >>>>� � � � do_post(): entered
     >>>>� � � � POST /print-eor-service/rest/print/eor HTTP/1.1
     >>>>� � � � Host: cmdev2:9080
     >>>>� � � � User-Agent: http-api/1.23
     >>>>� � � � Content-Type: text/xml; charset=utf-8
     >>>>� � � � SOAPAction: /print-eor-service/rest/print/eor
     >>>>� � � � Expect: 100-continue
     >>>>� � � � Content-Length: 254
     >>>>� � � � recvresp(): entered
     >>>>� � � � HTTP/1.1 100 Continue
     >>>>� � � � Content-Length: 0
     >>>>� � � � Date: Fri, 02 Oct 2015 19:22:38 GMT
     >>>>� � � � SetError() #13: HTTP/1.1 100 Continue
     >>>>� � � � senddoc(): entered
     >>>>� � � � <?xml version="1.0" encoding="UTF-8"
     >>>>
     >>>>
     standalone="yes"?><printEORRequestType><CMUserName>dherald</CMUserNa
     >>>>
     >>>>
     me><CMPassword>kentucky</CMPassword><EORDocument><ClaimNumber>123456
     >>>>
     >>>>
     7</ClaimNumber><EORNumber>1234567</EORNumber></EORDocument></printEO
     >>>>� � � � RRequestType>
     >>>>� � � � recvresp(): entered
     >>>>� � � � HTTP/1.1 500 Internal Server Error
     >>>>� � � � Date: Fri, 02 Oct 2015 19:22:38 GMT
     >>>>� � � � X-Powered-By: Servlet/3.0
     >>>>� � � � Content-Type: text/html;charset=utf-8
     >>>>� � � � $WSEP:
     >>>>� � � � Content-Language: en-US
     >>>>� � � � Content-Length: 42
     >>>>� � � � Connection: Close
     >>>>� � � � SetError() #13: HTTP/1.1 500 Internal Server Error
     >>>>� � � � recvdoc parms: identity 42
     >>>>� � � � header_load_cookies() entered
     >>>>� � � � recvdoc(): entered
     >>>>� � � � SetError() #0:
     >>>>� � � � Error 500: java.lang.NullPointerException
     >>>>� � � � SetError() #13: HTTP/1.1 500 Internal Server Error
     >>>>� � � � http_close(): entered
     >>>>� � � � � ************End of Data********************
     >>>>� � � � On 10/2/15, Jim Muehe
     <[3][7]jmuehe@xxxxxxxxxxxxxxxx> wrote:
     >>>>� � � � > I agree, the default location for the log is
     >>>>� � � � >�� �� �� �� � /tmp/httpapi_debug.txt
     >>>>� � � � >
     >>>>� � � � > WRKLNK OBJ('/tmp/httpapi_debug.txt')
     >>>>� � � � >
     >>>>� � � � > Jim Muehe
     >>>>� � � � >
     >>>>� � � � >
     >>>>� � � � >
     >>>>� � � � > -----Original Message-----
     >>>>� � � � > From: [4][8]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     >>>>� � � � >
     [mailto:[5][9]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
     >>>>� � � � Charles Wilt
     >>>>� � � � > Sent: Friday, October 02, 2015 1:00 PM
     >>>>� � � � > To: HTTPAPI and FTPAPI Projects
     >>>>� � � � > Subject: Re: REST WS Problem
     >>>>� � � � >
     >>>>� � � � > Should be
     >>>>� � � � > http_debug(*ON);
     >>>>� � � � >
     >>>>� � � � > Charles
     >>>>� � � � >
     >>>>� � � � > On Fri, Oct 2, 2015 at 2:36 PM, Donna Herald
     >>>>� � � � <[6][10]donna.g.herald@xxxxxxxxx>
     >>>>� � � � > wrote:
     >>>>� � � � >
     >>>>� � � � >> Scott,
     >>>>� � � � >> I appologize for my issues...if I add 'callp
     >>>> httpapi_debug(*on)'
     >>>>� � � � my
     >>>>� � � � >> program will not compile.�� I get the
     following error,, the
     >>>> name
     >>>>� � � � or
     >>>>� � � � >> indicator is not defined (HTTPAPI).�� I have
     libhttp added to
     >>>> my
     >>>>� � � � >> library list.�� I did find this in my link,
     Error 500:
     >>>>� � � � >> java.lang.NullPointerException
     >>>>� � � � >>
     >>>>� � � � >> The purpose of the project is to send data over
     to the
     >>>>� � � � webservice.
     >>>>� � � � >> The java programmer created a service web service
     program
     >>>> which
     >>>>� � � � takes
     >>>>� � � � >> you to a web page for testing.�� I cannot
     access this as I am
     >>>> on
     >>>>� � � � a
     >>>>� � � � >> virtual and do not have access, however I have
     had someone
     >>>> else
     >>>>� � � � paste
     >>>>� � � � >> in the xml and it seems to work right from there.
     >>>>� � � � >>
     >>>>� � � � >> From SOAPUI I asked someone to try and it will
     not work from
     >>>>� � � � SOAPUI.
     >>>>� � � � >> I dont have the authority to try from SOAPUI
     either.
     >>>>� � � � >>
     >>>>� � � � >> I am not sure if I should even be using the
     http_url_post or
     >>>> the
     >>>>� � � � >> http_url_post_xml.�� The service I was given
     by the java
     >>>>� � � � programmer
     >>>>� � � � >> says he is expecting one paramether but the http
     commands
     >>>> expects
     >>>>� � � � more
     >>>>� � � � >> which I am passing.
     >>>>� � � � >>
     >>>>� � � � >> I think it must have to do with the wrong values
     in the
     >>>> paramets
     >>>>� � � � I am
     >>>>� � � � >> passing.�� Were you able to open up my
     attachments to see my
     >>>>� � � � program.
     >>>>� � � � >>
     >>>>� � � � >> Scott, thanks so much for your help.�� I am at
     a loss of what
     >>>> to
     >>>>� � � � do and
     >>>>� � � � >> no one here seems to know either.
     >>>>� � � � >>
     >>>>� � � � >> Donna
     >>>>� � � � >>
     >>>>� � � � >>
     >>>>� � � � >>
     >>>>� � � � >>
     >>>>� � � � >> On 10/2/15, Scott Klement
     <[7][11]sk@xxxxxxxxxxxxxxxx> wrote:
     >>>>� � � � >> > Hey Donna,
     >>>>� � � � >> >
     >>>>� � � � >> > When it sends "500" as a response, this doesn't
     tell us
     >>>>� � � � anything
     >>>>� � � � >> > specific.�� It simply means that the web
     service noticed an
     >>>>� � � � error.
     >>>>� � � � >> > Nothing more specific than that...
     >>>>� � � � >> >
     >>>>� � � � >> > However, the web service should have sent a
     response
     >>>> containing
     >>>>� � � � more
     >>>>� � � � >> > information.�� � This may be in the form
     of an XML or JSON
     >>>>� � � � document
     >>>>� � � � >> > containing the error message -- so you might
     check the
     >>>> document
     >>>>� � � � you
     >>>>� � � � >> > received back to see if it has the error
     message in it (in
     >>>>� � � � place of
     >>>>� � � � >> > the normal WS response.)
     >>>>� � � � >> >
     >>>>� � � � >> > You can also create an HTTPAPI debug/trace file
     that
     >>>> contains a
     >>>>� � � � lot
     >>>>� � � � >> > of technical information about what is going on
     under the
     >>>>� � � � covers. To
     >>>>� � � � >> > do that, you can add a line of code to your
     program (before
     >>>>� � � � calling
     >>>>� � � � >> > HTTPAPI
     >>>>� � � � >> > routines) like this:
     >>>>� � � � >> >
     >>>>� � � � >> > callp httpapi_debug(*on)
     >>>>� � � � >> >
     >>>>� � � � >> > When you run your program again, it will
     produce a file in
     >>>> the
     >>>>� � � � IFS
     >>>>� � � � >> > named /tmp/httpapi_debug.txt that contains the
     >>>> aforementioned
     >>>>� � � � technical
     >>>>� � � � >> > info.
     >>>>� � � � >> > Please look that over and see if you can figure
     this out,.�
     >>>>� � � � � If not,
     >>>>� � � � >> > download the file to your PC, obscure any
     sensitive info
     >>>>� � � � (especially
     >>>>� � � � >> > any passwords... remove any
     authorization/authenticate
     >>>> lines)
     >>>>� � � � and
     >>>>� � � � >> > attach the file to an e-mail in reply to this
     mailing list.�
     >>>>� � � � This
     >>>>� � � � >> > will give us information that we can use to try
     to
     >>>> understand
     >>>>� � � � what is
     >>>>� � � � >> > going on.
     >>>>� � � � >> >
     >>>>� � � � >> > Hope that helps
     >>>>� � � � >> >
     >>>>� � � � >> >
     >>>>� � � � >> >
     >>>>� � � � >> > On 10/2/2015 9:16 AM, Donna Herald wrote:
     >>>>� � � � >> >> Please see the prior email
     >>>>� � � � >> >>
     >>>>� � � � >> >> On 10/2/15, Donna Herald
     <[8][12]donna.g.herald@xxxxxxxxx>
     >>>> wrote:
     >>>>� � � � >> >>> Hello,
     >>>>� � � � >> >>>
     >>>>� � � � >> >>> I am trying to create a program to call a
     REST WS but I am
     >>>>� � � � getting
     >>>>� � � � >> >>> an error, �HTTP/1.1 500 Internal Server
     Error�.�� I am new
     >>>> to
     >>>>� � � � REST
     >>>>� � � � >> >>> WS and API�s.�� I have debugged my
     program several times
     >>>> but
     >>>>� � � � I
     >>>>� � � � >> >>> cannot find the problem.�� I think it must
     be with the
     >>>>� � � � parameters I
     >>>>� � � � >> >>> am using for the post but I cannot find the
     problem.�� I
     >>>> have
     >>>>� � � � >> >>> attached my program and would appreciate any
     available
     >>>>� � � � assistance.
     >>>>� � � � >> >>>
     >>>>� � � � >> >>>
     >>>>� � � � >> >>> Donna G Herald
     >>>>� � � � >> >>>
     >>>>� � � � >> >>
     >>>>
     >>>>
     -------------------------------------------------------------------
     >>>>� � � � >> >> ---- This is the FTPAPI mailing list.�� To
     unsubscribe,
     >>>> please
     >>>>� � � � go
     >>>>� � � � >> >> to:
     >>>>� � � � >> >>
     [9][13]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>>� � � � >> >>
     >>>>
     >>>>
     -------------------------------------------------------------------
     >>>>� � � � >> >> ----
     >>>>� � � � >> >>
     >>>>� � � � >> >
     >>>>� � � � >> >
     >>>>
     >>>>
     --------------------------------------------------------------------
     >>>>� � � � >> > --- This is the FTPAPI mailing list.�� To
     unsubscribe,
     >>>> please
     >>>>� � � � go to:
     >>>>� � � � >> >
     [10][14]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>>� � � � >> >
     >>>>
     >>>>
     --------------------------------------------------------------------
     >>>>� � � � >> > ---
     >>>>� � � � >> >
     >>>>� � � � >>
     >>>>
     >>>>
     --------------------------------------------------------------------
     >>>>� � � � --
     >>>>� � � � >> - This is the FTPAPI mailing list.�� To
     unsubscribe, please go
     >>>>� � � � to:
     >>>>� � � � >>
     [11][15]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>>� � � � >>
     >>>>
     >>>>
     --------------------------------------------------------------------
     >>>>� � � � --
     >>>>� � � � >> -
     >>>>� � � � >>
     >>>>� � � � >
     >>>>� � � � > ________________________________
     >>>>� � � � > CONFIDENTIALITY NOTICE: This e-mail message,
     including any
     >>>>� � � � attachments, is
     >>>>� � � � > for the sole use of the intended recipient(s) and
     may contain
     >>>>� � � � confidential
     >>>>� � � � > and proprietary information. Any unauthorized
     review, use,
     >>>>� � � � disclosure or
     >>>>� � � � > distribution is prohibited. If you are not the
     intended
     >>>>� � � � recipient(s), please
     >>>>� � � � > contact the sender by reply e-mail and destroy all
     copies of
     >>>> the
     >>>>� � � � original
     >>>>� � � � > message.
     >>>>� � � � >
     >>>>
     >>>>
     --------------------------------------------------------------------
     >>>>� � � � ---
     >>>>� � � � > This is the FTPAPI mailing list.�� To
     unsubscribe, please go
     >>>> to:
     >>>>� � � � >
     [12][16]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>>� � � � >
     >>>>
     >>>>
     --------------------------------------------------------------------
     >>>>� � � � ---
     >>>>� � � � >
     >>>>
     >>>>
     --------------------------------------------------------------------
     >>>>� � � � ---
     >>>>� � � � This is the FTPAPI mailing list.�� To
     unsubscribe, please go to:
     >>>>� � � �     [13][17]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>>
     >>>>
     --------------------------------------------------------------------
     >>>>� � � � ---
     >>>>
     >>>> References
     >>>>
     >>>>� � � 1. mailto:[18]donna.g.herald@xxxxxxxxx
     >>>>� � � 2. [19]http://AD.CHURCHMUTUAL.COM/
     >>>>� � � 3. mailto:[20]jmuehe@xxxxxxxxxxxxxxxx
     >>>>� � � 4. mailto:[21]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     >>>>� � � 5. mailto:[22]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     >>>>� � � 6. mailto:[23]donna.g.herald@xxxxxxxxx
     >>>>� � � 7. mailto:[24]sk@xxxxxxxxxxxxxxxx
     >>>>� � � 8. mailto:[25]donna.g.herald@xxxxxxxxx
     >>>>� � � 9.
     [26]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>>� � �10.
     [27]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>>� � �11.
     [28]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>>� � �12.
     [29]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>>� � �13.
     [30]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>>
     >>>>
     >>>>
     >>>>
     --------------------------------------------------------------------
     ---
     >>>> This is the FTPAPI mailing list.� To unsubscribe, please go
     to:
     >>>> [31]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>>
     --------------------------------------------------------------------
     ---
     >>>
     --------------------------------------------------------------------
     ---
     >>> This is the FTPAPI mailing list.� To unsubscribe, please go to:
     >>> [32]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>
     --------------------------------------------------------------------
     ---
     >>>
     >>>
     >>>
     >>>
     --------------------------------------------------------------------
     ---
     >>> This is the FTPAPI mailing list.� To unsubscribe, please go to:
     >>> [33]http://www.scottklement.com/mailman/listinfo/ftpapi
     >>>
     --------------------------------------------------------------------
     ---
     >>>
     >>>
     >>> -----
     >>> No virus found in this message.
     >>> Checked by AVG - [34]www.avg.com
     >>> Version: 2015.0.6140 / Virus Database: 4435/10751 - Release
     Date:
     >>> 10/03/15
     >
     >
     --------------------------------------------------------------------
     ---
     > This is the FTPAPI mailing list.� To unsubscribe, please go to:
     > [35]http://www.scottklement.com/mailman/listinfo/ftpapi
     >
     --------------------------------------------------------------------
     ---
     >
     --------------------------------------------------------------------
     ---
     This is the FTPAPI mailing list.� To unsubscribe, please go to:
     [36]http://www.scottklement.com/mailman/listinfo/ftpapi
     --------------------------------------------------------------------
     ---

   --
   Chris Edmondson
   509.670.6817

References

   1. http://production.shippingapis.com/ShippingAPI.dll?
   2. mailto:donna.g.herald@xxxxxxxxx
   3. mailto:sk@xxxxxxxxxxxxxxxx
   4. mailto:sk@xxxxxxxxxxxxxxxx
   5. mailto:donna.g.herald@xxxxxxxxx
   6. http://AD.CHURCHMUTUAL.COM/
   7. mailto:jmuehe@xxxxxxxxxxxxxxxx
   8. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   9. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  10. mailto:donna.g.herald@xxxxxxxxx
  11. mailto:sk@xxxxxxxxxxxxxxxx
  12. mailto:donna.g.herald@xxxxxxxxx
  13. http://www.scottklement.com/mailman/listinfo/ftpapi
  14. http://www.scottklement.com/mailman/listinfo/ftpapi
  15. http://www.scottklement.com/mailman/listinfo/ftpapi
  16. http://www.scottklement.com/mailman/listinfo/ftpapi
  17. http://www.scottklement.com/mailman/listinfo/ftpapi
  18. mailto:donna.g.herald@xxxxxxxxx
  19. http://AD.CHURCHMUTUAL.COM/
  20. mailto:jmuehe@xxxxxxxxxxxxxxxx
  21. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  22. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  23. mailto:donna.g.herald@xxxxxxxxx
  24. mailto:sk@xxxxxxxxxxxxxxxx
  25. mailto:donna.g.herald@xxxxxxxxx
  26. http://www.scottklement.com/mailman/listinfo/ftpapi
  27. http://www.scottklement.com/mailman/listinfo/ftpapi
  28. http://www.scottklement.com/mailman/listinfo/ftpapi
  29. http://www.scottklement.com/mailman/listinfo/ftpapi
  30. http://www.scottklement.com/mailman/listinfo/ftpapi
  31. http://www.scottklement.com/mailman/listinfo/ftpapi
  32. http://www.scottklement.com/mailman/listinfo/ftpapi
  33. http://www.scottklement.com/mailman/listinfo/ftpapi
  34. http://www.avg.com/
  35. http://www.scottklement.com/mailman/listinfo/ftpapi
  36. 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
-----------------------------------------------------------------------