Wednesday, December 2, 2015

How to create a qualified WSDL

When we have to create a WSDL then it can be qualified or normal WSDL. There is only one property which defines the qualified WSDL or normal WSDL. For example, if we get a WSDL from the WSO2 DSS server it gives you a normal WSDL and the structure of the WSDL is as mention below.


Attribute in WSDL:

<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://shriwithjava.blogspot.co.nz/managerdetails/">

elementFormDefault can be qualified or unqualified.

Unqualified WSDL’s Structure:


If you see below WSDL image we have kept elementFormDefault as unqualified.



WSDL:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://shriwithjava.blogspot.co.nz/managerdetails/">
   <soapenv:Header/>
   <soapenv:Body>
      <man:ManagerDetailsRequest>
         <Id>?</Id>
         <Name>?</Name>
         <Address>?</Address>
         <Departments>
            <!--1 or more repetitions:-->
            <DepartmentDetails>
               <DepartmentName>?</DepartmentName>
               <NoOfPeople>?</NoOfPeople>
               <OfficeLocation>?</OfficeLocation>
            </DepartmentDetails>
         </Departments>
      </man:ManagerDetailsRequest>
   </soapenv:Body>
</soapenv:Envelope>

If you see the above example, namespace is coming only in operation but not in all elements.
If we create it as a qualified WSDL then WSDL will as below. Load this in SOAP UI, namespace will be there in all the elements.



Qualified WSDL’s Request Structure:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://shriwithjava.blogspot.co.nz/managerdetails/">
   <soapenv:Header/>
   <soapenv:Body>
      <man:ManagerDetailsRequest>
         <man:Id>?</man:Id>
         <man:Name>?</man:Name>
         <man:Address>?</man:Address>
         <man:Departments>
            <!--1 or more repetitions:-->
            <man:DepartmentDetails>
               <man:DepartmentName>?</man:DepartmentName>
               <man:NoOfPeople>?</man:NoOfPeople>
               <man:OfficeLocation>?</man:OfficeLocation>
            </man:DepartmentDetails>
         </man:Departments>
      </man:ManagerDetailsRequest>
   </soapenv:Body>
</soapenv:Envelope>