Inline Schemas are a way of including the schema within a WSDL file rather than specifying that it be imported.
There are two ways of including a schema within a WSDL file.
Simple Dept Schema:
<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.dept.poc"
targetNamespace="http://www.dept.poc" elementFormDefault="qualified">
<xsd:element name="Process">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="DeptId" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ProcessRes">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="DeptName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
There are two ways of including a schema within a WSDL file.
- One way is to specify that it be imported; that is, the schema is a separate file. Its highly reusable.
- Another way, called inline schemas, is to include the schema inline with the file. Its only used in one WSDL file and to use in another WSDL, have to copy the inline schema from the existing WSDL file to the new WSDL file
Simple Dept Schema:
<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.dept.poc"
targetNamespace="http://www.dept.poc" elementFormDefault="qualified">
<xsd:element name="Process">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="DeptId" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ProcessRes">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="DeptName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
WSDL with imported xsd:
<?xml version= '1.0' encoding= 'UTF-8' ?>
<wsdl:definitions
name="getDept"
targetNamespace="http://xmlns.oracle.com/SOAApplication/PreferenceProject/getDept"
xmlns:tns="http://xmlns.oracle.com/SOAApplication/PreferenceProject/getDept"
xmlns:inp1="http://www.dept.poc"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://www.dept.poc" schemaLocation="../Schemas/Dept.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="requestMessage">
<wsdl:part name="payload" element="inp1:Process"/>
</wsdl:message>
<wsdl:message name="replyMessage">
<wsdl:part name="payload" element="inp1:ProcessRes"/>
</wsdl:message>
<wsdl:portType name="getDept_ptt">
<wsdl:operation name="getDept">
<wsdl:input message="tns:requestMessage"/>
<wsdl:output message="tns:replyMessage"/>
</wsdl:operation>
</wsdl:portType>
</wsdl:definitions>
We can modify from imported to inline schema following the steps:
- Add the target namespace of the XSD.
- Instead of import statement, use the schema elements inside schema element.
WSDL with inline schema:
<?xml version= '1.0' encoding= 'UTF-8' ?>
<wsdl:definitions name="getDept" targetNamespace="http://xmlns.oracle.com/SOAApplication/PreferenceProject/getDept"
xmlns:tns="http://xmlns.oracle.com/SOAApplication/PreferenceProject/getDept"
xmlns:inp1="http://www.dept.poc" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.dept.poc">
<xsd:element name="Process">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="DeptId" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ProcessRes">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="DeptName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="requestMessage">
<wsdl:part name="payload" element="inp1:Process"/>
</wsdl:message>
<wsdl:message name="replyMessage">
<wsdl:part name="payload" element="inp1:ProcessRes"/>
</wsdl:message>
<wsdl:portType name="getDept_ptt">
<wsdl:operation name="getDept">
<wsdl:input message="tns:requestMessage"/>
<wsdl:output message="tns:replyMessage"/>
</wsdl:operation>
</wsdl:portType>
</wsdl:definitions>
I have found great and massive information. Thanks for sharing
ReplyDeleteOracle Online Training
Oracle SOA Online Training Hyderabad
It 's an amazing and Thanks for sharing
ReplyDeleteLearn SOA Online
SOA Course Online