Re: <types> <schema/> <schema/> question

Thanks.
r

Anne Thomas Manes wrote:

> I would not recommend defining a different namespace for each message 
> unless the element names within the messages are the same and you need 
> a way to distinguish them. A namespace is just a tool to help 
> you distinguish things with the same name. For example, you might have 
> two different elements called foo:
>  
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>    targetNamespace="urn:foo.one">
>    <xsd:element name="foo" type="xsd:string"/> 
> </xsd:schema>
>  
> and
>  
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>    targetNamespace="urn:foo.two">
>    <element name="foo" type="xsd:float"/>
> </xsd:schema>
>  
> Obviously these are different elements, but if you don't use a 
> namespace qualifier, you can't tell them apart.
>  
> <wsdl:definitions xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/
>    xmlns:one="urn:foo.one"
>    xmlns:two="urn:foo.two">
> <wsdl:message name="fooMessage">
>   <wsdl:part name="one" element="one:foo"/>
>   <wsdl:part name="two" element="two:foo"/>
> </wsdl:message>
>  
> As long as you don't having naming conflicts, it's quite reasonable to 
> put all of your definitions (both schema and wsdl) in the same 
> namespace. But a lot of people like to define a different namespace 
> for each part of the defintion (one for your <types> (e.g, types:), 
> one for your <message>s and <portType>s (e.g., intf:), and one for 
> your <binding>s and <service> (e.g., impl:)). All approaches are valid.
>  
> You can't define different namespaces for each operation, because 
> <operation> is a child of <portType> and you can only define a 
> targetNamespace at the <definitions> level. (But you could define a 
> different namespace for each <portType> if you really want to.) I 
> wouldn't recommend it, though, unless you want to use the same name 
> for different portTypes. Operations must have unique names within a 
> portType, but you may use the same operation name in different 
> portTypes in the same namespace.
>  
> Anne
>
>     ----- Original Message -----
>     From: remko de knikker <mailto:remko.deknikker@yale.edu>
>     To: Anne Thomas Manes <mailto:anne@manes.net>
>     Sent: Wednesday, July 09, 2003 2:30 PM
>     Subject: Re: <types> <schema/> <schema/> question
>
>     Thanks, Anne, that makes sense. wsdl.exe indeed complained about
>     the namespaces being the same for both schema's within the
>     <wsdl:types>. The fact that both methods are allowed actually
>     confused me, but if they're both legal it's solved.
>     PS:
>     Is it good custom to
>     define a namespace for each message?
>     or for each wer service operation?
>     or per web service?
>     per group of services?
>     per ...
>
>     r
>
>     Anne Thomas Manes wrote:
>
>>     Remko,
>>      
>>     Both examples should work. You should be able to define any
>>     number of <xds:schema> elements within a <wsdl:types> element,
>>     although since you are using the same targetNamespace, it doesn't
>>     really make sense to decribe them using two different schemas. I
>>     would suggest that you define both elements in the same
>>     <xsd:schema> element (it's more efficient).
>>      
>>     <wsdl:types> doesn't prescribe how to define your types. You need
>>     to use a type description system, such as XML Schema or RELAX
>>     TNG. Of course -- most WSDL compilers only support XML Schema, so
>>     that's the general convention. If you use XML Schema, then your
>>     type definitions must obey the rules of XML Schema. You can
>>     define any number of elements or types within a single <schema>
>>     element.
>>      
>>     As with a <wsdl:definitions> element, a <xsd:schema> document
>>     creates a namespace, or it can adds its definitions to an
>>     existing namespace. A schema or WSDL compiler shouldn't object to
>>     you using the same targetNamespace in multiple <xsd:schema> or
>>     <wsdl:definitions> documents.
>>      
>>     It sounds as if wsdl.exe is a bit over-sensitive about the schema
>>     description. Can you tell me what error you get from it when you
>>     try to compile the second example?
>>      
>>     Anne
>>
>>         ----- Original Message -----
>>         From: remko de knikker <mailto:remko.deknikker@yale.edu>
>>         To: www-ws-desc@w3.org <mailto:www-ws-desc@w3.org>
>>         Sent: Wednesday, July 09, 2003 1:51 PM
>>         Subject: <types> <schema/> <schema/> question
>>
>>         I am a little bit confused on how to use the <schema> tag in
>>         the wsdl's <types>
>>
>>         I have seen examples that use 2 schema-tags, one for the
>>         RequestMessage and one for the ResponseMessage, and I have
>>         seen examples, where Request and Response element are both a
>>         child of the schema-tag. Can some one tell me what the
>>         correct way of defining my request and response message is??
>>
>>         NB: WSDL2Java does not complain about the following, and does
>>         not complain if I put 2 schema-tags in there. But wsdl.exe
>>         insists I define it as below.
>>
>>         <wsdl:types>
>>
>>         <xsd:schema
>>         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>         xmlns:tns="http://biryani.med.yale.edu:8081/axis/services/GetXSLIM"
>>         targetNamespace="http://biryani.med.yale.edu:8081/axis/services/GetXSLIM"
>>         >
>>
>>         <xsd:element name="method2Request">
>>           <xsd:complexType>
>>             <xsd:sequence>
>>                 <xsd:element name="cid" type="xsd:string"/>
>>               </xsd:sequence>
>>         </xsd:complexType>
>>         </xsd:element>
>>
>>         <xsd:element name="method2Response">
>>           <xsd:complexType>
>>             <xsd:sequence>
>>                 <xsd:any minOccurs="0"/>
>>               </xsd:sequence>
>>         </xsd:complexType>
>>         </xsd:element>
>>
>>         </xsd:schema>
>>
>>         </wsdl:types>
>>
>>
>>         OR??
>>
>>
>>         <wsdl:types>
>>
>>         <xsd:schema
>>         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>         xmlns:tns="http://biryani.med.yale.edu:8081/axis/services/GetXSLIM"
>>         targetNamespace="http://biryani.med.yale.edu:8081/axis/services/GetXSLIM"
>>         >
>>         <xsd:element name="method2Request">
>>           <xsd:complexType>
>>             <xsd:sequence>
>>                 <xsd:element name="cid" type="xsd:string"/>
>>               </xsd:sequence>
>>         </xsd:complexType>
>>         </xsd:element>
>>         </xsd:schema>
>>
>>         <xsd:schema
>>         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>         xmlns:tns="http://biryani.med.yale.edu:8081/axis/services/GetXSLIM"
>>         targetNamespace="http://biryani.med.yale.edu:8081/axis/services/GetXSLIM"
>>         >
>>         <xsd:element name="method2Response">
>>           <xsd:complexType>
>>             <xsd:sequence>
>>                 <xsd:any minOccurs="0"/>
>>               </xsd:sequence>
>>         </xsd:complexType>
>>         </xsd:element>
>>
>>         </xsd:schema>
>>
>>         </wsdl:types>
>>
>

Received on Thursday, 10 July 2003 09:14:47 UTC