# NetConnection.call parameters not retrievable on server

**URL:** <https://community.wowza.com/t/netconnection-call-parameters-not-retrievable-on-server/39602>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [February 19, 2013, 7:36am UTC](https://community.wowza.com/t/netconnection-call-parameters-not-retrievable-on-server/39602 "2013-02-19T07:36:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mat\_Barrie](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@Mat\_Barrie](https://community.wowza.com/u/Mat_Barrie)\
**Post date:** [February 19, 2013, 7:36am UTC](https://community.wowza.com/t/netconnection-call-parameters-not-retrievable-on-server/39602/1 "2013-02-19T07:36:23Z")

</div>

I’m trying to call a function from an AS3 application with the following signature

```auto
public void onPasswordChanged(IClient client, RequestFunction function, AMFDataList params)

```

But when I call this from the client, it seems the parameters are not retrievable. My AS3 code is as follows

```auto
		
		/* JS callback functions */
		public function setPassword(pw:String):void
		{
			trace(printf("setPassword called: %s is new password", pw)); 
			
			this.roomPassword = pw;
			serverCall('onPasswordChanged', this.streamName, this.roomPassword);
		}
		private function serverCall(func:String, ...params):void
		{
			try {
				if ( nc.connected ) {
					nc.call(func, null, params);
				}
			} catch ( e:Error ) {
				trace( "Server Error: "+e.toString() );
			}
		}

```

On the client, the trace() shows that my params are there. But calling getString(params, PARAM1) on the server returns null, and calling params.getString(PARAM1) results in “19:31:55: ERROR -Category: server -Event: comment -Comment: invoke(onPasswordChanged): java.lang.ClassCastException: com.wowza.wms.amf.AMFDataMixedArray cannot be cast to com.wowza.wms.amf.AMFDataItem: com.wowza.wms.amf.AMFDataList.getString(null:-1)”

What could possibly be wrong here?

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [February 19, 2013, 12:02am UTC](https://community.wowza.com/t/netconnection-call-parameters-not-retrievable-on-server/39602/2 "2013-02-19T00:02:53Z")

</div>

Server-side, try:

```auto
String param1 = getParamString(params, PARAM1);

```

If you are returning an AMFDataObj, handle like this client-side:

```auto
nc.call("doSomething", new Responder(doSomethingResult), "myData");
function doSomethingResult(obj:Object)
{
for (var prop:String in obj)
{
	trace("\t"+prop+":\t"+obj[prop]);
}
}

```

Or if returning simple string:

```auto
function doSomethingResult(returnStr:String)
{
	trace("doSomething: "+returnStr);
	callResult.text = "doSomething: "+returnStr;
}

```

Richard

---

<div class="post-metadata">

**Author:** ![Mat\_Barrie](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@Mat\_Barrie](https://community.wowza.com/u/Mat_Barrie)\
**Post date:** [February 19, 2013, 4:56pm UTC](https://community.wowza.com/t/netconnection-call-parameters-not-retrievable-on-server/39602/3 "2013-02-19T16:56:52Z")

</div>

> Server-side, try:
> 
> ```auto
> String param1 = getParamString(params, PARAM1);
> 
> ```
> 
> That’s the first thing I tried - it returns null. Using params.getString causes an exception. One thing occurs to me in retrospect however - is it possible that sending the params object passed into my serverCall method is resulting in a single parameter of type AMFDataMixedArray being sent to the server?
> 
> (UPDATE: Yes. That’s exactly what it is. I naively assumed that the “params” would be passed unmodified but it appears when it is first passed into an AS3 function it is re-packaged into an array).
> 
> > If you are returning an AMFDataObj, handle like this client-side:
> > 
> > ```auto
> > nc.call("doSomething", new Responder(doSomethingResult), "myData");
> > function doSomethingResult(obj:Object)
> > {
> > for (var prop:String in obj)
> > {
> > trace("\t"+prop+":\t"+obj[prop]);
> > }
> > }
> > 
> > ```
> > 
> > Or if returning simple string:
> > 
> > ```auto
> > function doSomethingResult(returnStr:String)
> > {
> > trace("doSomething: "+returnStr);
> > callResult.text = "doSomething: "+returnStr;
> > }
> > 
> > ```
> > 
> > Richard
> 
> I’m not using responders at this point - this is a blind server call.
