0 Replies Latest reply on Sep 13, 2007 11:09 AM by Sanjay_Sarma

    Help with WebService deployed on Oracle (oc4j)

    Sanjay_Sarma
      I have created a PL/SQL web service on the oracle side. and deployed it on the OC$J stand alone server.

      The WSDL definition looks like this:
      ----
      <?xml version="1.0" encoding="UTF-8" ?>
      <definitions
      name="MyWebService1"
      targetNamespace=" http://hrconn/MyWebService1.wsdl"
      xmlns=" http://schemas.xmlsoap.org/wsdl/"
      xmlns:tns=" http://hrconn/MyWebService1.wsdl"
      xmlns:mime=" http://schemas.xmlsoap.org/wsdl/mime/"
      xmlns:soap12=" http://schemas.xmlsoap.org/wsdl/soap12/"
      xmlns:tns0=" http://hrconn/MyWebService1.wsdl/types/"
      xmlns:xsd=" http://www.w3.org/2001/XMLSchema"
      xmlns:soap=" http://schemas.xmlsoap.org/wsdl/soap/"
      >
      <types>
      <schema xmlns=" http://www.w3.org/2001/XMLSchema" targetNamespace=" http://hrconn/MyWebService1.wsdl/types/"
      elementFormDefault="qualified" xmlns:tns=" http://hrconn/MyWebService1.wsdl/types/"
      xmlns:wsdl=" http://schemas.xmlsoap.org/wsdl/" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
      xmlns:soap11-enc=" http://schemas.xmlsoap.org/soap/encoding/">
      <element name="getEmpElement">
      <complexType>
      <sequence>
      <element name="empNo" type="decimal" nillable="true"/>
      </sequence>
      </complexType>
      </element>
      <element name="getEmpResponseElement">
      <complexType>
      <sequence>
      <element name="result" type="tns:EmpRecUser" nillable="true"/>
      </sequence>
      </complexType>
      </element>
      <complexType name="EmpRecUser">
      <complexContent>
      <extension base="tns:EmpRecBase">
      <sequence>
      <element name="departmentId" type="decimal" nillable="true"/>
      <element name="managerId" type="decimal" nillable="true"/>
      <element name="hireDate" type="dateTime" nillable="true"/>
      <element name="jobId" type="string" nillable="true"/>
      <element name="employeeId" type="decimal" nillable="true"/>
      <element name="commissionPct" type="decimal" nillable="true"/>
      <element name="salary" type="decimal" nillable="true"/>
      <element name="lastName" type="string" nillable="true"/>
      </sequence>
      </extension>
      </complexContent>
      </complexType>
      <complexType name="EmpRecBase">
      <sequence/>
      </complexType>
      </schema>
      </types>
      <message name="MyWebService1_getEmp">
      <part name="parameters" element="tns0:getEmpElement"/>
      </message>
      <message name="MyWebService1_getEmpResponse">
      <part name="parameters" element="tns0:getEmpResponseElement"/>
      </message>
      <portType name="MyWebService1">
      <operation name="getEmp">
      <input message="tns:MyWebService1_getEmp"/>
      <output message="tns:MyWebService1_getEmpResponse"/>
      </operation>
      </portType>
      <binding name="MyWebService1SoapHttp" type="tns:MyWebService1">
      <soap:binding style="document" transport=" http://schemas.xmlsoap.org/soap/http"/>
      <operation name="getEmp">
      <soap:operation soapAction=" http://hrconn/MyWebService1.wsdl/getEmp"/>
      <input>
      <soap:body use="literal"/>
      </input>
      <output>
      <soap:body use="literal"/>
      </output>
      </operation>
      </binding>
      <service name="MyWebService1">
      <port name="MyWebService1SoapHttpPort" binding="tns:MyWebService1SoapHttp">
      <soap:address location=" http://localhost:8888/PL_SQL_WS-GetEmployee-context-root/MyWebService1SoapHttpPort"/>
      </port>
      </service>
      </definitions>
      ----
      The method is getEmp.
      It requires one parameter called empNo.

      The parameter form in xml source for entering the parameter looks like this(in the tester):
      ---
      <soap:Envelope xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body xmlns:ns1=" http://hrconn/MyWebService1.wsdl/types/">
      <ns1:getEmpElement>
      <ns1:empNo>100</ns1:empNo>
      </ns1:getEmpElement>
      </soap:Body>
      </soap:Envelope>
      ---

      The formatted XML from the tester with data looks like this:
      ---
      <env:Envelope
      xmlns:env=" http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd=" http://www.w3.org/2001/XMLSchema"
      xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
      xmlns:ns0=" http://hrconn/MyWebService1.wsdl/types/">
      <env:Body>
      <ns0:getEmpResponseElement>
      <ns0:result
      xsi:type="ns0:EmpRecUser">
      <ns0:departmentId>90</ns0:departmentId>
      <ns0:managerId xsi:nil="1"/>
      <ns0:hireDate>1987-06-17T00:00:00.000-07:00</ns0:hireDate>
      <ns0:jobId>AD_PRES</ns0:jobId>
      <ns0:employeeId>100</ns0:employeeId>
      <ns0:commissionPct xsi:nil="1"/>
      <ns0:salary>24000</ns0:salary>
      <ns0:lastName>King</ns0:lastName>
      </ns0:result>
      </ns0:getEmpResponseElement>
      </env:Body>
      </env:Envelope>
      ---

      My mxml file looks like this:
      ----
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="MyWebService1.getEmp.send()">
      <mx:WebService id="MyWebService1"
      wsdl=" http://localhost:8888/PL_SQL_WS-GetEmployee-context-root/MyWebService1SoapHttpPort?WSDL"
      useProxy="false">

      <mx:operation name="getEmp">
      <mx:request>

      <getEmpElement>
      <empNo>{cbxEmpNo.value}</empNo>
      </getEmpElement>

      </mx:request>
      </mx:operation>
      </mx:WebService>
      <mx:Panel x="10" y="10" width="475" height="400" layout="absolute" title="Employee Details ">
      <mx:ComboBox x="30" y="25" id="cbxEmpNo" change="MyWebService1.getEmp.send()">
      <mx:Object label="100" data="100"/>
      <mx:Object label="120" data="120"/>
      <mx:Object label="200" data="200"/>
      </mx:ComboBox>
      <mx:DataGrid x="30" y="75" id="dgEmpData" width="400" dataProvider="{MyWebService1.getEmp.result}">
      <mx:columns>
      <mx:DataGridColumn headerText="Last Name" dataField="lastName"/>
      <mx:DataGridColumn headerText="Salary" dataField="salary" width="75"/>
      </mx:columns>
      </mx:DataGrid>
      </mx:Panel>
      </mx:Application>
      ----

      Please let me know if I am making a mistake or missing something.

      Note: I am not using/running Flex data services, so that service is down.
      The standalnoe OC4J server is up.

      Is there any proxy setting that needs to be done.

      Any help would be appreciated.