[XML-SIG] Document style SOAP Web Service with ZSI (docstyle)
Alexis Marrero-Narváez
amarrero at mitre.org
Wed Sep 17 14:59:37 EDT 2003
Rich,
Sorry for the confusion in the original email. Here is what I'm trying
to do. I want to create a docstyle web service. My question is, how can
I send the response?
So far, I have the following code on my server.
####Server Side
#!/usr/bin/env python
from xml.dom import minidom
from ZSI import dispatch
def getExample(input):
print input
doc = minidom.parse('example.xml')
return doc
dispatch.AsServer(docstyle=1, port=4444)
It sets the AsServer to docstyle which sends the SOAP XML input to the
getExample via the <input> parameter. I want to return the example.xml
file back as my xml payload. Example.xml is
'<root><child>value</child></root>'. I want ZSI to return this payload
as the response.
The following is my client side code.
####Client Side
import sys
#Import the ZSI client
from ZSI.client import Binding
import sys
fp = sys.stdout
u = ''
n = ''
b = Binding(url=u, ns=n, host='localhost', port=4444, tracefile=fp)
result = b.getExample()
print result
When running this example this is my response:
######################
<?xml version="1.0" encoding="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>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Processing Failure</faultstring>
<detail>
<ZSI:FaultDetail>
<ZSI:string>iteration over non-sequence</ZSI:string>
<ZSI:trace>
/Volumes/Data/amarre/Documents/work-data/issa/development/ZSI/
dispatch.py:72:_Dispatch
/Volumes/Data/amarre/Documents/work-data/issa/development/ZSI/
writer.py:73:serialize
/Volumes/Data/amarre/Documents/work-data/issa/development/ZSI/
TC.py:281:serialize</ZSI:trace>
</ZSI:FaultDetail>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
###########################
Is there any further settings on the server side, other than
docstyle=1, that needs to be set so it returns the xml doc?
Regards,
amn
On Friday, September 12, 2003, at 10:32 AM, Rich Salz wrote:
>> I want to return and XML document back to the client and I can't
>> figure it out.
>
>> #!/usr/bin/python
>> #### client.py
>> import sys
>> #Import the ZSI client
>> from ZSI.client import Binding
>> import sys
>> fp = sys.stdout
>> u = ''
>> n = 'http://uche.ogbuji.net/eg/ws/simple-cal'
>> b = Binding(url=u, ns=n, host='localhost', port=4444, tracefile=fp)
>> result = b.getExample()
>> print result[0]
>
> That example's not complete; where's "getExample()" for example?
>
> Anyhow, if you're sending docstyle as opposed to soap-rpc, then you
> want to do something like
> b = Binding....
> b.Send(...parameters...)
> result = b.ReceiveSoap().body
>
> --
> Rich Salz, Chief Security Architect
> DataPower Technology http://www.datapower.com
> XS40 XML Security Gateway http://www.datapower.com/products/xs40.html
> XML Security Overview http://www.datapower.com/xmldev/xmlsecurity.html
>
More information about the XML-SIG
mailing list