ZSI sample and issues with the WSDL

D

David Ross

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:eek:peration 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
 
R

rieh25

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top