3 Replies Latest reply on Feb 23, 2007 8:56 AM by mburbidg

    Passing parameters to WebService

    mburbidg Level 1
      I'm trying to call a webservice from ActionScript using the WebService class. I have successfully loaded the WSDL, and am calling a webservce call RunScript. According to the wsdl RunScript takes 4 parameters, the first is names scriptText and is supposed to be a string, so I called the webservice using the following line:

      service.RunScript("this is the text",...);

      I get a fault with the message, "Error #1069: Property scriptText not found on String and there is no default value. null"

      According to the documentation I thought I could just pass a string, but it seems to want an object, with a property of the name of the webservice parameter.

      Any ideas what is going on here?
        • 1. Re: Passing parameters to WebService
          babo_ya Level 3
          Not sure what you are doing wrong but, I know for sure you can pass a string.
          I do it all the time.

          is the web service accesible by anyone? I can try it

          • 2. Re: Passing parameters to WebService
            Dzihan Level 1
            Not sure but have you ever tried:
            service.RunScript.send("this is the text",...); ?
            • 3. Re: Passing parameters to WebService
              mburbidg Level 1
              The WebService is not publicly available. I think it turns out that the WebService RunScript actually takes an struct. So I created a Parameters object in ActionScript with properties of the right name and type. I pass this into the WebService and it works.

              Here's the wsdl:

              --------
              <?xml version="1.0" encoding="UTF-8"?>
              <definitions name="Service"
              targetNamespace=" http://localhost:80/Service.wsdl"
              xmlns:tns=" http://localhost:80/Service.wsdl"
              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:IDSP=" http://ns.adobe.com/InDesign/soap/"
              xmlns:SOAP=" http://schemas.xmlsoap.org/wsdl/soap/"
              xmlns:MIME=" http://schemas.xmlsoap.org/wsdl/mime/"
              xmlns:DIME=" http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"
              xmlns:WSDL=" http://schemas.xmlsoap.org/wsdl/"
              xmlns=" http://schemas.xmlsoap.org/wsdl/">

              <types>

              <schema targetNamespace=" http://ns.adobe.com/InDesign/soap/"
              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:IDSP=" http://ns.adobe.com/InDesign/soap/"
              xmlns=" http://www.w3.org/2001/XMLSchema"
              elementFormDefault="unqualified"
              attributeFormDefault="unqualified">
              <import namespace=" http://schemas.xmlsoap.org/soap/encoding/"/>
              <simpleType name="Enumeration">
              <restriction base="xsd:long">
              </restriction>
              </simpleType>
              <simpleType name="Unit">
              <restriction base="xsd:double">
              </restriction>
              </simpleType>
              <complexType name="IDSP-ScriptArg">
              <sequence>
              <element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
              <element name="value" type="xsd:string" minOccurs="1" maxOccurs="1"/>
              </sequence>
              </complexType>
              <complexType name="RunScriptParameters">
              <sequence>
              <element name="scriptText" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/>
              <element name="scriptLanguage" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/>
              <element name="scriptFile" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/>
              <element name="scriptArgs" type="IDSP:IDSP-ScriptArg" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
              </complexType>
              <complexType name="Data">
              <sequence>
              <element name="data" type="xsd:anyType" minOccurs="1" maxOccurs="1" nillable="false"/>
              </sequence>
              </complexType>
              <complexType name="List">
              <sequence>
              <element name="item" type="IDSP:Data" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
              </sequence>
              </complexType>
              <complexType name="Object">
              <sequence>
              <element name="specifierData" type="xsd:anyType" minOccurs="1" maxOccurs="1" nillable="false"/>
              <element name="objectType" type="xsd:unsignedLong" minOccurs="1" maxOccurs="1"/>
              <element name="specifierForm" type="xsd:unsignedLong" minOccurs="1" maxOccurs="1"/>
              <element name="start" type="IDSP:Object" minOccurs="0" maxOccurs="1" nillable="true"/>
              <element name="end" type="IDSP:Object" minOccurs="0" maxOccurs="1" nillable="true"/>
              </sequence>
              </complexType>
              <complexType name="ObjectList">
              <sequence>
              <element name="item" type="IDSP:Object" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
              </sequence>
              </complexType>
              <complexType name="Field">
              <sequence>
              <element name="id" type="xsd:unsignedLong" minOccurs="1" maxOccurs="1"/>
              <element name="data" type="IDSP:Data" minOccurs="0" maxOccurs="1" nillable="true"/>
              </sequence>
              </complexType>
              <complexType name="Record">
              <sequence>
              <element name="item" type="IDSP:Field" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
              </sequence>
              </complexType>
              <!-- operation request element -->
              <element name="RunScript">
              <complexType>
              <sequence>
              <element name="runScriptParameters" type="IDSP:RunScriptParameters" minOccurs="0" maxOccurs="1" nillable="true"/>
              </sequence>
              </complexType>
              </element>
              <!-- operation response element -->
              <element name="RunScriptResponse">
              <complexType>
              <sequence>
              <element name="errorNumber" type="xsd:int" minOccurs="1" maxOccurs="1"/>
              <element name="errorString" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/>
              <element name="scriptResult" type="IDSP:Data" minOccurs="0" maxOccurs="1" nillable="true"/>
              </sequence>
              </complexType>
              </element>
              </schema>

              </types>

              <message name="RunScript">
              <part name="parameters" element="IDSP:RunScript"/>
              </message>

              <message name="RunScriptResponse">
              <part name="parameters" element="IDSP:RunScriptResponse"/>
              </message>

              <portType name="ServicePortType">
              <operation name="RunScript">
              <documentation>Service definition of function IDSP__RunScript</documentation>
              <input message="tns:RunScript"/>
              <output message="tns:RunScriptResponse"/>
              </operation>
              </portType>

              <binding name="Service" type="tns:ServicePortType">
              <SOAP:binding style="document" transport=" http://schemas.xmlsoap.org/soap/http"/>
              <operation name="RunScript">
              <SOAP:operation soapAction=""/>
              <input>
              <SOAP:body parts="parameters" use="literal"/>
              </input>
              <output>
              <SOAP:body parts="parameters" use="literal"/>
              </output>
              </operation>
              </binding>

              <service name="Service">
              <documentation>gSOAP 2.7.8c generated service definition</documentation>
              <port name="Service" binding="tns:Service">
              <SOAP:address location=" http://localhost:5000"/>
              </port>
              </service>

              </definitions>