OpenAMF with AS2

"Jason Liu" <[email protected]>
Newsgroups gmane.comp.java.openamf.user
Message-ID <[email protected]>
Hi,

I tried to use OpenAMF with ActionScript2 using a simple example.  The 
result displayed on the screen was "undefined undefined".  JDK version used 
was 1.4.1.  I post the log, source codes, and code scriptlet in the 
configuration file here.  Would anyone help to figure out what went wrong?

Thanks in advance!

Jason


[29/10/04 21:34:18:170 EDT] 69f057e9 AMFDeserializ I 
org.openamf.io.AMFDeserializer  Deserializing Message, for more info turn on 
debug level

[29/10/04 21:34:18:185 EDT] 69f057e9 REQUEST       I org.openamf.REQUEST  
REQUEST:
[AMFBody: {serviceName=org.openamf.examples.PersonService, 
serviceMethodName=readPerson, response=/1, type=ARRAY, value=[]}]

[29/10/04 21:34:18:185 EDT] 69f057e9 JavaServiceIn I 
org.openamf.invoker.JavaServiceInvoker  topRankedMethod: name=readPerson 
rank=100.0

[29/10/04 21:34:18:185 EDT] 69f057e9 RESPONSE      I org.openamf.RESPONSE  
RESPONSE:
[AMFBody: {serviceName=null, serviceMethodName=null, response=null, 
type=UNKNOWN, value=Elmar Fudd, zipcode = 12345}]

[29/10/04 21:34:18:185 EDT] 69f057e9 AMFSerializer I 
org.openamf.io.AMFSerializer  Serializing Message, for more info turn on 
debug level


####Client2.as######

import mx.remoting.NetServices;
import mx.controls.*;

class Client2 extends mx.screens.Form {
	var inited:Boolean;
	var conn:NetConnection;
	var personService:Object;
	var person:Person;
	var display_btn:Button;
	var name_txt:TextArea;
	function Client2() {
		super();
	}
	public function init():Void {
		trace("tracing init() function..");
		if (inited == null) {
			inited = true;
			// connect to a gateway
			conn = 
NetServices.createGatewayConnection("http://localhost:8080/openamf/gateway");
			//  create a service object that points to your java class acting as a 
service
			personService = conn.getService("org.openamf.examples.PersonService", 
this);
		}
		display_btn.onPress = function() {
			_parent.personService.readPerson();
		}
	}
	// function specific result handler objects
	public function readPerson_Result(result):Void {
		// display successful result
		name_txt.text = result.getFirstName()+ " "+ result.getLastName();
	}
	public function readPerson_Fault(fault):Void {
		trace("Error receiving Person: "+fault.faultstring);
	}
}

####PersonService.java#####
package org.openamf.examples;

public class PersonService {


	public PersonService() {
		super();

	}
	public Person readPerson() {

		Person person = new Person();

		person.setFirstName("Elmar");
		person.setLastName("Fudd");

		return person;
	}
}


####openamf-config.xml####
	<amf-serializer>
			<force-lower-case-keys>false</force-lower-case-keys>
	</amf-serializer>
	<custom-class-mapping>
		<java-class>org.openamf.examples.Person</java-class>
		<custom-class>Person</custom-class>
	</custom-class-mapping>

	<service>
		<name>PersonService</name>
		<service-location>org.openamf.examples.PersonService</service-location>
		<invoker-ref>java</invoker-ref>
		<method>
			<name>*</name>
			<parameter>
				<type>*</type>
			</parameter>
		</method>
	</service>

_________________________________________________________________
Scan and help eliminate destructive viruses from your inbound and outbound 
e-mail and attachments. 
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines 
  Start enjoying all the benefits of MSN® Premium right now and get the 
first two months FREE*.



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.