axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste HUNTZINGER <jean...@amabis.com>
Subject Axis Java Client cannot deserialize properly Server XML Result
Date Tue, 23 Nov 2004 17:20:02 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<pre>I try to call a service from an Axis java client, using the following code, and
store my result in a bean class "Localite" using a BenaDeserializer:


<font color="#000099">   public static void main(String [] args) {
       try {
       	
		String endpoint = <a class="moz-txt-link-rfc2396E"
 href="http://127.0.0.1:5000/">"http://127.0.0.1:5000/"</a>;
     
		Service  service = new Service();
		Call     call    = (Call) service.createCall();
		call.setUseSOAPAction(true);
		call.setTargetEndpointAddress( new java.net.URL(endpoint) );
		call.setOperationName(new QName(<a class="moz-txt-link-rfc2396E"
 href="http://tempuri.org/ns.xsd">"http://tempuri.org/ns.xsd"</a>, "getAdresse")
);
        
		// register "Localite" Bean classes
		
		<b>QName localite_qn = new QName(<a class="moz-txt-link-rfc2396E"
 href="http://tempuri.org/ns.xsd">"http://tempuri.org/ns.xsd"</a>,"Localite");
		call.registerTypeMapping(Localite.class, localite_qn, new BeanSerializerFactory(Localite.class,
localite_qn), new BeanDeserializerFactory(Localite.class, localite_qn));</b>
		
		call.setReturnType( localite_qn, Localite.class );
		
		Localite loc_out = (Localite) call.invoke( new Object[] { } );
		
		System.out.println("Result: '" + loc_out + "'");
       } catch (Exception e) {
           System.err.println(e.toString());
       }
   }</font>
</pre>
<br>
<br>
the "getAdresse" service is deployed (using gSoap), and everything goes
OK until the server return the result message containing the soap
enveloppe: <br>
<br>
<blockquote>
  <pre><font color="#000099">&nbsp;&nbsp;&nbsp; &lt;SOAP-ENV:Envelope
xmlns:SOAP-ENV=<a
 class="moz-txt-link-rfc2396E"
 href="http://schemas.xmlsoap.org/soap/envelope/">"http://schemas.xmlsoap.org/soap/envelope/"</a>
xmlns:SOAP-ENC=<a
 class="moz-txt-link-rfc2396E"
 href="http://schemas.xmlsoap.org/soap/encoding/">"http://schemas.xmlsoap.org/soap/encoding/"</a>
xmlns:xsi=<a
 class="moz-txt-link-rfc2396E"
 href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
xmlns:xsd=<a
 class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>
xmlns:ns=<a
 class="moz-txt-link-rfc2396E" href="http://tempuri.org/ns.xsd">"http://tempuri.org/ns.xsd"</a>&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;SOAP-ENV:Body&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ns:Localite&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;id&gt;3&lt;/id&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;libelle&gt;Bourg la reine&lt;/libelle&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;popu&gt;10000&lt;/popu&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ns:Localite&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/SOAP-ENV:Body&gt;
&nbsp;&nbsp; &lt;/SOAP-ENV:Envelope&gt;</font></pre>
</blockquote>
<pre>

The problem is that I cannot find a way to deserialize this flow. The client code result in
an empty "Localite" Object. No setter is called (setId or setLibelle or setPopu).
I tried differents things to interpret my result, but I could'nt find any way to do this so
far !
If I define my result type as String:
</pre>
<blockquote><font color="#000099">call.setReturnClass( String.class );</font><br>
  <font color="#000099">String loc_out = (String) call.invoke( new
Object[] { } );</font><br>
</blockquote>
<pre>I get "3" (the id value).


Can somebody tell me what I do wrong or what is missing in my code ???
</pre>
I<br>
<br>
Jean-Baptiste HUNTZINGER<br>
</body>
</html>

Mime
View raw message