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

Problem with POST on a REST web service



   Good morning, i am using libhttp to exchange data with my iseries V7R1
   to another server using web services.The Iseries is the consumero of
   ws, the web services is a REST web service and i have no problem to GET
   data on my Iseries V7R1 using the procedure "http_url_get".
   The problems start when i try to POST an XML file. I make the request
   from Iseries using the procedure "http_url_post_stmf". The web services
   answer that there are no data in post variable.
   I try to make the same operation using the windows program SoapUI 5.2.0
    with the following parameters :
   [cid:_1_0C6829400C682594002DFFFDC1257ECE]  I select method = POST
   the request value is the XML file in this format
   <raccolta><doc_id>2015-OFF-0006784</doc_id><totale_righe>1</totale_righ
   e><note></note><riga num
   riga="1"><cod_art>92730</cod_art><qta>12</qta></riga></raccolta>
   i check the box Post quey/string
   and it work, the answer from the ws is that the data was recived and
   correctly updated.
   <return>
      <riga num_riga="1">
         <message>Importazione riga completata correttamente.</message>
      </riga>
   </return>
   My code on RPGLE is the following
   url= 'http://portale.ferritalia.it/personal/ws/offerte_in.php';
   rc = http_url_post_stmf(%trimr(url)
                          :%trim(expofile)
                          : '/tmp/http_result.txt'
                          : HTTP_TIMEOUT
                          : HTTP_USERAGENT
                          : ContentType );
   where expofile is the /tmp/example.xml that contain the xml code used
   on SoapUI.
   This is the debug output
   HTTPAPI Ver 1.29 released 2015-02-23
   NTLM Ver 1.4.0 released 2014-12-22
   OS/400 Ver V7R1M0
   http_url_post_stmf(): entered
   getting post file size...
   opening file to be sent...
   opening file to be received
   http_persist_open(): entered
   http_long_ParseURL(): entered
   DNS resolver retrans: 2
   DNS resolver retry  : 2
   DNS resolver options: x'00000136'
   DNS default domain: FRANZINI.IT
   DNS server found: 8.8.8.8
   DNS server found: 192.168.0.199
   DNS server found: 192.168.0.203
   Nagle's algorithm (TCP_NODELAY) disabled.
   http_persist_post(): entered
   http_persist_req(POST) entered.
   http_long_ParseURL(): entered
   http_long_ParseURL(): entered
   do_oper(POST): entered
   There are 0 cookies in the cache
   POST /personal/ws/offerte_in.php HTTP/1.1
   Host: portale.ferritalia.it
   User-Agent: http-api/1.29
   Content-Length: 167
   sendraw(): entered
   <raccolta><doc_id>2015-OFF-0006784</doc_id><totale_righe>1</totale_righ
   e><note></note><riga num
   riga="1"><cod_art>92730</cod_art><qta>12</qta></riga></raccolta>
   recvresp(): entered
   HTTP/1.1 200 OK
   Content-Type: text/xml
   Server: Microsoft-IIS/7.5
   X-Powered-By: PHP/5.4.15
   Date: Mon, 28 Sep 2015 07:56:44 GMT
   Content-Length: 87
   SetError() £13: HTTP/1.1 200 OK
   recvresp(): end with 200
   recvdoc parms: identity 87
   header_load_cookies() entered
   recvdoc(): entered
   SetError() £0:
   <?xml version="1.0"?>
   <return><message>Errore l'offerta non esiste.</message></return>
   http_close(): entered
   How can i replay the same request made with program SoapUi using
   LIBHTTP to be able to POST data with the WS ?
   Thank you very much for help !
   Best regards  Federico

   I dati da lei conferiti sono trattati elettronicamente e manualmente
   dagli incaricati e comunicati a terzi per la gestione dell' attivita'
   economica e per l' invio di materiale pubblicitario; un eventuale
   rifiuto al trattamento non consente la sua corretta esecuzione. Ha
   diritto di accesso ai suoi dati ed altri diritti, come da art. 7 -
   D.Lgs.196/03.
   L' informativa privacy, ai sensi e per gli effetti di cui all'art. 13
   del D.lgs 196/03, e' consultabile all' indirizzo web
   [1]www.franzini.it/informativa.htm.
   The informations provided will be processed manually and electronically
   by the data manager and will be disclosed to third parties for the
   management of economic and sending promotional materials; any refusal
   to treatment does not allow its proper implementation. You have access
   to these datas and other rights in accordance with art. 7 -
   D.Lgs.196/03. The privacy policy, in accordance with and for purposes
   of Art. 13 of Legislative Decree 196/03, is available at website
   [2]www.franzini.it/informativa.htm.
   Le informazioni contenute nella presente comunicazione e i relativi
   allegati possono essere riservate e sono, comunque, destinate
   esclusivamente alle persone o alla Societ� sopraindicati. La
   diffusione, distribuzione e/o copiatura del documento trasmesso da
   parte di qualsiasi soggetto diverso dal destinatario è proibita, sia
   ai sensi dell�t. 616 c.p. , che ai sensi del D.Lgs. n. 196/2003. Se
   avete ricevuto questo messaggio per errore, vi preghiamo di
   distruggerlo e di informarci immediatamente per telefono allo
   0522.929411 o inviando un messaggio all�dirizzo e-mail
   [3]mbox@xxxxxxxxxxx . Inoltre, il messaggio da Voi ricevuto è di
   natura non personale e le risposte al presente, potranno essere
   conosciute nell�ganizzazione di appartenenza del mittente.
   The information in this e-mail (which includes any files transmitted
   with it) is confidential and may also be legally privileged. It is
   intended for the addressee only. Access to this e-mail by anyone else
   is unauthorised. It is not to be relied upon by any person other than
   the addressee, except with our prior written approval. If no such
   approval is given, we will not accept any liability (in negligence or
   otherwise) arising from any third party acting, or refraining from
   acting on such information. Unauthorised recipients are required to
   maintain confidentiality. If you have received this e-mail in error
   please notify us immediately, destroy any copies and delete it from
   your computer system. Any use, dissemination, forwarding, printing or
   copying of this e-mail is prohibited. Copyright in this e-mail and any
   document created by us will be and remain vested in us and will not be
   transferred to you. We assert the right to be identified as the author
   of and to object to any misuses of the contents of this e-mail or such
   documents.

References

   1. http://www.franzini.it/informativa.htm
   2. http://www.franzini.it/informativa.htm
   3. mailto:mbox@xxxxxxxxxxx

GIF image

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