Hello,
I want to reuse some common xsd definitions in different wsdl. Therefore
I try to import an "external" xsd into my wsdl as follows:
=====
(1) My wsdl:
=====
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="HelloService"
targetNamespace="http://www.ecerami.com/wsdl/HelloService.wsdl
<http://www.ecerami.com/wsdl/HelloService.wsdl> "
xmlns="http://schemas.xmlsoap.org/wsdl/
<http://schemas.xmlsoap.org/wsdl/> "
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/
<http://schemas.xmlsoap.org/wsdl/soap/> "
xmlns:tns="http://www.ecerami.com/wsdl/HelloService.wsdl
<http://www.ecerami.com/wsdl/HelloService.wsdl> "
xmlns:xsd="http://www.w3.org/2001/XMLSchema
<http://www.w3.org/2001/XMLSchema> "
xmlns:stock="http://example.com/stockquote.xsd
<http://example.com/stockquote.xsd> "
xmlns:listing3="urn:listing3">
<types>
<xsd:schema targetNamespace="http://example.com/stockquote.xsd
<http://example.com/stockquote.xsd> "
xmlns:xsd="http://www.w3.org/2001/XMLSchema
<http://www.w3.org/2001/XMLSchema> " xmlns:listing3="urn:listing3">
<xsd:import namespace="urn:listing3"
schemaLocation="amis_types_ok.xsd"/>
<xsd:complexType name="int_commModule">
<xsd:sequence>
<xsd:element name="concentrator" type="listing3:phone"/>
<xsd:element name="equipment" type="xsd:int" minOccurs="0"/>
<xsd:element name="unit" type="xsd:int" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<message name="SayHelloRequest">
<part name="firstName" type="xsd:string"/>
</message>
<message name="SayHelloResponse">
<part name="greeting" type="xsd:string"/>
</message>
<portType name="Hello_PortType">
<operation name="sayHello">
<input message="tns:SayHelloRequest"/>
<output message="tns:SayHelloResponse"/>
</operation>
</portType>
<binding name="Hello_Binding" type="tns:Hello_PortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/
<http://schemas.xmlsoap.org/soap/http"/> >
<operation name="sayHello">
<soap:operation soapAction="sayHello"/>
<input>
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/
<http://schemas.xmlsoap.org/soap/encoding/> "
namespace="urn:examples:helloservice"
use="encoded"/>
</input>
<output>
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/
<http://schemas.xmlsoap.org/soap/encoding/> "
namespace="urn:examples:helloservice"
use="encoded"/>
</output>
</operation>
</binding>
<service name="Hello_Service">
<documentation>WSDL File for HelloService</documentation>
<port binding="tns:Hello_Binding" name="Hello_Port">
<soap:address
location="http://localhost:8080/soap/servlet/rpcrouter"/
<http://localhost:8080/soap/servlet/rpcrouter"/> >
</port>
</service>
</definitions>
=====
(2) imported file
=====
The File amis_types_ok.xsd is in the same directory:
<?xml version="1.0" ?>
<xsd:schema targetNamespace="urn:listing3"
xmlns:xsd="http://www.w3.org/2001/XMLSchema
<http://www.w3.org/2001/XMLSchema> ">
<xsd:import namespace="http://www.w3.org/2001/XMLSchema"/
<http://www.w3.org/2001/XMLSchema"/> >
<xsd:complexType name="Phone">
<xsd:sequence>
<xsd:element name="areaCode" type="xsd:int"/>
<xsd:element name="exchange" type="xsd:int"/>
<xsd:element name="number" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
=====
(3) result of wsdl2h:
=====
When compiling with wsdl2h I get:
D:\soap\example2>wsdl2h -c -v command.wsdl
** The gSOAP WSDL parser for C and C++ 1.2.12
** Copyright (C) 2000-2008 Robert van Engelen, Genivia Inc.
** All Rights Reserved. This product is provided "as is", without any
warranty.
** The gSOAP WSDL parser is released under one of the following two
licenses:
** GPL or the commercial license by Genivia Inc. Use option -l for more
info.
Saving command.h
Cannot open file 'typemap.dat'
Problem reading type map file 'typemap.dat'.
Using internal type definitions for C instead.
Opening WSDL/XSD 'command.wsdl' from ''
Reading file 'command.wsdl'... Preprocessing wsdl definitions
http://www.ecerami.com/wsdl/HelloService.wsdl
<http://www.ecerami.com/wsdl/HelloService.wsdl>
Preprocessing wsdl types
Preprocessing schema http://example.com/stockquote.xsd
<http://example.com/stockquote.xsd> import urn:listing3
Opening schema 'amis_types_ok.xsd' from 'command.wsdl'
Reading schema file 'amis_types_ok.xsd'...
An error occurred while parsing schema from 'amis_types_ok.xsd'
Error 3 fault: SOAP-ENV:Client [no subcode]
"Validation constraint violation: tag name or namespace mismatch in
element <x>"
Detail: [no detail]
â <>
<!-- ** HERE ** -->
D:\soap\example2>
=====
=====
Does anybody know what could be my problem ???
Thanks in advance for thinking about my problem!
Michael