Issue Details (XML | Word | Printable)

Key: TUSCANY-1297
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Matthew Peters
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Tuscany

xsi:type in generated XML causes it not to validate/load into: visual studio or Mindreef SOAPscope

Created: 23/May/07 04:14 PM   Updated: 14/Jun/07 10:38 AM
Return to search
Component/s: C++ SDO
Affects Version/s: Cpp-Next
Fix Version/s: Cpp-Next

Time Tracking:
Not Specified

Environment: any

Resolution Date: 13/Jun/07 12:15 PM


 Description  « Hide
We use SDO to build and generate WSDL. We use the standard WSDL and SOAP schemas (schemata?) to build the model then add port, operation, binding etc. elements, then serialise the lot to XML. There are occasional xsi:type attributes in the serialised XML which cause the WSDL not to validate or load in visual studio. Here is a snippet from WSDL that we have generated in this way:

<binding name="Labnet_API_LabnetOnline_001_ImplementationBinding"
type="tns2:Labnet_API_LabnetOnline_001_ImplementationPortType">
    <operation name="getRestorations">
      <input>
        <tns3:body xsi:type="tns3:tBody" use="literal"/>
      </input>
      <output>
        <tns3:body xsi:type="tns3:tBody" use="literal"/>
      </output>

      <tns3:operation xsi:type="tns3:tOperation" soapAction=""/>
    </operation>
<tns3:binding xsi:type="tns3:tBinding"
transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
  </binding>

These xsi:type attributes cause this WSDL to fail to load. I quote one of our users:

