6 Replies Latest reply: Jun 5, 2013 9:05 AM by Neeraj Sehgal RSS

    SOA Xsd Schema for Multiple Records return

    914684
      Hi,

      I want to pass Dept Id as input Parameter to wsdl and return Employee records for Name ,empno and job.
      Please help me in building xsd schema which can pass input request and response for Complex type which would return collection data.


      Thanks,
      Kiran
        • 1. Re: SOA Xsd Schema for Multiple Records return
          Neeraj Sehgal
          Hi Kiran,

          You can create the schema from the Jdeveloper itself or you can modify the default schema and add your elements to it. For your answer, following schema should work well.
          <?xml version="1.0" encoding="UTF-8"?>
          <schema attributeFormDefault="unqualified" elementFormDefault="qualified"
                  targetNamespace="http://xmlns.oracle.com/MyWork/EmployeeRecordsFromDB/FetchEmployees"
                  xmlns="http://www.w3.org/2001/XMLSchema">
           <element name="process">
            <complexType>
             <sequence>
              <element name="DeptId" type="string"/>
             </sequence>
            </complexType>
           </element>
           <element name="processResponse">
            <complexType>
             <sequence>
              <element name="Employees">
               <complexType>
                <sequence maxOccurs="unbounded">
                 <element name="Employee">
                  <complexType>
                   <sequence>
                    <element name="Name" type="string"/>
                    <element name="empNo" type="string"/>
                    <element name="job" type="string"/>
                   </sequence>
                  </complexType>
                 </element>
                </sequence>
               </complexType>
              </element>
             </sequence>
            </complexType>
           </element>
          </schema>
          Let us know how you get along.

          Regards,
          Neeraj Sehgal
          • 2. Re: SOA Xsd Schema for Multiple Records return
            914684
            Hi Neeraj,

            Thanks for reply. I will check and confirm.

            Thanks,
            Kiran
            • 3. Re: SOA Xsd Schema for Multiple Records return
              914684
              Hi Neeraj,

              Thanks for your reply.
              When i was creating mapping it was not giving option for each.
              How to return multiple records by passing DeptNo in this case ?

              Thanks,
              Kiran
              • 4. Re: SOA Xsd Schema for Multiple Records return
                1012057
                Hi Kiran ,

                I have created the same example with following WSDL and XSD,try it out it may help you.

                WSDL:

                <?xml version="1.0" encoding="UTF-8" standalone="no"?>
                <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/Test/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Test" targetNamespace="http://www.example.org/Test/">
                <wsdl:types>
                <xsd:schema targetNamespace="http://www.example.org/Test/">
                <xsd:element name="NewOperation">
                <xsd:complexType>
                <xsd:sequence>
                <xsd:element name="in" type="xsd:string"/>
                </xsd:sequence>
                </xsd:complexType>
                </xsd:element>
                <xsd:element name="NewOperationResponse">
                <xsd:complexType>
                <xsd:sequence>
                <xsd:element name="out" type="xsd:string"/>
                </xsd:sequence>
                </xsd:complexType>
                </xsd:element>
                </xsd:schema>
                </wsdl:types>
                <wsdl:message name="NewOperationRequest">
                <wsdl:part element="tns:NewOperation" name="parameters"/>
                </wsdl:message>
                <wsdl:message name="NewOperationResponse">
                <wsdl:part element="tns:NewOperationResponse" name="parameters"/>
                </wsdl:message>
                <wsdl:portType name="Test">
                <wsdl:operation name="NewOperation">
                <wsdl:input message="tns:NewOperationRequest"/>
                <wsdl:output message="tns:NewOperationResponse"/>
                </wsdl:operation>
                </wsdl:portType>
                <wsdl:binding name="TestSOAP" type="tns:Test">
                <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
                <wsdl:operation name="NewOperation">
                <soap:operation soapAction="http://www.example.org/Test/NewOperation"/>
                <wsdl:input>
                <soap:body use="literal"/>
                </wsdl:input>
                <wsdl:output>
                <soap:body use="literal"/>
                </wsdl:output>
                </wsdl:operation>
                </wsdl:binding>
                <wsdl:service name="Test">
                <wsdl:port binding="tns:TestSOAP" name="TestSOAP">
                <soap:address location="http://www.example.org/"/>
                </wsdl:port>
                </wsdl:service>
                </wsdl:definitions>
                ------------------------------

                XSD:

                <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                <xs:schema version="1.0" targetNamespace="http://test/" xmlns:tns="http://test/" xmlns:xs="http://www.w3.org/2001/XMLSchema">

                <xs:element name="id" type="tns:id"/>

                <xs:element name="idResponse" type="tns:idResponse"/>

                <xs:complexType name="id">
                <xs:sequence>
                <xs:element name="id" type="xs:int"/>
                </xs:sequence>
                </xs:complexType>

                <xs:complexType name="idResponse">
                <xs:sequence>
                <xs:element name="return" type="xs:string" minOccurs="0"/>
                </xs:sequence>
                </xs:complexType>
                </xs:schema>


                -----------------
                Thanks,
                Abhishek A.Amle
                • 5. Re: SOA Xsd Schema for Multiple Records return
                  veejai24
                  You can try this example to know how for-each works.

                  http://www.w3schools.com/xsl/xsl_for_each.asp


                  Thanks,
                  Vijay
                  • 6. Re: SOA Xsd Schema for Multiple Records return
                    Neeraj Sehgal
                    Hi Kiran,

                    You need to pass DeptId from the Input parameter and need to assign the output received from the DB to your output variable Employee using Transform Activity. In that you can use the for-each as under.
                      <xsl:template match="/">
                        <client:processResponse>
                          <client:Employees>
                            <xsl:for-each select="/top:EmployeesCollection/top:Employees">
                              <client:Employee>
                                <client:Name>
                                  <xsl:value-of select="top:firstName"/>
                                </client:Name>
                              </client:Employee>
                            </xsl:for-each>
                          </client:Employees>
                        </client:processResponse>
                      </xsl:template>
                    Regards,
                    Neeraj Sehgal