axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Dollery \(GreenPulse\)" <Br...@GreenPulse.com>
Subject RE: Simple ws problems -- Redux
Date Fri, 25 Apr 2003 11:06:52 GMT
Hi guys,

Further searching has added this entry to my deployment descriptor:

  <beanMapping
    qname="tns1:HelloMessage"
    xmlns:tns1="http://localhost/axis/services/simple"
    languageSpecificType="java:com.greenpulse.model.HelloMessage"
  />

When I run my client against the server I no longer get the error I
mentioned in my post below. Instead I get an error telling me that there is
no deserializer. What am I doing wrong in my client?

I've also used wsdl2java to generate java classes, and have used them to
write a simplified client. This works with no problems at all. I've read
the generated client code and can find no similarity between it and my
approach (maybe that's why it works, and mine doesn't ;-).

The body of the new client (the one that works is)

  Simple simple = new SimpleServiceLocator().getsimple();
  HelloMessage helloMessage = simple.getHelloMessage();
  System.out.println("helloMessage = " + helloMessage.getMessage());

If anyone can tell me why my old client doesn't work I'd be greatful.

TIA,

Bryan

> -----Original Message-----
> From: Bryan Dollery (GreenPulse) [mailto:Bryan@greenpulse.com]
> Sent: Friday, April 25, 2003 5:03 PM
> To: Axis-User
> Subject: Simple ws problems
>
>
> Hi guys,
>
> I'm just experimenting, and have run into a problem. I want to return one
> class from a method on another, and then call a method on that class.
>
> The code below contains everything of importance. The client
> code is last;
> it successfully returns both the version of the axis server
> (1.1rc2) and a
> random number. When I try to call getHelloMessage I get an exception:
>
> No serializer found for class com.greenpulse.model.HelloMessage
> in registry
> org.apache.axis.encoding.TypeMappingImpl@1f243d1
>
> Obviously I'm missing something, but at this stage I don't even
> know where
> to look? Any guidance would be really helpful.
>
> Thanks in advance.
>
> Bryan
>
> Sun sdk 1.4.1_02, tomcat 4.1.24, axis 1.1rc2.
> Here's the code:
>
> *** Simple **********************
> package com.greenpulse.model;
>
> public class Simple {
>     HelloMessage helloMessage = new HelloMessage();
>
>     static java.util.Random random = new
> java.util.Random(System.currentTimeMillis());
>
>     public double getRnd() {
>         return random.nextDouble();
>     }
>
>     public HelloMessage getHelloMessage() {
>         return helloMessage;
>     }
> }
>
> *** HelloMessage ****************
> package com.greenpulse.model;
>
> public class HelloMessage implements java.io.Serializable {
>     private String message = "This is my local message";
>
>     public HelloMessage() {
>     }
>
>     public String getMessage() {
>         return message;
>     }
>
>     public void setMessage(String message) {
>         this.message = message;
>     }
> }
>
> *** deploy.wsdd *******************
> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>     <service name="simple" provider="java:RPC">
>         <parameter name="className" value="com.greenpulse.model.Simple"/>
>         <parameter name="allowedMethods" value="*"/>
>     </service>
> </deployment>
>
> *** Client **************
> package client;
>
> import com.greenpulse.model.HelloMessage;
> import org.apache.axis.client.Call;
> import org.apache.axis.client.Service;
>
> public class SimpleClient {
>     public static void main(String[] args) {
>         try {
>             getAxisVersion();
>             getHelloMessage();
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>     }
>
>     private static void getHelloMessage() throws Exception {
>         Service service = new Service();
>         Call call = (Call) service.createCall();
>         call.setTargetEndpointAddress(new
> java.net.URL("http://localhost/axis/services/simple"));
>         call.setOperation("getRnd");
>         Object o = call.invoke((Object[]) null);
>         System.out.println(o);
>         call.setOperation("getHelloMessage");
>         System.out.println("invoking " + call.getOperationName());
>         o = call.invoke((Object[]) null);
>         HelloMessage helloMessage = (HelloMessage) o;
>         helloMessage.getMessage();
>     }
>
>     private static void getAxisVersion() throws Exception {
>         Service service = new Service();
>         Call call = (Call) service.createCall();
>         call.setTargetEndpointAddress(new
> java.net.URL("http://localhost/axis/services/Version"));
>         call.setOperation("getVersion");
>         String version = (String) call.invoke((Object[]) null);
>         System.out.println(version);
>     }
> }
>
>
> b r|y a n   d o l l e r y
>    |  g r e e n p u l s e
> -- o --------------------->
>    |        q u a l i t y
>    |  a r c h i t e c t s
>    |
> +64 (0)21 330607
> www.GreenPulse.com
>


Mime
View raw message