aspose file tools*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes ws bb1.1: Explanation needed for examples Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "ws bb1.1: Explanation needed for examples" Watch "ws bb1.1: Explanation needed for examples" New topic
Author

ws bb1.1: Explanation needed for examples

m prabhu
Ranch Hand

Joined: Jan 29, 2008
Posts: 79
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
Rinku Singh
Ranch Hand

Joined: Apr 17, 2008
Posts: 31
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

Joined: Apr 17, 2008
Posts: 31
Prabhu .
Please let me know what do you think ?
m prabhu
Ranch Hand

Joined: Jan 29, 2008
Posts: 79
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
Chintan Rajyaguru
Ranch Hand

Joined: Aug 19, 2001
Posts: 341
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...


ChintanRajyaguru.com
SOADevelopment.com - Coming soon!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ws bb1.1: Explanation needed for examples