You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Th Templ <te...@hotmail.com> on 2003/01/07 10:25:56 UTC

Problem with beanMapping

Hello,

I have problem with beanMapping. I can invoke the method of the service 
correctly with a Java Axis client but all the field of my object are 0 or 
null.

However when I try the url in a navigator to try the call of the method ( 
http://localhost/jgeneaws/services/JGeneaService?method=getCommune ), I have 
the good xml with the good values in the good fields of my bean...

My source files:

deply.wsdd
---------------------------------------------------------------------
<deployment name="deploy" xmlns="http://xml.apache.org/axis/wsdd/"
			xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
            xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
			xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance">

  <service name="JGeneaService" provider="java:RPC">
    <parameter name="className" 
value="org.genealogie.service.JGeneaService"/>
    <parameter name="allowedMethods" value="*"/>

    <beanMapping qname="myNS:CommuneUtils" xmlns:myNS="urn:JGeneaService"
                 
languageSpecificType="java:org.genealogie.utils.CommuneUtils"/>
  </service>
</deployment>

Client.java
---------------------------------------------------------------------
Service  service = new Service();
Call call = (Call) service.createCall(); // *1*

String endpoint="http://localhost/jgeneaws/services/JGeneaService";
call.setTargetEndpointAddress(new java.net.URL(endpoint));

QName qnCommune=new QName("urn:JGeneaService","CommuneUtils");
call.registerTypeMapping(CommuneUtils.class,qnCommune,
	new 
org.apache.axis.encoding.ser.BeanSerializerFactory(CommuneUtils.class,qnCommune),
	new 
org.apache.axis.encoding.ser.BeanDeserializerFactory(CommuneUtils.class,qnCommune)
);

call.setOperationName("getCommune");
call.setReturnType(qnCommune);

CommuneUtils commune=(CommuneUtils)call.invoke(
	new Object [] {  }
);
System.out.println(commune.getId()+"/"+commune.getNom()+"/"+commune.getDepartementId()+"/"+commune.getDepartementNom());


JGeneaService.java
---------------------------------------------------------------------
public class JGeneaService {

	public JGeneaService() {
	}

	public CommuneUtils getCommune() {
		CommuneUtils commune=new CommuneUtils(14,"ma 
commune","-",77,"Seine-et-Marne","77",1,"France");
		System.out.println(commune.getId()+"/"+commune.getNom()+"/"+commune.getDepartementId()+"/"+commune.getDepartementNom());
		return commune;
	}
}


The last System.out.println writes 0/null/0/null

Has anybody already had this problem?
Thanks for your help.






_________________________________________________________________
MSN 8: advanced junk mail protection and 2 months FREE*. 
http://join.msn.com/?page=features/junkmail