Microsoft Visual Studio .Net unable to parse a BW generated WSDL, throws the following error:Type name='string' from targetNamespace='http://www.w3.org/2001/XMLSchema' cannot be used as top-level any element

Microsoft Visual Studio .Net unable to parse a BW generated WSDL, throws the following error:Type name='string' from targetNamespace='http://www.w3.org/2001/XMLSchema' cannot be used as top-level any element

book

Article ID: KB0090073

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Resolution:
When using Microsoft Visual Studio .Net to reference a BW generated WSDL, it throws the  following error:

Type name='string' from targetNamespace='http://www.w3.org/2001/XMLSchema' cannot be used as top-level any element

The reason is because:
In the BW generated WSDL, customer defined one of messages as:
    &ltwsdl:message name="HostRequest">
        &ltwsdl:part name="HostMsgRQ" type="xs:string"/>
    </wsdl:message>
Message part "HostMsgRQ" is a type of string. This should be OK according to WSDL specification. This WSDL passed the XMLspy validation too. But Visual Studio complains about this, it requires to define a wrapper element for the string, then reference the element in the message part.

After adding this line into the wsdl schema definition:
&ltxs:element name="HostMsgRQElement" type="xs:string"/>
Then change the message definition to:
    &ltwsdl:message name="HostRequest">
        &ltwsdl:part name="HostMsgRQ" element="ns1:HostMsgRQElement"/>
    </wsdl:message>
Visual Studio can reference the wsdl without problem.

KEYWORDS: Visual, Studio, .Net, WSDL

Issue/Introduction

Microsoft Visual Studio .Net unable to parse a BW generated WSDL, throws the following error:Type name='string' from targetNamespace='http://www.w3.org/2001/XMLSchema' cannot be used as top-level any element