• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ws bb1.1: Explanation needed for examples

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Please explain the what points the examples explain.i am not able to understand the following statements.


R2001 A DESCRIPTION MUST only use the WSDL "import" statement to import another WSDL description.

R2803 In a DESCRIPTION, the namespace attribute of the wsdl:import MUST NOT be a relative URI.

R2002 To import XML Schema Definitions, a DESCRIPTION MUST use the XML Schema "import" statement.

R2003 A DESCRIPTION MUST use the XML Schema "import" statement only within the xsd:schema element of the types section.

R2004 In a DESCRIPTION the schemaLocation attribute of an xsd:import element MUST NOT resolve to any document whose root element is not "schema" from the namespace "http://www.w3.org/2001/XMLSchema".



the following examples are given to explain the above rules.please explain me the below examples and they are related to which above rules.







regards,
prabhu
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Prabhu ,
Here is what i think are reasons:

INCORRECT: <definitions name="StockQuote" targetNamespace="http://example.com/stockquote/definitions" xmlns:xsd1="http://example.com/stockquote/schemas" ... xmlns="http://schemas.xmlsoap.org/wsdl/"> <import namespace="http://example.com/stockquote/schemas" location="http://example.com/stockquote/stockquote.xsd"/> <message name="GetLastTradePriceInput"> <part name="body" element="xsd1:TradePriceRequest"/> </message> ...</definitions>


Reason: The above code fragement is incorrect because of :
R2003 -> The xsd import statement here should be under types and not under definition tag of wsdl.




CORRECT: <definitions name="StockQuote" targetNamespace="http://example.com/stockquote/definitions" ... xmlns="http://schemas.xmlsoap.org/wsdl/"> <import namespace="http://example.com/stockquote/definitions" location="http://example.com/stockquote/stockquote.wsdl"/> <message name="GetLastTradePriceInput"> <part name="body" element="..."/> </message> ... </definitions>


Reason:The above code fragement is correct because of code:
R2001 -> The use of import in definition is to import another wsdl.



CORRECT: <definitions name="StockQuote" targetNamespace="http://example.com/stockquote/" xmlns:xsd1="http://example.com/stockquote/schemas" ... xmlns="http://schemas.xmlsoap.org/wsdl/"> <import namespace="http://example.com/stockquote/definitions" location="http://example.com/stockquote/stockquote.wsdl"/> <message name="GetLastTradePriceInput"> <part name="body" element="xsd1:TradePriceRequest"/> </message> ...</definitions>

Reason: The above code fragement is correct .Even thought it is using indirect schema specified by namespace xsd1.It is legal.

 
Rinku Singh
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prabhu .
Please let me know what do you think ?
 
m prabhu
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rinku,

first code fragment is incorrect because by using wsdl import we import schema.hence as per R2001 it is incorrect(as per my understanding..i 2 dont know my understanding is right or wrong)

second & third code fragment still no idea.

prabhu
 
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your question is little bit old so I don't know whether you are still looking for an answer but let me give one here anyway.

R2001 A DESCRIPTION MUST only use the WSDL "import" statement to import another WSDL description.


When you import a java class, you specify its fully qualified name (package name and class name). Similarly, when you import a wsdl file in another wsdl file, you have to specify the namespace attribute (like package name) and location. Since the value of the location attribute is just a string, theoretically, you can import any kind of file e.g. "http://example.com/mydoc.doc" Basic profile wants to prevent this and hence rule R2001, which says you can only import wsdl using the import statement. The first code fragment is wrong because it is importing a schema (xsd) as opposed to a wsdl.

Let's look at the second rule:

R2803 In a DESCRIPTION, the namespace attribute of the wsdl:import MUST NOT be a relative URI.


Do you remember how we typically insert images in an HTML page using <img src="images/myImage.gif">. Here "images/myImage.gif is a relative URI, which resolves to your website's absolute URL, something like www.example.com/images/myImage.gif. What rule R2803 is saying is that the namespace attribute in the import statement MUST NOT be a relative URI. It must be the absolute URI. All the code fragments you have posted correctly use namespace attribute so there is no incorrect example for this rule. The incorrect example only applies to R2001.

Let's look at the rest of the rules:

R2002 To import XML Schema Definitions, a DESCRIPTION MUST use the XML Schema "import" statement.

R2003 A DESCRIPTION MUST use the XML Schema "import" statement only within the xsd:schema element of the types section.

R2004 In a DESCRIPTION the schemaLocation attribute of an xsd:import element MUST NOT resolve to any document whose root element is not "schema" from the namespace "http://www.w3.org/2001/XMLSchema".



Look at the wsdl example here: http://coeservice.en.kku.ac.th:8080/TemperatureConvertor/TemperatureConvertorService?WSDL. The example imports a schema. Rule R2002 says if you want to import a schema, use the import tag defined in xsd schema as opposed to the import tag defines in wsdl. The example correctly uses xsd:import. Rule R2003 says the schema import statement must appear in xsd:schema element within wsdl types element. In the example, you can see


<types>
<xsd:schema>
<xsd:import namespace="http://temp.pkg/" schemaLocation="http://coeservice.en.kku.ac.th:8080/TemperatureConvertor/TemperatureConvertorService?xsd=1"/>
</xsd:schema>
</types>


which correctly follows rule 2003. Rule 2004 says, whatever you import this way must be an xml schema (it can't be a word doc etc. just like R2001 says you can only import a valid wsdl in another wsdl). How do you know you are importing a valid schema? The root element of the schema document being imported must belong to the namespace "http://www.w3.org/2001/XMLSchema"

Hope this helps...
reply
    Bookmark Topic Watch Topic
  • New Topic