SOAPpy / WSDL help... please

sberry sean at buildingonline.com
Wed Oct 31 00:10:39 CET 2007


I have an Adobe InDesign server running that includes a built-in SOAP
server.  The wsdl is located here:
http://www.seanberry.com/IDSP.wsdl.

I have a PHP example that looks like this for calling the SOAP
function runScriptParameters

//---------------------------------------------------------------------------
$scriptArgs = array();
$scriptArgs[] = array("name" => "myVarName", "value" => "myVarValue");
$scriptArgs[] = array("name" => "myVarName2", "value" =>
"myVarValue2");
$runScriptParams = array( "scriptFile" => "/some/path/to/file.jsx",
"scriptArgs" => $scriptArgs, "scriptLanguage" => "javascript");
$scriptData = array("runScriptParameters" => $runScriptParams);
$client = new SoapClient("IDSP.wsdl", $proxy_settings);
$returnedValue = $client->RunScript($scriptData);
//---------------------------------------------------------------------------



This works fine and produces the following as its output XML:
//---------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:ns1="http://ns.adobe.com/InDesign/soap/">
	<SOAP-ENV:Body>
		<ns1:RunScript>
			<runScriptParameters>
				<scriptLanguage>javascript</scriptLanguage>
				<scriptFile>/some/path/to/file.jsx</scriptFile>
				<scriptArgs><name>myVarName</name><value>myVarValue</value></
scriptArgs>
				<scriptArgs><name>myVarName2</name><value>myVarValue2</value></
scriptArgs>
			</runScriptParameters>
		</ns1:RunScript>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
---------------------------------------------------------------------------


Now I am writing a client in Python and have tried the following:
//---------------------------------------------------------------------------
#!/usr/bin/python

import SOAPpy

url = "./IDSP.wsdl"

wsdlObject = SOAPpy.WSDL.Proxy(url)
SOAPpy.Config.debug = 1

scriptArgs = []
scriptArgs.append({"name":"myVarName", "value":"myVarValue"})
scriptArgs.append({"name":"myVarName2", "value":"myVarValue2"})
runScriptParams = {}
runScriptParams["scriptFile"] = "/some/path/to/file.jsx"
runScriptParams["scriptLanguage"] = "javascript"
runScriptParams["scriptArgs"] = scriptArgs

result = wsdlObject.RunScript(runScriptParameters=runScriptParams)
print result
//---------------------------------------------------------------------------


This errors out and shows the following as the 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>
                <RunScript SOAP-ENC:root="1">
                        <runScriptParameters>
                                <scriptArgs SOAP-
ENC:arrayType="ns1:SOAPStruct[2]" xsi:type="SOAP-ENC:Array"
xmlns:ns1="http://soapinterop.org/xsd">
                                        <item>
                                                <name
xsi:type="xsd:string">myVarName</name>
                                                <value
xsi:type="xsd:string">myVarValue</value>
                                        </item>
                                        <item>
                                                <name
xsi:type="xsd:string">myVarName2</name>
                                                <value
xsi:type="xsd:string">myVarValue2</value>
                                        </item>
                               </scriptArgs>
                               <scriptLanguage
xsi:type="xsd:string">javascript</scriptLanguage>
                               <scriptFile xsi:type="xsd:string">/some/
path/to/file.jsx</scriptFile>
                       </runScriptParameters>
                </RunScript>
        </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
//---------------------------------------------------------------------------------

This looks wrong first off because of the RunScript node, but also has
those extra "item" nodes for the scriptArgs instead of each being a
scriptArgs node.  Can anyone help?  I really need to get this working
and would appreciate any pointers anyone can give.

THANKS!!!




More information about the Python-list mailing list