Microsoft wsdl Utility fails when multiple <schema> tags reference

J

Jeffrey Odell

We are using .Net and the wsdl Utility to generate proxies to consume web
services built using the BEA toolset.

The data architects on the BEA side create XML schemas with various entities
in separate files for ease of maintainability. These schemas are all part of
the same namespace.

When defining a web service that access more than one of these entities, the
wsdl file generated by BEA contains multiple schema elements with the same
targetNamespace attribute on them. This causes the Microsoft wsdl Utility to
fail with the following error message:

"A schema with the namespace 'http://data.offline.us.xxx.com' has already
been added."

where 'http://data.offline.us.xxx.com' is the namespace in the schema files.

If the multiple schema statements are combined into one, the wsdl utility
generates proxies correctly.

Has anyone run into this behavior before? Our goal would be to coax the
Microsoft wsdl Utility to accept the wsdl so we can continue to use the
automated tools on the BEA side and avoid any manual editing of wsdl to
consume them on the .Net side.

Attached below is a sample. Thanks in advance -

Jeff Odell

Here is the example with the multiple schemas:

<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:conv="http://www.openuri.org/2002/04/soap/conversation/"
xmlns:cw="http://www.openuri.org/2002/04/wsdl/conversation/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:jms="http://www.openuri.org/2002/04/wsdl/jms/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://www.openuri.org/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
targetNamespace="http://www.openuri.org/">
<types>
<s:schema xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:data="http://data.offline.us.xxx.com" elementFormDefault="qualified"
targetNamespace="http://www.openuri.org/">
<s:import namespace="http://data.offline.us.xxx.com"/>
<s:element name="putFlat1">
<s:complexType>
<s:sequence>
<s:element ref="data:SimpleFlat"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="putFlat1Response">
<s:complexType>
<s:sequence>
<s:element name="putFlat1Result" type="s:string" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="putFlat2">
<s:complexType>
<s:sequence>
<s:element ref="data:SimpleFlat2"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="putFlat2Response">
<s:complexType>
<s:sequence>
<s:element name="putFlat2Result" type="s:string" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
<!-- first schema -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://data.offline.us.xxx.com"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="SimpleFlat">
<xs:complexType>
<xs:sequence>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
<xs:element name="Date" type="xs:dateTime"/>
<xs:sequence maxOccurs="unbounded">
<xs:element name="Activity">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string"/>
<xs:element name="TimeSpent" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<!-- second schema -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://data.offline.us.xxx.com"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="SimpleFlat2">
<xs:complexType>
<xs:sequence>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
<xs:element name="Date" type="xs:dateTime"/>
<xs:sequence maxOccurs="unbounded">
<xs:element name="Activity">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string"/>
<xs:element name="TimeSpent" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

</types>
<message name="putFlat1SoapIn">
<part name="parameters" element="s0:putFlat1"/>
</message>
<message name="putFlat1SoapOut">
<part name="parameters" element="s0:putFlat1Response"/>
</message>
<message name="putFlat2SoapIn">
<part name="parameters" element="s0:putFlat2"/>
</message>
<message name="putFlat2SoapOut">
<part name="parameters" element="s0:putFlat2Response"/>
</message>
<portType name="TwoFlatsSoap">
<operation name="putFlat1">
<input message="s0:putFlat1SoapIn"/>
<output message="s0:putFlat1SoapOut"/>
</operation>
<operation name="putFlat2">
<input message="s0:putFlat2SoapIn"/>
<output message="s0:putFlat2SoapOut"/>
</operation>
</portType>
<binding name="TwoFlatsSoap" type="s0:TwoFlatsSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
<operation name="putFlat1">
<soap:eek:peration soapAction="http://www.openuri.org/putFlat1"
style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="putFlat2">
<soap:eek:peration soapAction="http://www.openuri.org/putFlat2"
style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="TwoFlats">
<port name="TwoFlatsSoap" binding="s0:TwoFlatsSoap">
<soap:address location="http://server:8501/EndPoints/TwoFlats.jws"/>
</port>
</service>
</definitions>

The schemas can be combined by removing the lines:

</xs:schema>
<!-- second schema -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://data.offline.us.xxx.com"
elementFormDefault="qualified" attributeFormDefault="unqualified">

This causes the utility to work.
 
D

