how to work wsimport for this WSDL i get errors and i cant make it work

1.2k views Asked by At

i am trying to use the command wsimport to get the java classes for a SOAP Service, but i get lots of errors.

The Url WSDL is this https://onlineavl2api-mx.navmanwireless.com/onlineavl/api/V1.3/service.asmx?WSDL

and this is one of the errors i get(there is a bunch)

 [ERROR] Two declarations cause a collision in the ObjectFactory class.
  line 820 of https://onlineavl2api-mx.navmanwireless.com/onlineavl/api/V1.3/ser
  vice.asmx?WSDL
2

There are 2 answers

10
code4jhon On

wsimport is trying to generate classes in the same package with same name, to fix this I would try:

1.- ommit -p clientC

or

2.- Add an annotation on the webservice like this:

package com.me.basiccalcws;

import javax.jws.WebService;

    @WebService(targetNamespace = "http://client.basiccalcws.me.com/")
    public class Calculator {
        public int add(int a, int b) {
            return a + b;
        }
    }

took from Name Collision In Wsimport Generated Class And My Original Web Service Class

Best Regards

1
Javier Islas García On

To generate WebService Clients i use:

wsimport -keep -p clientC https://onlineavl2api-mx.navmanwireless.com/onlineavl/api/V1.3/service.asmx?WSDL