0 Replies Latest reply on Feb 27, 2007 6:22 PM by JingZhe SHAN

    Cannot call WebService Method From Flex2

    JingZhe SHAN Level 1
      Currently I am using Axis2 to build a sample web service. This web service has two simple methods
      (1) print --- Print some string when every time you call it.
      (2) logInfo --- Store log in information into the database.
      I deployed this is web service in Tomcat6.0 and its two methods could be implemented by the Web Service Explorer.


      After above process, I wrote a meteringService.xmml file, which need to implement these two methods here is the code:
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:WebService id="Ms"
      wsdl=" http://localhost:8080/axis2/services/ServiceMetering?wsdl"
      service="ServiceMetering" port="ServiceMeteringSOAP11port_http">
      <mx:operation name="logInfo">
      <mx:request xmlns="">
      <userId>{userId.text}</userId>
      <serviceName>{serviceName.text}</serviceName>
      <serviceUrl>{serviceUrl.text}</serviceUrl>
      </mx:request>
      </mx:operation>
      <mx:operation name="print"></mx:operation>
      </mx:WebService>

      <mx:Panel x="34" y="41" width="366" height="306" layout="absolute" title="Metering Service Test Page">
      <mx:Label x="53" y="42" text="UserID"/>
      <mx:Label x="20" y="68" text="ServiceName"/>
      <mx:Label x="37" y="92" text="ServiceUrl"/>
      <mx:TextInput id="userId" x="104" y="40"/>
      <mx:TextInput id="serviceName" x="104" y="90"/>
      <mx:TextInput id="serviceUrl" x="104" y="66"/>
      <mx:Button x="199" y="120" label="Submit" click="Ms.logInfo.send()"/>
      <mx:Button x="273" y="120" label="print" click="Ms.print.send()"/>
      </mx:Panel>
      </mx:Application>

      But I always get error message:
      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at mx.rpc.soap::WSDLParser/ http://www.adobe.com/2006/flex/mx/internal::parseMessage()
      at mx.rpc.soap::WSDLOperation/parseMessages()
      at mx.rpc.soap::Operation/ http://www.adobe.com/2006/flex/mx/internal::invokePendingCall()
      at mx.rpc.soap::Operation/send()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.rpc.soap.mxml::Operation/send()
      at MeteringService_Flex/___Button1_click()

      This is the webService WSDL file:
      - <wsdl:definitions xmlns:axis2=" http://" xmlns:mime=" http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http=" http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns0=" http:///xsd" xmlns:soap12=" http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:ns1=" http://org.apache.axis2/xsd" xmlns:xs=" http://www.w3.org/2001/XMLSchema" xmlns:soap=" http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl=" http://schemas.xmlsoap.org/wsdl/" targetNamespace=" http://">
      <wsdl:documentation>Service Metering</wsdl:documentation>
      - <wsdl:types>
      - <xs:schema xmlns:ns=" http:///xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace=" http://xsd">
      - <xs:element name="logInfoFault">
      - <xs:complexType>
      - <xs:sequence>
      <xs:element name="logInfoFault" type="xs:anyType" />
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      - <xs:element name="logInfo">
      - <xs:complexType>
      - <xs:sequence>
      <xs:element name="userId" nillable="true" type="xs:string" />
      <xs:element name="serviceName" nillable="true" type="xs:string" />
      <xs:element name="serviceUrl" nillable="true" type="xs:string" />
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:schema>
      </wsdl:types>
      - <wsdl:message name="logInfoMessage">
      <wsdl:part name="part1" element="ns0:logInfo" />
      </wsdl:message>
      - <wsdl:message name="logInfoFault">
      <wsdl:part name="part1" element="ns0:logInfoFault" />
      </wsdl:message>
      <wsdl:message name="printMessage" />
      - <wsdl:portType name="ServiceMeteringPortType">
      - <wsdl:operation name="logInfo">
      <wsdl:input xmlns:wsaw=" http://www.w3.org/2006/05/addressing/wsdl" message="axis2:logInfoMessage" wsaw:Action="urn:logInfo" />
      <wsdl:fault message="axis2:logInfoFault" name="logInfoFault" />
      </wsdl:operation>
      - <wsdl:operation name="print">
      <wsdl:input xmlns:wsaw=" http://www.w3.org/2006/05/addressing/wsdl" message="axis2:printMessage" wsaw:Action="urn:print" />
      </wsdl:operation>
      </wsdl:portType>
      - <wsdl:binding name="ServiceMeteringSOAP11Binding" type="axis2:ServiceMeteringPortType">
      <soap:binding transport=" http://schemas.xmlsoap.org/soap/http" style="document" />
      - <wsdl:operation name="logInfo">
      <soap:operation soapAction="urn:logInfo" style="document" />
      - <wsdl:input>
      <soap:body use="literal" />
      </wsdl:input>
      - <wsdl:fault name="logInfoFault">
      <soap:body use="literal" />
      </wsdl:fault>
      </wsdl:operation>
      - <wsdl:operation name="print">
      <soap:operation soapAction="urn:print" style="document" />
      - <wsdl:input>
      <soap:body use="literal" />
      </wsdl:input>
      </wsdl:operation>
      </wsdl:binding>
      - <wsdl:binding name="ServiceMeteringSOAP12Binding" type="axis2:ServiceMeteringPortType">
      <soap12:binding transport=" http://schemas.xmlsoap.org/soap/http" style="document" />
      - <wsdl:operation name="logInfo">
      <soap12:operation soapAction="urn:logInfo" style="document" />
      - <wsdl:input>
      <soap12:body use="literal" />
      </wsdl:input>
      - <wsdl:fault name="logInfoFault">
      <soap12:fault use="literal" name="logInfoFault" />
      </wsdl:fault>
      </wsdl:operation>
      - <wsdl:operation name="print">
      <soap12:operation soapAction="urn:print" style="document" />
      - <wsdl:input>
      <soap12:body use="literal" />
      </wsdl:input>
      </wsdl:operation>
      </wsdl:binding>
      - <wsdl:binding name="ServiceMeteringHttpBinding" type="axis2:ServiceMeteringPortType">
      <http:binding verb="POST" />
      - <wsdl:operation name="logInfo">
      <http:operation location="logInfo" />
      - <wsdl:input>
      <mime:content type="text/xml" />
      </wsdl:input>
      </wsdl:operation>
      - <wsdl:operation name="print">
      <http:operation location="print" />
      - <wsdl:input>
      <mime:content type="text/xml" />
      </wsdl:input>
      </wsdl:operation>
      </wsdl:binding>
      - <wsdl:service name="ServiceMetering">
      - <wsdl:port name="ServiceMeteringSOAP11port_http" binding="axis2:ServiceMeteringSOAP11Binding">
      <soap:address location=" http://vadctm04:8080/axis2/services/ServiceMetering" />
      </wsdl:port>
      - <wsdl:port name="ServiceMeteringSOAP12port_http" binding="axis2:ServiceMeteringSOAP12Binding">
      <soap12:address location=" http://vadctm04:8080/axis2/services/ServiceMetering" />
      </wsdl:port>
      - <wsdl:port name="ServiceMeteringHttpport1" binding="axis2:ServiceMeteringHttpBinding">
      <http:address location=" http://vadctm04:8080/axis2/rest/ServiceMetering" />
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>

      I must did something wrong, who can point it plz.
      Thank you.