1 Reply Latest reply on Nov 16, 2006 9:08 AM by dgfkhgglhjgjhf

    Passing abstract complexTypes into web services... ERRORs galore!

      Hi everyone,

      I've been working for a couple weeks on integrating with Cognos ReportNet using their web services. It is literally driving me insane. I am able to successfully authenticate myself with Cognos, retrieve object listings, and even run reports... but I am constantly getting hit with this problem.

      The error message I get is this:
      Unable to create web service argument class com.cognos.developer.schemas.bibus._2.RunOption. Error: java.lang.InstantiationException. Often this is because the web service defines an abstract complexType as an input to an operation. You must create an actual instance of this type in Java.

      Here is my ColdFusion code:
      <cfset arrParamVals = ArrayNew(1)>
      <cfset arrRunOption = ArrayNew(1)>
      <cfset arrRunOption[1] = StructNew()>
      <cfset arrRunOption[1].name = "saveOutput">
      <cfset arrRunOption[1].value = false>

      <cfset retConv = this.cognosWS.execute(sReportName, arrParamVals, arrRunOption)>

      (sReportName is a passed-in string)

      Here are the appropriate snippets from the WSDL:

      - <wsdl:operation name="execute">
      <wsdl:input name="execute_1" message="tns:execute_1_Request" />
      <wsdl:output name="execute_1" message="tns:execute_1_Reply" />

      - <wsdl:message name="execute_1_Request">
      <wsdl:part name="obj" type="xs:string" />
      <wsdl:part name="parameters" type="tns:parameterValueArray" />
      <wsdl:part name="options" type="tns:runOptionArray" />

      - <xs:complexType name="runOption" abstract="true">
      - <xs:all>
      <xs:element name="name" type="tns:runOptionEnum" />

      - <xs:complexType name="runOptionBoolean">
      - <xs:complexContent>
      - <xs:extension base="tns:runOption">
      - <xs:all>
      <xs:element name="value" type="xs:boolean" />

      - <xs:complexType name="runOptionArray">
      - <xs:complexContent>
      - <xs:restriction base="SOAP-ENC:Array">
      <xs:attribute wsdl:arrayType="tns:runOption[]" ref="SOAP-ENC:arrayType" />

      Basically, the sample code that Cognos provides (in ASP, not CF) declares instances of the RunOptionBoolean class and passes in an array of those - so that is why I am setting a name and a value parameter.

      I have encountered this error again with another method... it is the same situation... the method expects an array of a complex datatype defined as 'abstract'... and even when I create a structure with all the parameters of the base class OR all the parameters of the base class plus additional parameters of the derived class... BOTH times I get this error.

      Can ANYONE help me out with this??????? Pleeeease!!