[Linux-Biella] utilizzo di SOAP

Carolina Maiorana c.maiorana a bilug.it
Ven 12 Ott 2018 15:47:31 CEST


On 12. okt. 2018 15:39, PaulTT wrote:
> On 12/10/2018 15:32, Carolina Maiorana wrote:
>> On 12. okt. 2018 15:21, PaulTT wrote:
>>
>>>>
>>> ho visto ora
>>> nell opzione url non devi mettere il ?wdsl eh
>>> quello serve per ottenere le funzioni, ma non per mandare la richiesta
>>>
>>>
>> Mi da' comunque lo stesso errore.
>>
> si' ma tu che request stai postando?????
> ometti login e pass , ma con poche info cosi'  gnia si fa
> 
> 
Ecco:

#!/usr/bin/env python
# encoding: utf-8

import requests

url = "https://www.nowcast.de/axis2/services/LightningService"

headers = {'content-type': 'text/xml'}

body = """<?xml version="1.0" encoding="UTF-8"?>

<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:type="http://service.nowcast.de/lightning/types">
     <soapenv:Header/>
         <soapenv:Body>
             <typ:HistoricRequest>
                 <LoginType>
                     <login>***</login>
                     <passwd>***</passwd>
                 </LoginType>
                 <start>2009−05−02T00:00:00.000+00:00</start>
                 <end>2009−05−02T10:00:00.000+00:00</end>
                 <area>
                     <x1>11</x1>
                     <y1>48</y1>
                     <x2>12</x2>
                     <y2>49</y2>
                 </area>
             </typ:HistoricRequest>
         </soapenv:Body>
</soapenv:Envelope>"""

response = requests.post(url, data=body, headers=headers)
print response.content

-- 
I hail from the great, white North


Maggiori informazioni sulla lista Linux