×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Feb 2010
    Posts
    157

    Question How to work with SoAP UI calls?

    Hi,

    I need to send complex data to a WSDL SoAP call. I am able to receive and use response for operations requiring simple inputs, but unable to send complex data inputs.

    The operation to be called is in the following format:

    Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mob="http://xyz/mobile_services/">
       <soapenv:Header/>
       <soapenv:Body>
          <mob:getRelatedVideos>
             <objVidData>
                <objBasicData>
                   <mobileData>
                      <mobileId>123</mobileId>
                      <mobileCode>N</mobileCode>
                   </mobileData>
                   <userId>1</userId>
                </objBasicData>
                <videoId>1</videoId>
             </objVidData>
             <startPos>0</startPos>
             <numVideos>2</numVideos>
          </mob:getRelatedVideos>
       </soapenv:Body>
    </soapenv:Envelope>
    The AS 2.0 code is:

    Code:
    import mx.services.*;
    import mx.remoting.*;
    import mx.rpc.*;
    import mx.data.*;
    
    var paramObject = new LoadVars();
    
    paramObject.mobileObj.mobileId = "1234";
    paramObject.mobileObj.mobileCode = "N";
    paramObject.emailId = "supriyaakg@test.com";
    paramObject.userPassword = "test123";
    
    var myWebServiceObject = new WebService("http://abc/mobile_servicesSOAP?wsdl");
    
    myWebServiceObject.onLoad = function()
    {
    	trace("Success call for WSDL");
    
    	var MyPendingCallObject:PendingCall = myWebServiceObject.loginUser(paramObject);
    
    	trace("----" + MyPendingCallObject.request);//input data format	
    	
    	MyPendingCallObject.onResult = function(result)
    	{
    		trace("----" + MyPendingCallObject.response);//output data
    	}
    	
    	MyPendingCallObject.onFault = function(fault:PendingCall)
    	{
    		trace("Fault = " + fault.response);
    		
    	}
    }
    
    myWebServiceObject.onFault = function(fault)
    {
    	trace("Oops!!!" + fault);
    }
    Last edited by supriyaakg; 2011-03-18 at 05:36.
    Regards,
    Supriya Tenany

  2. #2
    Regular Contributor
    Join Date
    Feb 2010
    Posts
    157

    Re: How to work with SoAP UI calls?

    Hi,

    For users watching this thread, let me update the solution, which I worked out myself:

    1. The input parameters are:

    <objVidData> //Complex type
    <objBasicData> //object type
    <mobileData>//Object type
    <mobileId>...</mobileId> //Number
    <mobileCode>...</mobileCode> //String
    </mobileData>
    <userId>...</userId> //String
    </objBasicData>
    <videoId>...</videoId> //Number
    </objVidData>
    <startPos>...</startPos> //Number
    <numVideos>...</numVideos> //Number

    The main input parameters are:

    <objVidData>...</objVidData>
    <startPos>...</startPos>
    <numVideos>...</numVideos>

    Hence, when the method call is made, these parameters are to be passed along as:

    Code:
    var MyPendingCallObject:PendingCall = myWebServiceObject.loginUser(objVidData,startPos,numVideos)
    Now, since <objVidData> is a complex parameter in itself, it needs to be made as an instance of a class, which will contain all child member declarations.

    var objVidData:MyObjectClass = new MyObjectClass;

    The class 'new MyObjectClass' will look like this:

    Code:
    class new MyObjectClass
    {
    	var objBasicData:Object;
            	var mobileData:Object;
    			var mobileId:Number;
    			var mobileCode:String;               
                    var userId:String;
    	var videoId:Number
    }
    My main class code is thus written as:

    Code:
    import mx.services.*;
    import mx.remoting.*;
    import mx.rpc.*;
    import mx.data.*;
    
    var myWebServiceObject = new WebService("http://abc/mobile_servicesSOAP?wsdl");
    
    myWebServiceObject.onLoad = function()
    {
    	trace("Success call for WSDL");
    
    	var objVidData:MyObjectClass = new MyObjectClass();
    	
    	objVidData.objBasicData = new Object();
    	objVidData.objBasicData.mobileData = new Object();
    	objVidData.objBasicData.mobileData.mobileId = "1234";
    	objVidData.objBasicData.mobileData.mobileCode = "N";
    	objVidData.objBasicData.userId = "supriyaakg";
    	objVidData.videoId = 123;
    
    	var startPos:Number = 1;
    	var numVides:Number = 5;
    
    
    	var MyPendingCallObject:PendingCall = myWebServiceObject.loginUser(objVidData,startPos,numVideos)
    
    	trace("----" + MyPendingCallObject.request);//input data format	
    	
    	MyPendingCallObject.onResult = function(result)
    	{
    		trace("----" + MyPendingCallObject.response);//output data
    	}
    	
    	MyPendingCallObject.onFault = function(fault:PendingCall)
    	{
    		trace("Fault = " + fault.response);
    		
    	}
    }
    
    myWebServiceObject.onFault = function(fault)
    {
    	trace("Oops!!!" + fault);
    }
    Regards,
    Supriya Tenany

Similar Threads

  1. Replies: 1
    Last Post: 2008-08-16, 23:36
  2. Replies: 0
    Last Post: 2007-05-18, 08:23
  3. os.makedirs not work with UI
    By kajinka13 in forum Symbian
    Replies: 0
    Last Post: 2006-01-28, 01:17
  4. Can't get UI to work with simple login form
    By sheadley in forum Symbian
    Replies: 1
    Last Post: 2005-04-26, 14:55
  5. How to get Nokia UI API to work?
    By eyvind1 in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2004-09-22, 13:51

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×