0 Replies Latest reply on Mar 4, 2008 8:45 AM by sdfqsdfqsdfqsdfs

    Calling SOAP web service

    sdfqsdfqsdfqsdfs
      Hi,

      I would like to be able to call an Axis 2 SOAP web service. This is my flex code :


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" horizontalAlign="left"
      mouseMove="onMouseMove(event)">
      <mx:WebService id="positionService"
      wsdl=" http://10.16.180.30:90/axis2/services/PositionService"
      useProxy="false" showBusyCursor="true" >
      <mx:operation name="sendPosition">
      <mx:request xmlns=" http://cao.sd.be">
      <name>{myName}</name>
      <xpos>{giMouseXLast}</xpos>
      <ypos>{giMouseYLast}</ypos>
      </mx:request>
      </mx:operation>
      </mx:WebService>


      <mx:Script><![CDATA[
      //tests mousedown to see if it is over Web Access button
      [Bindable]
      private var giMouseXLast:Number = 0;
      [Bindable]
      private var giMouseYLast:Number = 0;
      [Bindable]
      private var myName:String = "";
      [Bindable]
      private var position:String = "";

      //sets global variables when mouse moves
      private function onMouseMove(oEvent:Object):void
      {
      giMouseXLast = oEvent.target.mouseX;
      giMouseYLast = oEvent.target.mouseY;
      position = giMouseXLast + ", " + giMouseYLast;
      //ws call
      positionService.sendPosition.send();
      }
      private function setName():void
      {
      myName = myNameInputField.text;
      }
      ]]></mx:Script>

      <mx:Label id="lblCurMousePos0" text="Enter your name :" color="#FFFFFF" fontSize="18" y="10" x="10"/>
      <mx:TextInput id="myNameInputField" x="189" y="16"/>

      <mx:Button x="10" y="46" label="Submit" click="{setName()}"/>
      <mx:Label id="lblCurMousePos" text="{myName}'s current mouse position is {position}" color="#FFFFFF" fontSize="18"/>

      </mx:Application>


      It seems flex is sending HTTP GET request to my endpoint. This is this request in TCPMon :

      GET /axis2/services/PositionService HTTP/1.1
      Accept: */*
      Accept-Language: nl-BE
      Referer: file:///C:/Documents%20and%20Settings/jkpw297/My%20Documents/Flex%20Builder%202/CAO/bin/t est.swf
      x-flash-version: 9,0,115,0
      UA-CPU: x86
      Accept-Encoding: gzip, deflate
      User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322)
      Host: 127.0.0.1:90
      Connection: Keep-Alive


      Can somebody give me some clue to fix this problem.

      By the way. This is my WSDL :
      [code]
      <?xml version="1.0" encoding="UTF-8" ?>
      - <wsdl:definitions targetNamespace=" http://cao.sd.be" xmlns:mime=" http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http=" http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns=" http://cao.sd.be" xmlns:soap=" http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl=" http://schemas.xmlsoap.org/wsdl/">
      - <wsdl:types>
      - <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace=" http://cao.sd.be" xmlns:xs=" http://www.w3.org/2001/XMLSchema">
      - <xs:element name="sendPosition">
      - <xs:complexType>
      - <xs:sequence>
      <xs:element name="name" nillable="true" type="xs:string" />
      <xs:element name="xpos" nillable="true" type="xs:int" />
      <xs:element name="ypos" nillable="true" type="xs:int" />
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:schema>
      </wsdl:types>
      - <wsdl:message name="sendPositionMessage">
      <wsdl:part name="sendPosition" element="ns:sendPosition" />
      </wsdl:message>
      - <wsdl:portType name="PositionServicePortType">
      - <wsdl:operation name="sendPosition">
      <wsdl:input message="ns:sendPositionMessage" />
      </wsdl:operation>
      </wsdl:portType>
      - <wsdl:binding name="PositionServiceSOAP11Binding" type="ns:PositionServicePortType">
      <soap:binding style="document" transport=" http://schemas.xmlsoap.org/soap/http" />
      - <wsdl:operation name="sendPosition">
      <soap:operation soapAction="sendPosition" style="document" />
      - <wsdl:input>
      <soap:body parts="sendPosition" use="literal" />
      </wsdl:input>
      </wsdl:operation>
      </wsdl:binding>
      - <wsdl:service name="PositionService">
      - <wsdl:port name="PositionServiceSOAP11port" binding="ns:PositionServiceSOAP11Binding">
      <soap:address location=" http://10.16.180.30:8080/axis2/services/PositionService" />
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>

      [/code]