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 Stan Jordan <sk...@worldnet.att.net> on 2002/03/28 17:19:09 UTC

WSDL2Java issue (samples/userguide/example5)

I created a wsdl file and stubs for this example.  There appears to be a
problem.  On line 3 below, we have *interface* BeanService.  On line 4 below
we have *class* BeanService.Order.  This will not compile.  To make this
work, I put Order class into same package as everything else, and made a
couple similar changes in OrderProcessorSoapBindingStub.java (below).  After
these 3 changes, the stubs compile and the client works fine.  It would
appear there is a bug in WSDL2Java (package name confusion).
Cheers.
Stan
---------------------------------------------------
/**
 * BeanService.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis Wsdl2java emitter.
 */

1) package localhost;

3) public interface BeanService extends java.rmi.Remote {
4)    public java.lang.String processOrder(BeanService.Order in0) throws
java.rmi.RemoteException;
5) }
---------------------------------------------------
required changes to OrderProcessorSoapBindingStub.java....

//    cls = BeanService.Order.class;
      cls = Order.class;

//    public java.lang.String processOrder(BeanService.Order in0) throws
java.rmi.RemoteException{
      public java.lang.String processOrder(Order in0) throws
java.rmi.RemoteException{




Re: WSDL2Java issue (samples/userguide/example5)

Posted by Stan Jordan <sk...@worldnet.att.net>.
I finally figured out why WSDL2Java fails on this example.  The key is to
(carefully!) examine this line in the deployment descriptor:
  <beanMapping qname="myNS:Order" xmlns:myNS="urn:BeanService"
The upper case B in "urn:BeanService" is trouble!!!  When you create a wsdl
file and stubs, you end up with an interface (below) which will not compile
because of a *name-collision* between the interface (BeanService) and
argument (BeanService.Order).  One way to fix the problem is to put a lower
case 'b' in the deployment descriptor:
  <beanMapping qname="myNS:Order" xmlns:myNS="urn:beanService"
Now when the interface (below) is generated by WSDL2Java, the argument name
is "beanService.Order" and all is well.

I still say this is a bug in WSDL2Java.  It should be smart enough to avoid
such a name-collision because the collision produces code that will not
compile.
Cheers.
Stan
I used axis-beta1 for this exercise.
----------------------------------------------
/**
 * BeanService.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis Wsdl2java emitter.
 */

package localhost;

public interface BeanService extends java.rmi.Remote {
    public java.lang.String processOrder(BeanService.Order in0) throws
java.rmi.RemoteException;
}