You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by wupeng <wu...@capitel.com.cn> on 2006/08/10 09:15:19 UTC

some questions about the wsdl snippet

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="WeatherService"
   targetNamespace="http://www.ecerami.com/wsdl/WeatherService.wsdl" 
<http://www.ecerami.com/wsdl/WeatherService.wsdl%22>
   xmlns="http://schemas.xmlsoap.org/wsdl/" 
<http://schemas.xmlsoap.org/wsdl/%22>
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
<http://schemas.xmlsoap.org/wsdl/soap/%22>
   xmlns:tns="http://www.ecerami.com/wsdl/WeatherService.wsdl" 
<http://www.ecerami.com/wsdl/WeatherService.wsdl%22>
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
<http://www.w3.org/2001/XMLSchema%22%3E>

   <message name="getWeatherRequest">
      <part name="zipcode" type="xsd:string"/>
   </message>
   <message name="getWeatherResponse">
      <part name="temperature" type="xsd:int"/>
   </message>

   <portType name="Weather_PortType">
      <operation name="getWeather">
         <input message="tns:getWeatherRequest"/>
         <output message="tns:getWeatherResponse"/>
      </operation>
   </portType>
   
   <binding name="Weather_Binding" type="tns:Weather_PortType">
      <soap:binding style="rpc" 
         transport="http://schemas.xmlsoap.org/soap/http"/> 
<http://schemas.xmlsoap.org/soap/http%22/%3E>
      <operation name="getWeather">
         <soap:operation soapAction=""/>
         <input>
            <soap:body
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
<http://schemas.xmlsoap.org/soap/encoding/%22>
               namespace="urn:examples:weatherservice"
               use="encoded"/>
         </input>
         <output>
            <soap:body
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
<http://schemas.xmlsoap.org/soap/encoding/%22>
               namespace="urn:examples:weatherservice"
               use="encoded"/>
         </output>
      </operation>
   </binding>

   <service name="Weather_Service">
      <documentation>WSDL File for Weather Service</documentation>
      <port binding="tns:Weather_Binding" name="Weather_Port">
         <soap:address 
            location="http://localhost:8080/soap/servlet/rpcrouter"/> 
<http://localhost:8080/soap/servlet/rpcrouter%22/%3E>
      </port>
   </service>
</definitions>
1. targetNamespace="http://www.ecerami.com/wsdl/WeatherService.wsdl" 
<http://www.ecerami.com/wsdl/WeatherService.wsdl%22>

is this for the definition of namespace of the file?
if yes,why are we need that 
xmlns:tns="http://www.ecerami.com/wsdl/WeatherService.wsdl" 
<http://www.ecerami.com/wsdl/WeatherService.wsdl%22>?what's the 
effection of "tns"?

2.xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
<http://www.w3.org/2001/XMLSchema%22>
who verify the URI ?the parser of xml written by java?And when i should 
write 2001 or 1999 in the URI?

3.encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
<http://schemas.xmlsoap.org/soap/encoding/%22>
why should we write like this?shall we definit in the beginnig of the 
file?is there a parser to parse the sentence?what's the results?


Re: some questions about the wsdl snippet

Posted by Anne Thomas Manes <at...@gmail.com>.
Please see http://atmanes.blogspot.com/2006/07/short-explanation-of-xml-namespaces.html
for a short explanation of namespaces.

A namespace URI is just a name. It can but does not need to resolve to
a file. It must   conform to the requirements of a URI, as defined by
RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt). It's purpose is to
help you tell the difference between multiple
elements/attributes/types with the same name.

To answer your specific questions:

    1. targetNamespace="http://www.ecerami.com/wsdl/WeatherService.wsdl"
    is this for the definition of namespace of the file?
    if yes,why are we need that
    xmlns:tns="http://www.ecerami.com/wsdl/WeatherService.wsdl"?
    what's the effection of "tns"?

The "targetNamespace" attribute creates the namespace and specifies
that all entities defined in the WSDL belong to the namespace. It does
not specify a way to refer to this namespace from within the document.
The "xmlns:tns" attribute declares a namespace and specifies a way to
refer to namespace (via the "tns" prefix).

     2.xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     who verify the URI ?the parser of xml written by java?And when i should
     write 2001 or 1999 in the URI?

