0

I am developing a WebService and Client for it using JBoss 5.1.0GA. The JBossWs stack was already preinstalled with the binary that I downloaded and as I understand it is JBossWs 3.1.2GA

I have developed a web service using this setup and have also created a client successfully. This is what I have.

A pojo web service deployed as a war file.

@WebService
public class Service{
    @WebMethod
    public CompleObj getConfiguration() {
        CompleObj oConf = new CompleObj ();
        for (int i = 0; i < 10; i++) {
            NestObj oInst = new BOpRepoInstance("Val1", "Val2", "Val3", "Val4");
            oConf.addRepoInstance(oInst);
        }
        return oConf;
    }
}

Here,

CompleObj => is a Complex Object that has a list of type NestObj. Its getter/setters, toString and some other methods.

NextObj => has 4 variables of Type String. Its getter/setters, toString, hashCode, equals and some other methods.

Got this web service deployed successfully.

Later created a client using the eclipse wizard for generating Web Service Client using WSDL document. It also created a sample client file which would call the webservice and fetch the return value. This also worked like a charm.

Now my problem is, when eclipse generated stubs for clients it created classes for CompleObj and NestObj. These classes only has the variables and its getters/setters (this make sense as these are being generated from WSDL doc). Thus i loose a lot of other methods that includes toString, hasCode, equals etc, which I want to use at the Client side as well.

Now how can I make use of the actual class files defined in the WebService project directly and avoid the client to use the generated ones. I can provide the class files as .jar binary for the Client project, I cant really get how to achieve this.

Another question is, the web service location is embedded in the stubs directly, what can i do to have the webservice location passed as part of the argument to the invocation code?

Salman A. Kagzi
  • 3,833
  • 13
  • 45
  • 64

1 Answers1

0
  1. The classes which are generated in the client side are just place holders it is not deserilized version of your own classes,When you invoke the service it is used to carry your object to server then the JBOOSWS will do the JAXB mapping to the actual classes. So you can not make the your own classes to be used in the client side though they are look same.

  2. URL will be fixed in the stub code, since in eclipse while generating WS client the first thing you must provide is, the WSDL URL,then eclipse will generate the client code accordingly,so generated code is specific to the WSDL you provided. If you want to pass the WSDL dynamically,then you need to have your own code to generate the client stubs by passed WSDL URL using any WSDLtoJAVA or any other utility.

Murugesh
  • 1,009
  • 1
  • 12
  • 34
  • Thanks. I understand the above points you mention. To be more precise on what I am looking for, lets take the Example web service and its client generation as explained [here](https://community.jboss.org/wiki/JBossWS-QuickStart). Now, with this example if I package the Custom datatypes i.e. Customer.java and Discount*.java in a jar file, how can I force wsconsume to use those files instead of Creating new ones. Currently what I do is, after getting the Source generated, I delete the created data types and then update the imports to point to the ones available in the Jar file. – Salman A. Kagzi Jul 16 '12 at 10:47
  • Which involves change in provided utility "wsconsume",for that we need to look the wsconsume implementation. – Murugesh Jul 19 '12 at 11:25