> MS Visual Studio (I'm using Visual Web Dev 2005 Express Edition) will
> not import a SCA generated WSDL. It complains that it does not validate
> because of the following element attributes:

> xsi:type="tns3:tBody" of <tns3:body>
> xsi:type="tns3:tAddress" of <tns3:address>

> Stripping out these attributes resolved the VS WSDL import problem.

and a different bug report but the same problem:

> WSDL generated does not validate (ran against the oXygen editor and
Mindreef SOAPscope).

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Caroline Maynard made changes - 23/May/07 05:18 PM
Field Original Value New Value
Component/s C++ SDO [ 12310663 ]
Component/s C++ DAS [ 12311618 ]
Pete Robbins added a comment - 24/May/07 08:53 AM
Is it possible to post the complete document rather than the snippet? I assume tns3 is the wsdl/soap namespace? Is the xsi namespace defined in the document?

Matthew Peters added a comment - 24/May/07 09:26 AM
I can post one that shows the same problem that I just generated from one of our own components. You'll see that tns3 is the soap namespace and yes xsi is defined. If you want them you'll find the wsdl and soap xsd documents that we use at http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd and http://schemas.xmlsoap.org/wsdl/soap/2003-02-11.xsd

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns2="http://Greeting" xmlns:tns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns3="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="http://Greeting">
  <types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
      targetNamespace="http://Greeting"
      elementFormDefault="qualified">
      <xs:element name="greet">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="name" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>

      </xs:element>
      <xs:element name="greetResponse">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="greetReturn" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>

  </types>

  <message name="greetRequest">
    <part name="greetRequest" element="tns2:greet"/>
  </message>
  <message name="greetResponse">
    <part name="return" element="tns2:greetResponse"/>
  </message>
  <portType name="GreetingPortType">

    <operation name="greet">
      <input message="tns2:greetRequest"/>
      <output message="tns2:greetResponse"/>
    </operation>
  </portType>
  <binding name="GreetingBinding" type="tns2:GreetingPortType">
    <operation name="greet">
      <input>
        <tns3:body xsi:type="tns3:tBody" use="literal"/>

      </input>
      <output>
        <tns3:body xsi:type="tns3:tBody" use="literal"/>
      </output>
      <tns3:operation xsi:type="tns3:tOperation" soapAction=""/>
    </operation>
    <tns3:binding xsi:type="tns3:tBinding" transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
  </binding>
  <service name="GreetingService">

    <port name="GreetingPort" binding="tns2:GreetingBinding">
      <tns3:address xsi:type="tns3:tAddress" location="http://localhost/examples/SCA/helloworldscawsservice/Greeting.php"/>
    </port>
  </service>
</definitions>

<!-- this line identifies this file as WSDL generated by SCA for PHP. Do not remove -->

ant elder made changes - 25/May/07 07:09 AM
Fix Version/s Cpp-Next [ 12312266 ]
Matthew Peters added a comment - 11/Jun/07 04:24 PM
Actually I just found that the xsi:type is not the problem. Sorry to mislead you. It is the order in which the elements in the binding and operation elements come out: .

I just tried loading some SCA-generated WSDL using XERXES and got some
useful messages:

Error:
URI=file:///C:/Documents%20and%20Settings/Administrator/workspace/XML/Gr
eeting.wsdl Line=48: cvc-complex-type.2.4.a: Invalid content was found
starting with element 'tns3:operation'. One of
'{"http://schemas.xmlsoap.org/wsdl/":fault}' is expected.
Error:
URI=file:///C:/Documents%20and%20Settings/Administrator/workspace/XML/Gr
eeting.wsdl Line=50: cvc-complex-type.2.4.a: Invalid content was found
starting with element 'tns3:binding'. One of
'{"http://schemas.xmlsoap.org/wsdl/":operation}' is expected.

It dawned on me that this is to do with the order of the elements in the
WSDL. Because tOperation and so on inherit from tExtensibleDocumented,
it is allowable for them to have elements from other namespaces e.g.
from the soap namespace as we do, but the order is wrong. We are
generating:
  <binding name="GreetingBinding" type="tns2:GreetingPortType">
    <operation name="greet">
      <input>
        <tns3:body xsi:type="tns3:tBody" use="literal"/>

      </input>
      <output>
        <tns3:body xsi:type="tns3:tBody" use="literal"/>
      </output>
      <tns3:operation xsi:type="tns3:tOperation" soapAction=""/>
    </operation>
    <tns3:binding xsi:type="tns3:tBinding"
transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
  </binding>

which fails. The XML passes though if the elements from the soap
namespace come first:
  <binding name="GreetingBinding" type="tns2:GreetingPortType">
    <tns3:binding xsi:type="tns3:tBinding"
transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <operation name="greet">
      <tns3:operation xsi:type="tns3:tOperation" soapAction=""/>
      <input>
        <tns3:body xsi:type="tns3:tBody" use="literal"/>

      </input>
      <output>
        <tns3:body xsi:type="tns3:tBody" use="literal"/>
      </output>
    </operation>
  </binding>

Matthew Peters added a comment - 11/Jun/07 08:46 PM
I realise I have got a problem here - I raised the original JIRA with a title that presupposed what the problem was. Really the problem is that the WSDL will not validate with visual studio, soapscope, oXygen, or, I now discover, XERCES. There appear to be at least two problems:

xsi:type upsets visual studio

the order of the <tns3:xxxx elements upsets XERCES

I assume, though can't be sure, because I have not tried them, that soapscope and oXygten are upset by the second problem.

So there are two problems with the given WSDL. Are you okay with having them both in one JIRA or do you want it split into two?


Repository Revision Date User Message
ASF #546667 Tue Jun 12 23:26:38 UTC 2007 robbinspg TUSCANY-1297 Write open properties in "correct" place
This fix will write any open properties after the declared properties of the first Type in the
extension chain that is an Open Type, then the remaining declared properties.

This handles the case where a Type extends an Open type and is therefore implicitly open itself
but is not explicitly open, i.e. it has no "any" elements in schema terms. Any open properties
should be written before declared properties of the implicitly open type.

I also added some common namespace declarations so when serialising a wsdl document for example
you will now see soap:, wsdl: etc. instead of tns4:, tns5: etc.
Files Changed
MODIFY /incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp
MODIFY /incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp
MODIFY /incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h
MODIFY /incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.h

Pete Robbins added a comment - 12/Jun/07 11:37 PM
I have fixed the element ordering problem.

The writing of xsi:type is actually valid but unnecessary. I will look at another fix o try and prevent these being written

Repository Revision Date User Message
ASF #546760 Wed Jun 13 07:10:48 UTC 2007 robbinspg TUSCANY-1297 Do not write xsi:type information for global elements
Files Changed
MODIFY /incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp

Repository Revision Date User Message
ASF #546761 Wed Jun 13 07:12:18 UTC 2007 robbinspg TUSCANY-1297 Do not write xsi:type information for global elements
Files Changed
MODIFY /incubator/tuscany/cpp/sdo/runtime/core/test/loadload-output.txt

Pete Robbins made changes - 13/Jun/07 12:15 PM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Matthew Peters added a comment - 14/Jun/07 10:38 AM
I concur this is fixed. Thank you!

Matthew Peters made changes - 14/Jun/07 10:38 AM
Status Resolved [ 5 ] Closed [ 6 ]