Kartic
Kartic

Reputation: 2985

wsimport not working

When I try to use wsimport using the below command from command prompt, it's working fine:

wsimport -d generated C:\Users\generated\wsdlfile.xml

However, when I try to use wsimport as below, it's throwing the following error:

wsimport -d generated https://example.com/exampleService.svc?wsdl

Failed to read the WSDL document: https://example.com/exampleService.svc?wsdl, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.

[ERROR] failed.noservice=Could not find wsdl:service in the provided WSDL(s): At least one WSDL with at least one service definition needs to be provided.

        Failed to parse the WSDL.

I can access the URL from a browser, and the same thing is working from other systems (from my PC). What could be the reason?

Upvotes: 16

Views: 29497

Answers (5)

GAURAV KUMAR GUPTA
GAURAV KUMAR GUPTA

Reputation: 796

use below pom.xml .

    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <warSourceDirectory>WebContent</warSourceDirectory>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>1.9</version>
            <executions>
                <execution>
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                    <phase>generate-sources</phase>
                </execution>
            </executions>
            <configuration>

                <!-- Keep generated files -->
                <keep>true</keep>
                <!-- Package name -->
                <packageName>org.example.echo.service.skeleton</packageName>
                <!-- generated source files destination -->
                <sourceDestDir>src/main/java</sourceDestDir>

                <wsdlUrls>
                    <wsdlUrl>
                        **http://localhost:8080/soapWebService/services/PersonServiceImpl?wsdl**
                    </wsdlUrl>
                </wsdlUrls>
            </configuration>
        </plugin>
    </plugins>

</build>

Upvotes: 0

Edu Castrillon
Edu Castrillon

Reputation: 587

I had this same issue and, in my case, the problem was the encoding of the WSDL file.

Try opening https://example.com/exampleService.svc?wsdl from a browser. If it can be completely parsed, you will see all the xml content. If not, at least Firefox will point you where the problem is.

Hope it helps someone in this situation

Upvotes: 4

ACV
ACV

Reputation: 10560

Try setting this option to wsimport: -XdisableSSLHostnameVerification which

Disables the SSL Hostname verification while fetching the wsdls.

Upvotes: 0

Diego Magdaleno
Diego Magdaleno

Reputation: 841

I have solved this issue on Windows by disabling all proxy settings as follows:

Internet Options > Connections > Lan Settings > Disable all check boxes

NOTE: Just adding localhost or my IP address as an exception to my proxy settings didn't work for me.

Upvotes: 16

Navaza Khan
Navaza Khan

Reputation: 31

This seems to be an issue with the version of java that you are using...

Make sure you have java version "1.7.x" to resolve this issue.

Upvotes: 3

Related Questions