ZSI sample and issues with the WSDL

rieh25 robertoedwins at gmail.com
Wed Sep 5 15:02:26 EDT 2007


I'm not sure I know enough to help you, but who knows, maybe this could be of
help. I think that technology is more complicated (or ureliable) than it
should. Possibly the best thing to do is not to depend upon already built
wsdl facilities, but instead work with a basic webservice routine, and work
with it around wsdl.

For instance:

## message_builder_py:

import sys, httplib

def send_message(m):

  #construct and send the header


  if m['type'] == 'HTTP': webservice = httplib.HTTP(m['page'], 80)
  elif m['type'] == 'HTTPS': webservice = httplib.HTTPS(m['page'], 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['message']))
  webservice.putheader("SOAPAction", m['SOAPAction'])


  webservice.endheaders()

  webservice.send(m['message'])

  # 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

###call in another place:

xml = """
<solicitud>
  <usuario>gamazari</usuario>
  <clave>laclave</clave>
  <ejercicio>%s</ejercicio>
  <mes>%s</mes>
</solicitud>
"""

mensaje = {}
mensaje['funcion'] = 'SIAFCatalogoFacturas'
mensaje['funcion atribs'] = [['xmlns',
'http://tempuri.org/SIAFProxyWS/Service1']]
params = []
params += [{'parametro': 'xml', 'type': 'string', 'valor': xml % (anio,
mes)}]
mensaje['parametros'] = params

mensaje['pagina'] = 'sicoindes.minfin.gob.gt'
mensaje['tipo'] = 'HTTPS'
mensaje['post'] = '/SIAFProxyWs/SIAFPService.asmx'
mensaje['host'] = 'sicoindes.minfin.gob.gt'
mensaje['SOAPAction'] =
'"http://tempuri.org/SIAFProxyWS/Service1/SIAFCatalogoFacturas"'

res = context.Funcionalidad.Utilidades.SOAP.message_builder_py(mensaje)


David Ross-6 wrote:
> 
> First two appologies, this is probably not a Python question, more
> SOAP. And second, there is every possibilty I am terminally confused
> having looked at this for two days now.
> 
> What I want is to create a Python SOAP server.  I am using the sample
> which comes with ZSI, namely the Echo.wsdl and associated files.  I
> then follow the instructions in the readme, and I CAN get a python
> client and server to communicate.
> 
> But when I take the WSDL file and try to create a VB.NET program:
> 
>>wsdl.exe /language:VB /out:myProxyClass.vb Echo.wsdl 
> 
> I get:
> 
> Error: Unable to import binding 'EchoServer' from namespace
> 'urn:ZSI:examples'.
>   - Unable to import operation 'Echo'.
>   - Specified cast is not valid.
> 
> So I tried to set up the wsdl to point to my domain:
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <definitions 
>   xmlns="http://schemas.xmlsoap.org/wsdl/"
>   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>   xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
>   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>   xmlns:tns="http://www.me.org/Namespaces"
>   targetNamespace="http://www.me.org/Namespaces" >
> 
>   <message name="EchoRequest">
>     <part name="in_str" type="xsd:string"/>
>   </message>
>   <message name="EchoResponse">
>     <part name="result" type="xsd:string"/>
>   </message>
> 
>   <portType name="EchoServer">
>     <operation name="Echo">
>       <input message="tns:EchoRequest"/>
>       <output message="tns:EchoResponse"/>
>     </operation>
>   </portType>
> 
>   <binding name="EchoServer" type="tns:EchoServer">
>     <soap:binding style="document" 
>                   transport="http://schemas.xmlsoap.org/soap/http"/>
>     <operation name="Echo">
>       <soap:operation soapAction="Echo"/>
>         <input>
>           <soap:body use="literal"/> 
>         </input>
>         <output>
>           <soap:body use="literal"/> 
>         </output>
>     </operation>
>   </binding>
> 
>   <service name="EchoServer">
>     <port name="EchoServer" binding="tns:EchoServer">
>       <soap:address location="http://localhost:7000"/>
>     </port>
>   </service>
> 
> </definitions>
> 
> 
> I get a the same error:
> 
> Error: Unable to import binding 'EchoServer' from namespace
> 'http://www.me.org/Namespaces'.
>   - Unable to import operation 'Echo'.
>   - Specified cast is not valid.
> 
> My problem is that I'm not sure how to edit the ZSI example.  Worse,
> this is pretty much as simple as it seems to get ;-(
> 
> Any pointers would be greatfully received.
> 
> I know I should ask in the MS forumns, but I was hoping someone would
> understand the ZSI example better than I seem to.
> 
> Cheers
> 
> David
> 
> ----
> Note anti-spam in email address...
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
> 

-- 
View this message in context: http://www.nabble.com/ZSI-sample-and-issues-with-the-WSDL-tf4384788.html#a12508850
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list