This is the namespace of the final version of the XML Schema
specification (http://www.w3.org/TR/xmlschema-1/). The 2000 and 1999
versions refer to pre-standard versions of XML Schema. You should not
use previous versions of XML Schema. Any applications that you might
have deployed that use a pre-standard version of XML Schema should be
upgraded to use the final standard. A parser typically does not verify
the URI, but anything that performs validation or data mapping will.

    3.encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    why should we write like this? shall we definit in the beginnig of the file?
    is there a parser to parse the sentence? what's the results?

The "encodingStyle" attribute specifies the name (a URI) of an
encoding style to be used to encode the RPC body. This attribute is
only used when the "use" attribute is specified as use="encoded". (The
SOAP spec says that you may use alternative encoding styles, therefore
you must specify the specific encoding style that you want used.)

In this case the name of the encoding style just happens to be the
same as the namespace for the SOAP Encoding type system, but this
attribute does not declare the namespace, nor can you replace this
attribute by declaring a namespace at the beginning of the file (or
anywhere else in the document). You don't need to declare that
namespace unless you need to reference an entity from the namespace.
For example, if your message part specified this:

   <message name="getWeatherRequest">
      <part name="zipcode" type="soapenc:string"/>
   </message>

then you would need to include a namespace declaration for the
"soapenc" namespace:

   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

Namespace declarations do not need to be specified at the beginning of
the file -- they just need to be in scope for the element that
references the namespace. For example, you could put the namespace
declaration within the message part:

   <message name="getWeatherRequest">
      <part name="zipcode" type="soapenc:string"
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"/>
   </message>

Anne

On 8/10/06, wupeng <wu...@capitel.com.cn> wrote:
>
>
>  <?xml version="1.0" encoding="UTF-8"?>
>
>
>  <definitions name="WeatherService"
>
> targetNamespace="http://www.ecerami.com/wsdl/WeatherService.wsdl"
>     xmlns="http://schemas.xmlsoap.org/wsdl/"
>     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>
> xmlns:tns="http://www.ecerami.com/wsdl/WeatherService.wsdl"
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
>     <message name="getWeatherRequest">
>        <part name="zipcode" type="xsd:string"/>
>     </message>
>     <message name="getWeatherResponse">
>        <part name="temperature" type="xsd:int"/>
>     </message>
>
>     <portType name="Weather_PortType">
>        <operation name="getWeather">
>           <input message="tns:getWeatherRequest"/>
>           <output message="tns:getWeatherResponse"/>
>        </operation>
>     </portType>
>
>     <binding name="Weather_Binding"
> type="tns:Weather_PortType">
>        <soap:binding style="rpc"
>
> transport="http://schemas.xmlsoap.org/soap/http"/>
>        <operation name="getWeather">
>           <soap:operation soapAction=""/>
>           <input>
>              <soap:body
>
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>                 namespace="urn:examples:weatherservice"
>                 use="encoded"/>
>           </input>
>           <output>
>              <soap:body
>
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>                 namespace="urn:examples:weatherservice"
>                 use="encoded"/>
>           </output>
>        </operation>
>     </binding>
>
>     <service name="Weather_Service">
>        <documentation>WSDL File for Weather
> Service</documentation>
>        <port binding="tns:Weather_Binding"
> name="Weather_Port">
>           <soap:address
>
> location="http://localhost:8080/soap/servlet/rpcrouter"/>
>        </port>
>     </service>
>  </definitions>
>  1.
> targetNamespace="http://www.ecerami.com/wsdl/WeatherService.wsdl"
>
>
> is this for the definition of namespace of the file?
>  if yes,why are we need that
> xmlns:tns="http://www.ecerami.com/wsdl/WeatherService.wsdl"?what's
> the effection of "tns"?
>
>  2.xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>  who verify the URI ?the parser of xml written by java?And when i should
> write 2001 or 1999 in the URI?
>
> 3.encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>  why should we write like this?shall we definit in the beginnig of the
> file?is there a parser to parse the sentence?what's the results?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org