users@jax-rpc.java.net

Starting from WSDL!!!

From: Dilip Easwaran <dilip_at_IIITB.AC.IN>
Date: Wed, 03 Apr 2002 06:13:34 -0700

Hi!!

I am following the jwsdp EA2 HelloWorld example.It works fine when i use the commands at
..doc/example/jaxrpc/simplebean/

ant build
ant install
ant run
i get the array displayed reverse.

but when i started from the WSDL..
I followed the steps.

1>ant compile-server
2>ant xrpcc-server

my build.properties file in c:\array is:

# This file is referenced by the build.xml file.

example=simplebean
client-class=simplebean.HelloClient
endpoint=http://localhost:8080/jaxrpc-simplebean/jaxrpc/HelloIF
web-inf-config=HelloWorld_Config.properties
context-path=jaxrpc-simplebean
war-file=${context-path}.war
client-jar=${example}-client.jar
build-path=c:/array/${build}

3>ant install

**********for the client side***********

i now use a configX.xml file

<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://java.sun.com/jax-rpc-ri/xrpcc-config">
<wsdl name="HelloWorldService" location="http://dilipe:8080/jaxrpc-simplebean/server/HelloWorldService.wsdl" packageName="Client">
</wsdl>
</configuration>

4>xrpcc -both configX.xml


my HelloClient.java file is

package Client;
public class HelloClient {

    public static void main(String[] args) {

        try {

            String endpoint = "http://dilipe://8080/jaxrpc-simplebean/jaxrpc/HelloIFPort";
            HelloIFPort_Stub stub = getStub(endpoint);
            // System.out.println(stub.sayHello("Duke!"));
            demoArray(stub);
            } catch (Exception ex) {
            ex.printStackTrace();
        }
    } // main

    private static HelloIFPort_Stub getStub(String endpoint) {

        HelloIFPort_Stub stub = null;
        try {
            stub =
                (HelloIFPort_Stub)(new HelloWorld_Impl().getHelloIFPort());
            stub._setProperty(
                javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
                endpoint);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return stub;

    } // getStub

    private static void demoArray(HelloIFPort_Stub stub) {

        try {
            String[] words = {"it", "was", "a", "dark", "and",
                              "stormy", "night"};

            System.out.println("demoArray method:");
            for (int j = 0; j < words.length; j++) {
                System.out.print(words[j] + " ");
            }
            System.out.println();

            String[] backwards = stub.reverse(words);

            for (int j = 0; j < backwards.length; j++) {
                System.out.print(backwards[j] + " ");
            }
            System.out.println();

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    } // demoArray


} // class

i then compile the client file

C:\array>javac -d . HelloClient.java

C:\array>java Client.HelloClient
demoArray method:
it was a dark and stormy night
java.rmi.RemoteException: HTTP transport error: java.net.ConnectException: Conne
ction refused: connect; nested exception is:
        HTTP transport error: java.net.ConnectException: Connection refused: con
nect
        at Client.HelloIFPort_Stub.reverse(Unknown Source)
        at Client.HelloClient.demoArray(HelloClient.java:45)
        at Client.HelloClient.main(HelloClient.java:11)
Caused by: HTTP transport error: java.net.ConnectException: Connection refused:
connect
        at com.sun.xml.rpc.client.http.HttpClientTransport.invoke(HttpClientTran
sport.java:176)
        at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:64)

        ... 3 more


Do i have to specify the type mapping in the confugX.xml file???or is there something i forgot to do??

thanx,

dilip