Showing posts with label form. Show all posts
Showing posts with label form. Show all posts

Saturday, April 4, 2015

Usage of elementFormDefault attribute of Schema tag

Learnings from Gora (amitagl27@gmail.com)

I was creating a WSDL in my project to generate contract first webservices. 

When I imported the WSDL in cordys, it gave me empty namespaces just after the attributes, i.e. it looked something like this :

<!--Cordys Input Structure-->

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP:Body>
    <CreateForeclosureProcess xmlns="http://schemas.bas.com/ext/IntakeProcessServices/">
      <CaseId xmlns="">PARAMETER</CaseId>
    </CreateForeclosureProcess>
  </SOAP:Body>
</SOAP:Envelope>

<!-- External Tool input Structure, Wizdler (https://chrome.google.com/webstore/detail/wizdler/oebpmncolmhiapingjaagmapififiakb?hl=en)-->

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <Body>
        <CreateForeclosureProcess xmlns="http://schemas.bas.com/ext/IntakeProcessServices/">
            <CaseId xmlns="">[string]</CaseId>
        </CreateForeclosureProcess>
    </Body>
</Envelope>

I did two things to remove these namespaces.

1. To remove from Cordys : Instead to having a direct element in my Request schema, I created a reference to another element.

Old :

<xsd:element name="CreateForeclosureProcess">
         <xsd:complexType>
          <xsd:sequence>
 <xsd:element  type="xsd:string" name="CaseId" />           
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>

Modified :

<xsd:element name="CreateForeclosureProcess">
         <xsd:complexType>
          <xsd:sequence>
 <xsd:element ref="tns:CaseId" />            
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
  
  <xsd:element  type="xsd:string" name="CaseId" />

 2. Even after doing this, the Wizdler plugin was still showing the empty namespace, then a little research on web gave me following link :

http://docs.intersystems.com/ens20082/csp/docbook/DocBook.UI.Page.cls?KEY=GSOP_service_fine_tuning

which suggested to add 

elementFormDefault='qualified'
to my schema tag as an attribute.

Example :
<xsd:schema targetNamespace="http://www.darkhorseboa.org/ThirdPartyUtilities/" elementFormDefault="qualified">