ich habe ein Problem mit SOAPpy
Zuerstmal zu meiner Konfiguration:
Python 2.4
SOAPpy 0.12
SOAPUI 1.0.3
Ich möchte nun enen Webservice dessen WSDL ich von http://www.xmethods.com habe ansprechen, dazu folgender Code:
Code: Alles auswählen
import SOAPpy
proxy = SOAPpy.WSDL.Proxy("http://www.neurofuzz.com/modules/cryptoService/cryptoSOAP.php?wsdl ")
proxy.soapproxy.config.dumpSOAPOut = 1
proxy.soapproxy.config.dumpSOAPIn = 1
print proxy.methods.keys()
callinfo= proxy.methods['encrypt']
print callinfo.inparams
i=0
while i< len(callinfo.inparams):
print callinfo.inparams[i].name
print callinfo.inparams[i].type
i=i+1
in0=SOAPpy.structType()
in0._addItem("string", 'Hallo')
in0._addItem("key", 'Welt')
print in0
Answer= proxy.encrypt (in0)
print Answer
Code: Alles auswählen
[XML]
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
>
<SOAP-ENV:Body>
<ns1:encrypt xmlns:ns1="urn:encryptwsdl" SOAP-ENC:root="1">
<xsd:v1>
<string xsi:type="xsd:string">Hallo</string>
<key xsi:type="xsd:string">Welt</key>
</xsd:v1>
</ns1:encrypt>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Das Problem ist der von SOAPpy eingefügte <v1>...</v1> Tag. Dieser wird vom server nicht verstanden. Wenn der Server auch SOAPpy benutzt ist dieser Tag unproblematich, er tut es aber leider nicht.
Wenn ich den Webservice mit dem Tool SOAPUI ohne diesen Tag aufrufe funktioniert alles. In der Dokumentation von SOAPpy steht dazu folgendes:
"This mechanism is enabled in SOAPpy by setting
SOAPpy.SOAP.Config.specialArgs=1, and disabled by setting
SOAPpy.SOAP.Config.specialArgs=0.
When enabled, parameters with names of the form v#### (i.e., matching
the regexp "^v[0-9]+$") are assumed to be unnamed parameters and are passed to the method in numeric order. All other parameters are
assumed to be named and are passed using the name. Outgoing SOAP
method calls now always generate names in this way--whether or not
specialArgs is enabled. " So hiermit wäre das Leben ja wieder toll , wenn es nur Funktionieren würde.
1. Das Modul SOAP ist veraltet und wurde in SOAPpy0.12 durch SOAPProxy ersetzt. Wenn ich soapproxy.config.specialArgs nun auf 1 setze passiert - Oh Wunder- garnichts, egal welchen Wert ich zuweise das <v> Tag ist immer da. Kann mir jemand einen Tipp geben, wie ich SOAPpy so konfiguriere, dass dieses Tag verschwindet?
Vielen Dank, Richard