当我使用maven-jaxb2-plugin生成JAXB类时,我得到了部分(!?)德语Javadoc的类.(我的默认语言环境:de_CH)
我想要的是:英语Javadoc
我试图设置maven opts:-Duser.language=en -Duser.country=US
但它没有效果.
如何使用英文Javadoc生成JAXB类?
以下是部分JAXB类的Javadoc和部分德语Javadoc:http://drombler.sourceforge.net/DromblerACP/docs/site/0.2.1-SNAPSHOT/apidocs/org/drombler/acp/core/action/jaxb/package -frame.html
以下是相应的XSD:http://sourceforge.net/p/drombler/drombler-acp/ci/default/tree/drombler-acp-core-action/src/main/resources/actions.xsd
这是相应的POM:http://sourceforge.net/p/drombler/drombler-acp/ci/default/tree/drombler-acp-core-action/pom.xml
相关的JAXB问题:
https://java.net/jira/browse/JAXB-1001
任何解决方法?
我正在尝试为XBRL中定义的类型生成Java类.
我的构建过程基于Maven 2,这是我的试验.我只粘贴build部分,它依赖于一些属性:
package 是我的目标包的名称
catalog是目录的路径和文件名.因为我没有互联网连接,我有amny条目,但我认为这些都是必要的
-- TR9401 for XBRL resources --
SYSTEM http://www.xbrl.org/2003/XLink http/www.xbrl.org/2003/xl-2003-12-31.xsd
SYSTEM http://www.w3.org/1999/xlink http/www.xbrl.org/2003/xlink-2003-12-31.xsd
Run Code Online (Sandbox Code Playgroud)
xsd.path 是XSD所在的目录
xsd.file 是以下极简主义XSD的文件名
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://www.xbrl.org/2003/instance"
schemaLocation="http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd"/>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
我试过的所有插件都无法导入xl:nonEmptyURI.
但是xl映射到http://www.xbrl.org/2003/XLink(在我的目录中)哪个导入 <import namespace="http://www.w3.org/1999/xlink" schemaLocation="xlink-2003-12-31.xsd"/>定义 nonEmptyURI
怎么了?我该如何解决?
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>xsdtojava</goal>
</goals>
<configuration>
<xsdOptions>
<xsdOption>
<catalog>${catalog}</catalog>
<xsd>${xsd.path}/${xsd.file}</xsd>
<packagename>${package}</packagename>
</xsdOption>
</xsdOptions>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
失败了
parsing a schema...
[ERROR] src-resolve: Cannot resolve the name 'xl:nonEmptyURI' …Run Code Online (Sandbox Code Playgroud) jaxb xbrl maven-jaxb2-plugin jaxb2-maven-plugin cxf-xjc-plugin
分享一下我的移民经历
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
Run Code Online (Sandbox Code Playgroud)
到
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.5.0</version>
Run Code Online (Sandbox Code Playgroud)
我们使用原始插件从 WSDL 文件生成源代码。有人请求使用 Java 11 而不是 Java 8,更改后原始插件生成了警告。
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector (file:/D:/mr/org/glassfish/jaxb/jaxb-runtime/2.3.0/jaxb-runtime-2.3.0.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of com.sun.xml.bind.v2.runtime.reflect.opt.Injector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Run Code Online (Sandbox Code Playgroud)
由于这个问题仍然被报告为 maven-jaxb2-plugin 中的错误,并且自 2018 年以来该插件没有更新,因此我们决定移动 mojo 插件。
原始执行情况如下:
<execution>
<id>uniqa</id> …Run Code Online (Sandbox Code Playgroud) 我想maven-jaxb2-plugin不要写'免责声明':
This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.2-hudson-jaxb-ri-2.2-63-
See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
Any modifications to this file will be lost upon recompilation of the source schema.
Generated on: 2011.08.01 at 09:20:43 AM CEST
Run Code Online (Sandbox Code Playgroud)
至少是时间戳.
谢谢.
你做.
我有一个简单的Java类,我用JAXB进行注释:
class Foo {
@XmlAnyElement(lax=true)
List<Object> any;
}
Run Code Online (Sandbox Code Playgroud)
其中产生以下架构:
<xs:complexType name="foo">
<xs:sequence>
<xs:any processContents="lax" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
Run Code Online (Sandbox Code Playgroud)
有没有办法为<any>元素设置名称空间属性,以便它生成如下:
<xs:any namespace="##targetNamespace" processContents="lax" maxOccurs="unbounded"/>
Run Code Online (Sandbox Code Playgroud) 我试图从两个XSD模式生成源.我的JAXBmaven插件看起来像这样:
<plugin>
<groupId>com.sun.tools.xjc.maven2</groupId>
<artifactId>maven-jaxb-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>GenerateKenexa</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<includeBindings>
<includeBinding>**/jaxb-bindings-kenexa.xml</includeBinding>
</includeBindings>
<includeSchemas>
<includeSchema>**/KenexaXMLConfiguration.xsd</includeSchema>
</includeSchemas>
</configuration>
</execution>
<execution>
<id>GenerateTalentQ</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<includeBindings>
<includeBinding>**/jaxb-bindings-talentq.xml</includeBinding>
</includeBindings>
<includeSchemas>
<includeSchema>**/TalentQXMLConfiguration.xsd</includeSchema>
</includeSchemas>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
第一个生成正常.但第二个没有.我在maven输出中看到:
[INFO] --- maven-jaxb-plugin:1.1.1:generate (GenerateKenexa) @ online.tests.management ---
[INFO] Compiling file:/D:/Projects/GTIWebApplications/gti_online_tests_management/src/main/resources/xsd/KenexaXMLConfiguration.xsd
[INFO] Writing output to D:\Projects\GTIWebApplications\gti_online_tests_management\target\generated-sources\xjc
[INFO]
[INFO] --- maven-jaxb-plugin:1.1.1:generate (GenerateTalentQ) @ online.tests.management ---
[INFO] files are up to date
Run Code Online (Sandbox Code Playgroud)
它说文件是最新的,但它们甚至都没有生成.可能有什么问题?
我正在使用jaxb2-marshaller生成类来与Web服务进行通信.使用一些wsdl文件生成Java类.
现在一切都还可以,但是当我尝试使用一些生成的类时,我得到了这个解组错误,尽管我使用生成的ObjectFactory类.
一些堆栈:
org.springframework.ws.soap.client.SoapFaultClientException: Unmarshalling Error: unexpected element (uri:"http://xxxxxxxxx", local:"customer"). Expected elements are <{}customer>
at org.springframework.ws.soap.client.core.SoapFaultMessageResolver.resolveFault(SoapFaultMessageResolver.java:38)
at org.springframework.ws.client.core.WebServiceTemplate.handleFault(WebServiceTemplate.java:826)
at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:621)
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555)
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390)
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:383)
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:373)
at einvoice.service.CustomerService.createCustomer(CustomerService.java:40)
at einvoice.controller.facturatie.FacturatieOverzichtController.handleRenderRequest(FacturatieOverzichtController.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Run Code Online (Sandbox Code Playgroud)
而我的班级:
@Service
public class CustomerService {
@Autowired
private WebServiceTemplate customerDaoTemplate;
private ObjectFactory customerObjectFactory;
public CustomerService() {
customerObjectFactory = new ObjectFactory();
}
public boolean createCustomer(Customer c)
{
System.out.println("CREATING CUSTOMER");
einvoice.proxy.customerdaoservice.Customer customer = customerObjectFactory.createCustomer();
customer.setConnectionURL("test");
customer.setUid("testuid");
customer.setName("KorneelTest");
Create create = customerObjectFactory.createCreate();
create.setCustomer(customer);
try
{
customerDaoTemplate.marshalSendAndReceive(customerObjectFactory.createCreate(create));
return true; …Run Code Online (Sandbox Code Playgroud) 当我从此处找到的 WSDL 文件生成 Java 类时:http : //wsdl-bug.s3.amazonaws.com/magento.xml,它成功生成了类但没有操作。
它为类型生成类,并为请求/响应参数生成类,但不为操作生成任何方法。
这是我的 Maven 插件配置:
<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>magento.wsdl</generatePackage>
<schemas>
<schema>
<url>http://wsdl-bug.s3.amazonaws.com/magento.xml</url>
</schema>
</schemas>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud) 我正在使用 Spring-WS 开发一个 Web 服务客户端。这不是我的第一个使用 Spring-WS 的 Web 服务项目。但我是这个特定项目的新手。
我们使用 maven-jaxb2-plugin 生成 dao 对象。
我正在使用 Spring-WS WebServiceTemplate,带有标准编组器和解组器集。
在之前的项目中,我可以使用以下方式进行 Web 服务调用:
webserviceTemplate.marshallSendAndReceive(new ObjectFactory().createSomeRequest());
Run Code Online (Sandbox Code Playgroud)
在我当前的项目中,我需要提供一个 SoapActionCallback,与 SoapActionUrl 一起提供。
webserviceTemplate.marshallSendAndReceive(new ObjectFactory().createSomeRequest, new SoapActionCallback("http://some-action-url.com/action"));
Run Code Online (Sandbox Code Playgroud)
如果我不提供此 SoapActionUrl,我不会得到结果,并且在调试时,我会看到一个受抑制的异常:
Couldn't get a SAX parser while constructing a envelope
Run Code Online (Sandbox Code Playgroud)
我想删除那些 SoapActionUrls。使用maven-jaxb2-plugin正确生成的对象,应该自动引用正确的actionurl吗?
我用谷歌搜索过这个,但没有找到太多关于它的信息。我想知道为什么我可以在第一种情况下“保留 SoapActionCallback”,而在第二种情况下,我有义务提供此信息。我不知道服务器端使用的具体技术,因为网络服务是由外部合作伙伴开发的。
有人可以解释一下吗?
我正在尝试从使用基本身份验证的 WSLD 文件生成 java 类。
虽然有很多插件,但我必须使用以下一个: org.jvnet.jaxb2.maven2:maven-jaxb2-plugin
随着wsimport还是wsdl2java我已经找到配置基本身份验证参数的方式。使用maven-jaxb2-plugin我没有运气。
我的配置如下:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.2</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<packageName>com.mycompany</packageName>
<sourceType>wsdl</sourceType>
<specVersion>2.2</specVersion>
<schemas>
<schema>
<url>https://some-url?wsdl</url>
</schema>
</schemas>
<outputDirectory>target/generated-sources/xjb</outputDirectory>
<clearOutputDir>false</clearOutputDir>
<useActiveProxyAsHttpproxy>true</useActiveProxyAsHttpproxy>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
正如预期的那样,构建失败并显示以下消息:
Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: https://some-url?wsdl
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1840)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:647)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:189)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:812)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2275)
... 36 more
Run Code Online (Sandbox Code Playgroud)
关于基本身份验证配置的任何想法?提前致谢!
注意:https://username:pass@some-url?wsdl,由于未经授权的请求,我仍然收到 …