wsimport not working
Asked Answered
F

5

16

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?

Fringe answered 29/8, 2014 at 11:9 Comment(0)
G
16

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.

Groningen answered 3/3, 2015 at 14:52 Comment(1)
this works, but can anyone explain why ? any other workaround for this.Confrere
A
4

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

Astarte answered 19/1, 2015 at 7:30 Comment(0)
H
3

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.

Holler answered 19/12, 2014 at 3:55 Comment(1)
It seems like there was an proxy issue.Fringe
H
0

Try setting this option to wsimport: -XdisableSSLHostnameVerification which

Disables the SSL Hostname verification while fetching the wsdls.

Hoagy answered 2/10, 2015 at 7:18 Comment(0)
C
0

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>

Competitive answered 3/12, 2016 at 19:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.