Dino Chiesa [Microsoft]

see replies posted to the other newsgroup

Jeffrey Odell said:
We are using .Net and the wsdl Utility to generate proxies to consume web
services built using the BEA toolset.

The data architects on the BEA side create XML schemas with various
entities
in separate files for ease of maintainability. These schemas are all part
of
the same namespace.

When defining a web service that access more than one of these entities,
the
wsdl file generated by BEA contains multiple schema elements with the same
targetNamespace attribute on them. This causes the Microsoft wsdl Utility
to
fail with the following error message:

"A schema with the namespace 'http://data.offline.us.xxx.com' has already
been added."

where 'http://data.offline.us.xxx.com' is the namespace in the schema
files.

If the multiple schema statements are combined into one, the wsdl utility
generates proxies correctly.

Has anyone run into this behavior before? Our goal would be to coax the
Microsoft wsdl Utility to accept the wsdl so we can continue to use the
automated tools on the BEA side and avoid any manual editing of wsdl to
consume them on the .Net side.

Attached below is a sample. Thanks in advance -

Jeff Odell

Here is the example with the multiple schemas:

<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:conv="http://www.openuri.org/2002/04/soap/conversation/"
xmlns:cw="http://www.openuri.org/2002/04/wsdl/conversation/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:jms="http://www.openuri.org/2002/04/wsdl/jms/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://www.openuri.org/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
targetNamespace="http://www.openuri.org/">
<types>
<s:schema xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:data="http://data.offline.us.xxx.com" elementFormDefault="qualified"
targetNamespace="http://www.openuri.org/">
<s:import namespace="http://data.offline.us.xxx.com"/>
<s:element name="putFlat1">
<s:complexType>
<s:sequence>
<s:element ref="data:SimpleFlat"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="putFlat1Response">
<s:complexType>
<s:sequence>
<s:element name="putFlat1Result" type="s:string"
minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="putFlat2">
<s:complexType>
<s:sequence>
<s:element ref="data:SimpleFlat2"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="putFlat2Response">
<s:complexType>
<s:sequence>
<s:element name="putFlat2Result" type="s:string"
minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
<!-- first schema -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://data.offline.us.xxx.com"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="SimpleFlat">
<xs:complexType>
<xs:sequence>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
<xs:element name="Date" type="xs:dateTime"/>
<xs:sequence maxOccurs="unbounded">
<xs:element name="Activity">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string"/>
<xs:element name="TimeSpent" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<!-- second schema -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://data.offline.us.xxx.com"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="SimpleFlat2">
<xs:complexType>
<xs:sequence>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
<xs:element name="Date" type="xs:dateTime"/>
<xs:sequence maxOccurs="unbounded">
<xs:element name="Activity">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string"/>
<xs:element name="TimeSpent" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

</types>
<message name="putFlat1SoapIn">
<part name="parameters" element="s0:putFlat1"/>
</message>
<message name="putFlat1SoapOut">
<part name="parameters" element="s0:putFlat1Response"/>
</message>
<message name="putFlat2SoapIn">
<part name="parameters" element="s0:putFlat2"/>
</message>
<message name="putFlat2SoapOut">
<part name="parameters" element="s0:putFlat2Response"/>
</message>
<portType name="TwoFlatsSoap">
<operation name="putFlat1">
<input message="s0:putFlat1SoapIn"/>
<output message="s0:putFlat1SoapOut"/>
</operation>
<operation name="putFlat2">
<input message="s0:putFlat2SoapIn"/>
<output message="s0:putFlat2SoapOut"/>
</operation>
</portType>
<binding name="TwoFlatsSoap" type="s0:TwoFlatsSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
<operation name="putFlat1">
<soap:eek:peration soapAction="http://www.openuri.org/putFlat1"
style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="putFlat2">
<soap:eek:peration soapAction="http://www.openuri.org/putFlat2"
style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="TwoFlats">
<port name="TwoFlatsSoap" binding="s0:TwoFlatsSoap">
<soap:address location="http://server:8501/EndPoints/TwoFlats.jws"/>
</port>
</service>
</definitions>

The schemas can be combined by removing the lines:

</xs:schema>
<!-- second schema -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://data.offline.us.xxx.com"
elementFormDefault="qualified" attributeFormDefault="unqualified">

This causes the utility to work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top