M
Michiel
Hello,
I am not sure this is the right place to ask. I tried the ZSI mailing
list, but got no response there.
My goal is to write some web services with ZSI to be used by a client
written in .NET. I'm using ZSI 1.2.7 (this was easy to install on my
Debian system).
I have no problem with functions with parameters and return values
with simple types, but I am having a hell of a time moving a simple
array.
My web service is taken from the zsi examples:
______________________________
#!/usr/bin/python
def echo(s):
return s
from ZSI import dispatch
dispatch.AsCGI()
______________________________
I want to invoke the echo function with an array of strings as a
parameter and I want it to give me an array back. I had a lot of
trouble putting together a WSDL file that was properly imported by
Visual Studio (without turning my string arrays into single strings),
but with the help of many google searches, I finally came to a
description with the following schema:
______________________________
<schema
targetNamespace="https://secure6.wwwcomm.com/admin/soap/DomainKiller/bin/DomainKiller.xsd"
xmlns="http://www.w3.org/2001/XMLSchema"
<complexContent>
<restriction base="soapenc:Array">
<sequence>
<element name="item" type="string" minOccurs="0"
maxOccurs="unbounded" nillable="true"/>
</sequence>
<attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:string[]"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
</restriction>
</complexContent>
</complexType>
</schema>
______________________
For brevity, I've left out the rest of the wsdl file. Messages for
parameters and return value of echo are defined as having the above
type ArrayOfString.
Now, it seems that ZSI doesn't like what my .NET client is sending it.
Request from .NET app:
______________________________________________
<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="https://secure6.wwwcomm.com/admin/soap/DomainKiller/bin/DomainKiller.wsdl"
xmlns:types="https://secure6.wwwcomm.com/admin/soap/DomainKiller/bin/DomainKiller.wsdl/encodedTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<echo>
<s href="#id1" />
</echo>
<soapenc:Array id="id1" soapenc:arrayType="xsd:string[2]">
<Item>s1</Item>
<Item>s2</Item>
</soapenc:Array>
</soap:Body>
</soap:Envelope>
_______________________________________________
The response from the ZSI cgi:
_______________________________________________
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Unparseable message</faultstring>
<detail>
<ZSIarseFaultDetail>
<ZSI:string>Any cannot parse untyped element</ZSI:string>
<ZSI:trace>/soap:Envelope/soap:Body/soapenc:Array/Item[1]</ZSI:trace>
</ZSIarseFaultDetail>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
_________________________________________________
For comparison, a simple ZSI client works fine and this is the dialog:
_________________________________ Tue Jan 20 13:38:34 2004 REQUEST:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
<SOAP-ENV:Body>
<echo>
<E403ee28c SOAP-ENC:arrayType="xsd:anyType[3]">
<SOAP-ENC:string id="401f8b00">1</SOAP-ENC:string>
<SOAP-ENC:string id="40219520">2</SOAP-ENC:string>
<SOAP-ENC:string id="40219560">3</SOAP-ENC:string>
</E403ee28c>
</echo>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
_________________________________ Tue Jan 20 13:38:36 2004 RESPONSE:
Date: Tue, 20 Jan 2004 18:38:35 GMT
Server: Apache/1.3.26 Ben-SSL/1.48 (Unix) Debian GNU/Linux PHP/4.1.2
mod_perl/1.26
Content-Length: 664
Content-Type: text/xml; charset="utf-8"
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
<SOAP-ENV:Body>
<echoResponse>
<E4050908c SOAP-ENC:arrayType="xsd:anyType[3]">
<SOAP-ENC:string id="404ea950">1</SOAP-ENC:string>
<SOAP-ENC:string id="404eaa10">2</SOAP-ENC:string>
<SOAP-ENC:string id="404eaae8">3</SOAP-ENC:string>
</E4050908c>
</echoResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
_____________________________________
It seems the arguments to echo have types here.
Can I get .NET to do the same? Can this be done through the WSDL file?
Or else, how can I send arrays back and forth?
Thank you,
Michiel van Wessem
I am not sure this is the right place to ask. I tried the ZSI mailing
list, but got no response there.
My goal is to write some web services with ZSI to be used by a client
written in .NET. I'm using ZSI 1.2.7 (this was easy to install on my
Debian system).
I have no problem with functions with parameters and return values
with simple types, but I am having a hell of a time moving a simple
array.
My web service is taken from the zsi examples:
______________________________
#!/usr/bin/python
def echo(s):
return s
from ZSI import dispatch
dispatch.AsCGI()
______________________________
I want to invoke the echo function with an array of strings as a
parameter and I want it to give me an array back. I had a lot of
trouble putting together a WSDL file that was properly imported by
Visual Studio (without turning my string arrays into single strings),
but with the help of many google searches, I finally came to a
description with the following schema:
______________________________
<schema
targetNamespace="https://secure6.wwwcomm.com/admin/soap/DomainKiller/bin/DomainKiller.xsd"
xmlns="http://www.w3.org/2001/XMLSchema"
<complexType name="ArrayOfString">
<complexContent>
<restriction base="soapenc:Array">
<sequence>
<element name="item" type="string" minOccurs="0"
maxOccurs="unbounded" nillable="true"/>
</sequence>
<attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:string[]"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
</restriction>
</complexContent>
</complexType>
</schema>
______________________
For brevity, I've left out the rest of the wsdl file. Messages for
parameters and return value of echo are defined as having the above
type ArrayOfString.
Now, it seems that ZSI doesn't like what my .NET client is sending it.
Request from .NET app:
______________________________________________
<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="https://secure6.wwwcomm.com/admin/soap/DomainKiller/bin/DomainKiller.wsdl"
xmlns:types="https://secure6.wwwcomm.com/admin/soap/DomainKiller/bin/DomainKiller.wsdl/encodedTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<echo>
<s href="#id1" />
</echo>
<soapenc:Array id="id1" soapenc:arrayType="xsd:string[2]">
<Item>s1</Item>
<Item>s2</Item>
</soapenc:Array>
</soap:Body>
</soap:Envelope>
_______________________________________________
The response from the ZSI cgi:
_______________________________________________
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Unparseable message</faultstring>
<detail>
<ZSIarseFaultDetail>
<ZSI:string>Any cannot parse untyped element</ZSI:string>
<ZSI:trace>/soap:Envelope/soap:Body/soapenc:Array/Item[1]</ZSI:trace>
</ZSIarseFaultDetail>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
_________________________________________________
For comparison, a simple ZSI client works fine and this is the dialog:
_________________________________ Tue Jan 20 13:38:34 2004 REQUEST:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
<SOAP-ENV:Body>
<echo>
<E403ee28c SOAP-ENC:arrayType="xsd:anyType[3]">
<SOAP-ENC:string id="401f8b00">1</SOAP-ENC:string>
<SOAP-ENC:string id="40219520">2</SOAP-ENC:string>
<SOAP-ENC:string id="40219560">3</SOAP-ENC:string>
</E403ee28c>
</echo>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
_________________________________ Tue Jan 20 13:38:36 2004 RESPONSE:
Date: Tue, 20 Jan 2004 18:38:35 GMT
Server: Apache/1.3.26 Ben-SSL/1.48 (Unix) Debian GNU/Linux PHP/4.1.2
mod_perl/1.26
Content-Length: 664
Content-Type: text/xml; charset="utf-8"
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
<SOAP-ENV:Body>
<echoResponse>
<E4050908c SOAP-ENC:arrayType="xsd:anyType[3]">
<SOAP-ENC:string id="404ea950">1</SOAP-ENC:string>
<SOAP-ENC:string id="404eaa10">2</SOAP-ENC:string>
<SOAP-ENC:string id="404eaae8">3</SOAP-ENC:string>
</E4050908c>
</echoResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
_____________________________________
It seems the arguments to echo have types here.
Can I get .NET to do the same? Can this be done through the WSDL file?
Or else, how can I send arrays back and forth?
Thank you,
Michiel van Wessem