External method for Zope 2.7.5

import sys, httplib

def envia_mensaje(m):

  #construct and send the header


  if m['tipo'] == 'HTTP': webservice = httplib.HTTP(m['pagina'], 80)
  elif m['tipo'] == 'HTTPS': webservice = httplib.HTTPS(m['pagina'], 443)
  webservice.putrequest("POST", m['post'])
  webservice.putheader("Host", m['host'])
  webservice.putheader("Content-type", m['content-type'])
  webservice.putheader("Content-length", "%d" % len(m['mensaje']))
  webservice.putheader("SOAPAction", m['SOAPAction'])


  webservice.endheaders()

  webservice.send(m['mensaje'])

  # get the response

  statuscode, statusmessage, header = webservice.getreply()

  r = {}
  r['Response'] = {'statuscode': statuscode, 'statusmessage': statusmessage}
  r['header'] = header
  r['res'] = webservice.getfile().read()
  return r
-- 
View this message in context: 
http://www.nabble.com/SOAP---Integration--tf4211042.html#a12061157
Sent from the Zope - General mailing list archive at Nabble.com.

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to