By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,175 Members | 1,689 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,175 IT Pros & Developers. It's quick & easy.

Microsoft wsdl Utility fails when multiple <schema> tags reference same targetNamespace

P: n/a
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:operation 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:operation 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.

Nov 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Rather than changing wsdl.exe
how about if, at build time, you use a stream editor (sed, perl, awk) to
combine the multiple companion schema files into one ?

-Dino
"Jeff" <jo****@tampabay.rr.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
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:operation 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:operation 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.

Nov 23 '05 #2

P: n/a
Well, we thought about that and could introduce that into our process.
However we were hoping not to have to write and maintain that step. It
may be as simple as creating the proper XSLT transform, but we then
have to monitor the urls where we get the .wsdl, pull them as they
change and maintain a local copy with the fixes in them.

Not out of the question but we were hoping to get the vendors to tell
us where we might be able to get full interoperability without going
through those steps

Nov 23 '05 #3

P: n/a
Give this tool a try
http://www.gotdotnet.com/Workspaces/...f-94f705ca861e

Regards
Erymuzuan Mustapa

Jeff wrote:
Well, we thought about that and could introduce that into our process.
However we were hoping not to have to write and maintain that step. It
may be as simple as creating the proper XSLT transform, but we then
have to monitor the urls where we get the .wsdl, pull them as they
change and maintain a local copy with the fixes in them.

Not out of the question but we were hoping to get the vendors to tell
us where we might be able to get full interoperability without going
through those steps

Nov 23 '05 #4

P: n/a
I've been unable to make this link work this morning - is this project
still active?

Thank you - Jeff Odell

Nov 23 '05 #5

P: n/a
After further review, it appears that the practice of breaking up the Schema
in this way may fall outside the letter of the law for XML Schema.
Jeff, did you try using the appropriate includes, rather than using
duplicate schemas declarations?
This would give you the flexibility you want, but wouldn't go outside the
XML spec.

-D

"Jeff" <jo****@tampabay.rr.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I've been unable to make this link work this morning - is this project
still active?

Thank you - Jeff Odell

Nov 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.