locked
wsutil generating different code from wsdl file resulting in an error RRS feed

  • Question

  • Hi,

    I have a wsdl file that has a struct containing a count and a pointer (like an struct for arrays). A method gets ONE of these structs as a parameter. 

    When looking at the generated code, it looks like wsutil has "optimized" the call and I have to pass the count and the pointer directly (which both was inside a struct in the wsdl)

    If I do so it compiles, but I get a "serialization error" at runtime. The error message is in german (and I could not change it to english, VS and Win10 are set to english, I tried passing LANGID to both WS_ERROR and proxy instances. It's either german or no error message at all.)

    The HRESULT ist INVALID_PARAM and the message points to the struct param.

    I try to translate the error message: "A struct which can be inherited cannot be used within this context".

    I will try to post more details once I am back at my workplace. 

    What does this error mean? Does the generator create defective code? I took a look at all generated methods, and it looks like ALL "simple array like structs" get "optimized". And none of them actually work.

    Do I miss something? I am trying to get a hold of this for three days now and I am really stuck.

    regards

    Andi

    Tuesday, February 4, 2020 5:09 PM

All replies

  • Hello pettersson,

    Are you programming in C++? And are you developing win32 application using Windows Web Services API?

    >>>I have a wsdl file that has a struct containing a count and a pointer (like an struct for arrays). 

    Show how do you define it.

    >>>The HRESULT ist INVALID_PARAM and the message points to the struct param.

    Which function cause this error and how the parameter passed to?

    I can do a further investigation if you can show related code and exact error message.

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 5, 2020 2:04 AM
  • Hello Rita,

    I am using C++/VS2019/Win10 with WindowsWebServices. I am currently building a small sample to illustrate the problem, and which I will upload in a few minutes. It seems like it is a problem with "inherited parameter classes", are they not supported by WSW / wsutil?

    thanks a lot and regards

    pettersson

    Wednesday, February 5, 2020 6:31 AM
  • I could not find a way to attach a file, so here is the wsdl definition of my testcase:

    <?xml version="1.0" encoding="UTF-8" ?>
    <wsdl:definitions 
       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
       xmlns:xs="http://www.w3.org/2001/XMLSchema" 
       name="testcase" 
       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
       xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
       xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
       targetNamespace="testcase" 
       xmlns:tns="testcase" 
    >
       <wsdl:types>
          <xs:schema targetNamespace="testcase" elementFormDefault="qualified">
             <xs:complexType name="SomeDataType">
                <xs:sequence>
                   <xs:element name="some_string" type="xs:string">
                   </xs:element>
                   <xs:element name="some_int" type="xs:int">
                   </xs:element>
                   <xs:element name="some_bool" type="xs:boolean">
                   </xs:element>
                </xs:sequence>
             </xs:complexType>
             <xs:complexType name="SomeDataTypes">
                <xs:sequence>
                   <xs:element name="SomeDataType" minOccurs="0" maxOccurs="unbounded" type="tns:SomeDataType" />
                </xs:sequence>
             </xs:complexType>
             
       <xs:element name="TestCaseAPI___SomeCall">
          <xs:complexType>
             <xs:sequence>
                <xs:element name="symbolDatas" minOccurs="1" maxOccurs="1" type="tns:SomeDataTypes">
                   </xs:element>
                <xs:element name="some_string" minOccurs="1" maxOccurs="1" type="xs:string">
                   </xs:element>
                <xs:element name="some_int" minOccurs="1" maxOccurs="1" type="xs:int">
                   </xs:element>
             </xs:sequence>
          </xs:complexType>
       </xs:element>
       
          </xs:schema>
       </wsdl:types>
       <wsdl:message name="TestCaseAPI___SomeCallRequest">
          <wsdl:part name="parameters" element="tns:TestCaseAPI___SomeCall" />
       </wsdl:message>
       <wsdl:message name="TestCaseAPI___SomeCallResponse">
          
       </wsdl:message>
       <wsdl:portType name="TestCaseAPI">
          <wsdl:operation name="SomeCall">
          <wsdl:documentation>
          ...
          </wsdl:documentation>
             <wsdl:input message="tns:TestCaseAPI___SomeCallRequest" />
             <wsdl:output message="tns:TestCaseAPI___SomeCallResponse" />
          </wsdl:operation>
       </wsdl:portType>
       <wsdl:binding name="TestCaseAPIBinding" type="tns:TestCaseAPI">
          <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
             <wsdl:operation name="SomeCall">
                <soap:operation soapAction="urn:TestCaseAPI#SomeCall" style="document" />
                <wsdl:input>
                   <soap:body use="literal" />
                </wsdl:input>
                <wsdl:output>
                   <soap:body use="literal" />
                </wsdl:output>
             </wsdl:operation>
       </wsdl:binding>
       <wsdl:service name="TestCaseAPI">
          <wsdl:port name="TestCaseAPIPort" binding="tns:TestCaseAPIBinding">
             <soap:address location="https://localhost:47110?service=TestCaseAPI" />
          </wsdl:port>
       </wsdl:service>
    </wsdl:definitions>
    

    If I generate the code using wsutil, the 'SomeDataTypes' parameter gets "resolved" to use its content directly.

    Hope that helps to find the problem

    thanks in advance

    pettersson

    Wednesday, February 5, 2020 9:20 AM
  • And the error message is as follow:

    Serialisierungsfehler beim Schreiben eines Elements mit WS_WRITE_OPTION "1", Name "TestCaseAPI__SomeCall" und Namespace "testcase". 
    Error: Serialisierungsfehler beim Schreiben eines Felds mit WS_TYPE "26 (0x1A)", WS_FIELD_MAPPING "3", Name "symbolDatas" und Namespace "testcase".
    Error: Eine Struktur, die Ableitungen unterstützt, kann in diesem Kontext nicht verwendet werden.

    in English it should be something like:

    Serialization error when writing an element with WS_WRITE_OPTION "1", Name "TestCaseAPI__SomeCall" and Namespace "testcase".
    Error: Serialization error when writing a field with WS_TYPE "26 (0x1A)", WS_FIELD_MAPPING "3", Name "symbolDatas" and Namespace "testcase". 
    Error: A structure that supports resolutions, can not be used in this context.

    Wednesday, February 5, 2020 9:24 AM