Unable to import binding

I

imonline

Hi,
I have created a WSDL file and now I am trying to create
server class from it using WSDL.exe. My WSDL is as follows:


<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:eek:ta="http://www.opentravel.org/OTA/2003/05"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.opentravel.org/OTA/2003/05"
name="HotelReservationService">
<!-- Define data types (import OTA schemas) -->
<wsdl:types>
<xs:schema targetNamespace
="http://www.opentravel.org/OTA/2003/05">
<xs:include schemaLocation="OTA_HotelResRQ.xsd"/>
</xs:schema>
<xs:schema targetNamespace
="http://www.opentravel.org/OTA/2003/05">
<xs:include schemaLocation="OTA_HotelResRS.xsd" />
</xs:schema>
</wsdl:types>
<!-- Define request and response messages-->
<wsdl:message name="HotelReservationRequest">
<wsdl:part name="parameters" element="ota:OTA_HotelResRQ"/>
</wsdl:message>
<wsdl:message name="HotelReservationResponse">
<wsdl:part name="parameters" element="ota:OTA_HotelResRS"/>
</wsdl:message>
<!-- Define operation and reference messages-->
<wsdl:portType name="HotelReservationPortType">
<wsdl:eek:peration name="OTA_HotelResRQ">
<wsdl:input message="ota:HotelReservationRequest"/>
<wsdl:eek:utput message="ota:HotelReservationResponse"/>
</wsdl:eek:peration>
</wsdl:portType>
<wsdl:binding name="HotelReservationBinding"
type="ota:HotelReservationPortType">
<!-- Use document style and not rpc-->
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:eek:peration name="OTA_HotelResRQ">
<!-- Use 'literal' to include OTA XML as-is-->
<soap:eek:peration soapAction="CreateReservation" style="document"/>
<wsdl:input>
<soap:body use="literal"
namespace="http://www.opentravel.org/OTA/2003/05"/>
</wsdl:input>
<wsdl:eek:utput>
<soap:body use="literal"
namespace="http://www.opentravel.org/OTA/2003/05"/>
</wsdl:eek:utput>
</wsdl:eek:peration>
</wsdl:binding>m
<!-- Define SOAP interface with previously declared binding-->
<wsdl:service name="OTAHotelReservationService">
<wsdl:port name="HotelReservationPort"
binding="ota:HotelReservationBinding">
<!-- Replace "http://mydomain/myservicename" with actual service
endpoint-->
<soap:address
location="http://localhost/Ota_Webservice/Service.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

And I am getting the following error for it:
Error: Unable to import binding 'HotelReservationBinding' from
namespace 'http:
/www.opentravel.org/OTA/2003/05'.
- Unable to import operation 'OTA_HotelResRQ'.
- The datatype
'http://www.opentravel.org/OTA/2003/05:HotelResRequestType' is
missing.

What am I doing wrong? Any help is highly
appreciated.


Thanks,
Nis
 
R

RYoung

Oh man, the OTA specs. I've been messing with these too. The problem is that
OTA_HotelResRQ.xsd <xs:include>s the OTA_CommonTypes.xsd and a couple
others. But the issue is that wsdl.exe is not handling the include
correctly. I doubt we would have this problem generating service code if the
<xs:import> were used, but then the OTA_CommonTypes.xsd would need a
targetNamespace, which it doesn't have. The Open Travel Alliance mention
that in their specs, they wanted to not tie the common type definitions to a
singular namespace, and allow other companies to integrate it with thier
systems.

Heres the MSDN KB on the issue: http://support.microsoft.com/kb/820122

I know the error in the KB does not match what you've got, but believe me
I've seen that error too, and I was working with OTA_PingRQ. I tried all
kinds of ways, couldn't get anything to work in XmlSpy either.

What I did get to work though is described here:
http://inkspotdev.com/wscf_ota/details.htm

If you want to try that out, you'll need to install the WSCF from
thinktecture.com:
http://www.thinktecture.com/Resources/Software/WSContractFirst/default.html

If you haven't used WSCF before, then I'd recommend going through the
walkthrough available on the site first - it's written very well.

But, as I mentioned, I did get it work using the flattened OTA schemas and
WSCF.

Ron
 
J

John Saunders

RYoung said:
Oh man, the OTA specs. I've been messing with these too. The problem is
that OTA_HotelResRQ.xsd <xs:include>s the OTA_CommonTypes.xsd and a couple
others. But the issue is that wsdl.exe is not handling the include
correctly. I doubt we would have this problem generating service code if
the <xs:import> were used, but then the OTA_CommonTypes.xsd would need a
targetNamespace, which it doesn't have. The Open Travel Alliance mention
that in their specs, they wanted to not tie the common type definitions to
a singular namespace, and allow other companies to integrate it with thier
systems.


I've never gotten wsdl.exe to properly handle includes. However, if you
specify the xsd file on the command line it will have the same effect.

John
 
R

RYoung

Yeah, that's where I've seen that error: xsd OTA_PingRQ.xsd /classes

Error - The attribute group OTA_PayloadStdAttributes is missing

and the following is from OTA_PingRQ.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.opentravel.org/OTA/2003/05"
elementFormDefault="qualified" version="1.004" id="OTA2006A"
xmlns="http://www.opentravel.org/OTA/2003/05"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="OTA_SimpleTypes.xsd"/>
<xs:include schemaLocation="OTA_CommonTypes.xsd"/>
<xs:include schemaLocation="OTA_AirCommonTypes.xsd"/>

where the OTA_PayloadStdAttributes is in OTA_CommonTypes.xsd I believe.

Too bad it won't work with includes, would have service development pretty
easy using Xml Spy and wsdl.exe. Heck, even if xsd.exe would work, I'd just
go ahead and code-first the web services.

Ron
 
J

John Saunders

RYoung said:
Yeah, that's where I've seen that error: xsd OTA_PingRQ.xsd /classes

Error - The attribute group OTA_PayloadStdAttributes is missing

and the following is from OTA_PingRQ.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.opentravel.org/OTA/2003/05"
elementFormDefault="qualified" version="1.004" id="OTA2006A"
xmlns="http://www.opentravel.org/OTA/2003/05"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="OTA_SimpleTypes.xsd"/>
<xs:include schemaLocation="OTA_CommonTypes.xsd"/>
<xs:include schemaLocation="OTA_AirCommonTypes.xsd"/>

where the OTA_PayloadStdAttributes is in OTA_CommonTypes.xsd I believe.

I mean that I use wsdl.exe and specify the wsdl file and all of the included
..xsd files on the command line.

Also, do you have "nested" attribute groups in there? I found a bug in
wsdl.exe in processing attribute groups which reference other attribute
groups. I had to "flatten" my attribute groups. Could that be your problem?

John
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top