从wsdl网址生成Java类 – 返回401错误。

huangapple go评论68阅读模式
英文:

Generate classes java from a wsdl url - returning error 401

问题

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>

			<!-- tag::wsdl[] -->
			<plugin>
				<groupId>org.jvnet.jaxb2.maven2</groupId>
				<artifactId>maven-jaxb2-plugin</artifactId>
				<version>0.14.0</version>
				<executions>
					<execution>
						<goals>
							<goal>generate</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<schemaLanguage>WSDL</schemaLanguage>
					<generatePackage>ca.applications.linte.client.generate</generatePackage>
					<schemas>
						<schema>
							<url>http://localhost:8080/ws-consentement-sollicitation-web/ws/LNTEService.wsdl</url>
						</schema>
					</schemas>
				</configuration>
			</plugin>
			<!-- end::wsdl[] -->
		</plugins>
	</build>
英文:

I am trying to generate Java Classes from WSDL URL, but I am receiving an error 401.
I would like to know if I can configure it to input the username/password.

Obs.: If I download the .wsdl file and use it directly it works, but I would like to make something more automatic.

Here my code:

	&lt;build&gt;
			&lt;plugins&gt;
				&lt;plugin&gt;
					&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
					&lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
				&lt;/plugin&gt;

	      &lt;!-- tag::wsdl[] --&gt;
	      &lt;plugin&gt;
	          &lt;groupId&gt;org.jvnet.jaxb2.maven2&lt;/groupId&gt;
	          &lt;artifactId&gt;maven-jaxb2-plugin&lt;/artifactId&gt;
	          &lt;version&gt;0.14.0&lt;/version&gt;
	          &lt;executions&gt;
	            &lt;execution&gt;
	              &lt;goals&gt;
	                &lt;goal&gt;generate&lt;/goal&gt;
	              &lt;/goals&gt;
	            &lt;/execution&gt;
	          &lt;/executions&gt;
	          &lt;configuration&gt;
	            &lt;schemaLanguage&gt;WSDL&lt;/schemaLanguage&gt;
	            &lt;generatePackage&gt;ca.applications.linte.client.generate&lt;/generatePackage&gt;
	            &lt;schemas&gt;
	              &lt;schema&gt;
	                &lt;url&gt;http://localhost:8080/ws-consentement-sollicitation-web/ws/LNTEService.wsdl&lt;/url&gt;
	              &lt;/schema&gt;
	            &lt;/schemas&gt;
	          &lt;/configuration&gt;
	      &lt;/plugin&gt;
	      &lt;!-- end::wsdl[] --&gt;
				
			&lt;/plugins&gt;
	&lt;/build&gt;

答案1

得分: 2

这不受jaxb支持。请参考此答案:https://stackoverflow.com/questions/42137202/generate-a-schema-for-wsdl-with-http-authentication-and-the-maven-jaxb2-plugin。您可以尝试使用此中提到的方法。

英文:

This is not supported by jaxb. Please refer this answer: https://stackoverflow.com/questions/42137202/generate-a-schema-for-wsdl-with-http-authentication-and-the-maven-jaxb2-plugin. You could try using the hack mentioned in this.

huangapple
  • 本文由 发表于 2020年9月25日 21:54:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/64065541.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定