I use jaxws-maven-plugin to produce java from wsdl.
wsdl located in local network, but refers to some xsd in internet.
It becomes troubles in generation code with maven plugin, becouse it has lack of advanced http proxy settings.
Is there a workaround for this issue?
My config is:
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
<configuration>
<!--<httpproxy>127.0.0.1:5865</httpproxy>-->
<packageName>my.pkg</packageName>
<verbose>true</verbose>
<wsdlUrls>
<wsdlUrl>
http://10.31.7.64:13080/service.wsdl
</wsdlUrl>
</wsdlUrls>
</configuration>
</plugin>
Without proxy I got
parsing WSDL...
[ERROR] IOException thrown when processing "http://www.w3.org/2005/05/xmlmime". Exception: java.net.ConnectException: Connection refused: connect.
With proxy I got
parsing WSDL...
[ERROR] Server returned HTTP response code: 504 for URL: http://10.31.7.64:13080/service.wsdl
May be it problem of proxy, but I don't have another proxy behind corporate network.
A better approach is to use the noProxy variable of the JVM. Then your build fails when the WSDL is not available (In my case very useful for integration tests) You can add this to the jaxws-maven-plugin configuration:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<id>wsdltoJava</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlUrls>
<wsdlUrl>https://someService.yourcompany.net/Service/Service?wsdl</wsdlUrl>
</wsdlUrls>
<vmArgs>
<vmArg>-Dhttp.nonProxyHosts=*.yourcompany.net, 10.31.7.64</vmArg>
</vmArgs>
<keep>true</keep>
<packageName>com.yourcompany.package</packageName>
<sourceDestDir>your/target/directory</sourceDestDir>
</configuration>
</execution>
</executions>
AFAIU, when we enable the httpproxy, all request will go to that proxy, including with the <wsdlUrl>.
The server returns
HTTP response code: 504 for URL: http://10.31.7.64:13080/service.wsdl
The Status Code Definitions told us as the following: -
504 Gateway Timeout
The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request.
The root cause may be the proxy does not known our address, in this case it is 10.31.7.64
IMHO please try to download the wsdl and put it to local machine. Then configured by using the wsdlFiles as the following example: -
<configuration>
<wsdlFiles>
<wsdlFile>${basedir}/path/to/wsdl</wsdlFile>
</wsdlFiles>
</configuration>
I hope this may help.
Related
I want to use wagon-maven-plugin with download-single goal from a correct url but maven says:
Error handling resource: Resource missing at http://myurl/from/file%3FWSDL 404 Not Found -> [Help 1]
Here is the plugin definition:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>fetch-wsdl</id>
<phase>initialize</phase>
<goals>
<goal>download-single</goal>
</goals>
<configuration>
<url>http://myurl</url>
<fromFile>from/file?WSDL</fromFile>
<toFile>${project.basedir}/src/main/resources/wsdl/Consumer.wsdl</toFile>
</configuration>
</execution>
</executions>
</plugin>
The problem here is I have a query symbol in my url but wagon-maven-plugin replace it by %3F.
for example: It converts http://myurl/from/file?WSDL to http://myurl/from/file%3FWSDL
Are there anyone who face this issue as well?
Note: If I use with another url without query symbol it works.
Well, It is a known issue that it does not work with query symbol. I am going to use another plugin maven-download-plugin.
I tried passing the proxy settings in via <jvmArguments> just like you do with an install4j-generated installer:
<plugin>
<groupId>org.sonatype.install4j</groupId>
<artifactId>install4j-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>compile-installers</id>
<phase>package</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<jvmArguments>
<arg>-DproxySet=true</arg>
<arg>-Dhttps.proxyHost=...</arg>
<arg>-Dhttps.proxyPort=443</arg>
<arg>-DproxyAuth=true</arg>
<arg>-DproxyAuthUser=${...}</arg>
<arg>-DproxyPassword=${...}</arg>
</jvmArguments>
...
</configuration>
</execution>
</executions>
</plugin>
but that failed.
On a machine where proxy settings are injected via the IDE, the above works, even if I intentionally pass in a wrong password or even a nonexistent proxy server, so I guess I'm Doing It Wrong(tm).
Turns out it was a misconfiguration.
Lesson to take home: If you see "connection refused", "forbidden", or any other connection failure messages, it might be the proxy or the target server talking, you don't know and the install4j-maven-plugin output does not tell you.
It would be nice if a future install4j-maven-plugin version could output that information, but currently it does not.
I want to use jaxb2 plugin to generate a WSDL accessible from a secure URL (basic authentication with user id and password).
Where should I specify the credentials to generate the schema? Without providing them, I get one 401 error during schema generation.
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>hello.wsdl</generatePackage>
<schemas>
<schema>
<url>http://www.webservicex.com/stockquote.asmx?WSDL</url>
</schema>
</schemas>
</configuration>
</plugin>
HTTP authentication to download schemas is currently not supported, and a pull request to add it was declined, so it won't be implemented. This is because it is always preferable to download the WSDL and work on it locally, rather than downloading it during each build:
It makes the build highly dependant on the availability of the WSDL, something which may not be guaranteed and can end up failing your build for no reasons;
The build is no longer repeatable, which is contrary to what Maven is striving for, since you do not necessarily control how and when the remote WSDL is updated.
There is a somewhat hacky way to do this with Apache CXF Codegen Plugin instead, but I really wouldn't recommend it.
I am trying to access a soap webservice through spring tool suite and maven.
I have done this using the source code from https://spring.io/guides/gs/consuming-web-service/ This works fine .
Dependancy is
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>1.5.8</version>
</dependency>
plugin is
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>Test3.wsdl</generatePackage>
<schemas>
<schema>
<url>http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl</url>
</schema>
</schemas>
</configuration>
</plugin>
Now I have changed the url to a new link with https:
I can access the wsdl from my browser.
I am getting the error
"Execution default of goal
org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate failed.
(org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate:default:generate-sources)"
I searched a lot for an answer.but could not find a soultion. would really appreciate a help.
Thankyou and Regards,
This is an SSLClient related issue, now there's several ways to fix this. From the eclipse IDE configuration perspective please refer : https://db-blog.web.cern.ch/blog/luis-rodriguez-fernandez/2014-07-java-soap-client-certificate-authentication . Now the best approach would be to have maven configuration changes as part of the build. This can be done using the properties-maven-plugin , here's a thread which discusses the same: SSL client certificate in Maven
I'm using jax-ws maven plugin for generate obiekt from GenericTicketConnectorSOAP.wsdl every object generated without GenericTicketConnectorSOAP, service and port. My pom.xml is wrong or this wsdl isn't prepare to generate service and port ?
Thanks for help.
I cannot use wsdl to generate Java stub classes. I posted my solution here
BTW, the link to your pom does not work. Access denied.
Thanks for your solution. I found other. When I'm using axistools-maven-plugin plugin
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<configuration>
<urls>
<url>file:/${project.basedir}/otrs/Service.wsdl</url>
</urls>
<packageSpace>my.package</packageSpace>
<testCases>false</testCases>
<serverSide>false</serverSide>
</configuration>
</plugin>
everything are generating by itself(port, service itp)