我之前使用wsimport生成了一个Metro客户端,但在这种情况下,WSDL是通过https访问的.我的命运看起来像这样:
wsimport https://service.net/services/Service?wsdl -d C:\ClientProject\src\main\java -keep
Run Code Online (Sandbox Code Playgroud)
一切都很好.现在我正在尝试生成一个客户端,但是,我只有一个WSDL文件的本地副本.我的项目目录设置如下(在c:\ Devel中):
ClientProject
|- src
|- main
|- java
|- resources
|- META-INF
|- service.wsdl
|- wsimport.bat
Run Code Online (Sandbox Code Playgroud)
wsimport.bat文件如下所示:
wsimport -keep -d ../src/main/java -wsdlLocation ../src/resources/META-INF/service.wsdl
Run Code Online (Sandbox Code Playgroud)
它基于Metro Guide示例,但没有-p选项(http://metro.java.net/guide/Developing_client_application_with_locally_packaged_WSDL.html).但是,当我运行bat文件时,我得到一个无限循环的命令被打印到控制台.例如
C:\Devel\ClientProject>wsimport -keep -d ../src/main/java -wsdlLocation ../src/resources/META-INF/service.wsdl
Run Code Online (Sandbox Code Playgroud)
有人可以指出我做错了什么吗?
UPDATE
我尝试使用绝对路径(并重新排列参数顺序无济于事.我仍然得到无尽的命令控制台打印:
wsimport C:\Devel\ClientProject\src\resources\META-INF\service.wsdl -d C:\Devel\ClientProject\src\main\java -keep
Run Code Online (Sandbox Code Playgroud) 这是我第一次尝试使用 JMS。我已经成功创建/部署了一个 war 文件,其中包含一个可用于上传文件的 servlet。上传文件时,它会向 JMS 队列发送一条消息。接下来,我编写了一个侦听器来从队列中检索上传的消息,但是当我尝试部署它时,出现以下错误:
SEVERE: Invalid ejb jar [file-listener-ejb-1.0.jar]: it contains zero ejb.
Note:
1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message- driven bean.
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.
at …Run Code Online (Sandbox Code Playgroud) 我熟悉使用Jersey创建RESTful webservice服务器和客户端,但由于类加载问题,我试图将Jersey客户端转换为CXF.我相信我想使用以HTTP为中心的客户端,但我们不使用Spring.我们需要使用基本的HTTP身份验证.的用户指南具有本实施例中:
WebClient client = WebClient.create("http:books", "username", "password", "classpath:/config/https.xml");
Run Code Online (Sandbox Code Playgroud)
第一个参数不是URI字符串.它是Spring使用的格式吗?这个方法只能用于使用Spring创建WebClient吗?
执行身份验证的另一种方法是添加标头字符串:
String authorizationHeader = "Basic " + org.apache.cxf.common.util.Base64Utility.encode("user:password".getBytes());
webClient.header("Authorization", authorizationHeader);
Run Code Online (Sandbox Code Playgroud)
我猜这"user:password"应该用真实的价值观代替,但我会很感激确认.
我有一个JAX-RS Web服务,它使用JPA实体类.我有一个像这样的资源类:
@Path("/entity")
public class MyEntityResource
{
@GET
@Produces(MediaType.APPLICATION_XML)
@Path("/{entity}")
public MyEntity getMyEntity(@PathParam("entity") String entity)
{
log.debug("Entering getMyEntity with param: " + entity);
MyEntity entityObject = genericService.find(MyEntity.class, entity);
if (entityObject == null)
{
log.debug("Entity not found.");
throw new WebApplicationException(Response.Status.NOT_FOUND);
}
log.debug("Exiting getMyEntity");
return entityObject;
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行该服务并对该实体进行get调用时,我收到此错误:
SEVERE: The response of the WebApplicationException cannot be utilized as the response is already committed. Re-throwing to the HTTP container
javax.ws.rs.WebApplicationException: javax.xml.bind.MarshalException
- with linked exception:
[Exception [EclipseLink-25003] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): …Run Code Online (Sandbox Code Playgroud) 我想使用New Maven Project向导使用原型在Eclipse中创建一个新的Maven项目.在"选择原型"步骤中,我有三个目录可供选择:Nexus Indexer,Internal和Default Local.我不明白这些目录的内容应该来自哪里.如果我点击"配置"按钮,它们都是灰色的,我无法修改它们.
只有Internal目录中列出了任何原型.这些原型来自哪里?它不是来自我的本地Maven存储库,因为组/工件不在其中(并且未列出repo中的原型).
为什么Nexus Indexer列表是空的?我已经阅读了一些Nexus索引需要更新的帖子,但不知道如何更新.这与存储库索引(计划每天更新)不同.
正如您所看到的,我对整个目录业务以及Maven,m2eclipse和Nexus的交互方式有点困惑.任何澄清都是最受欢迎的!
我的设置:
我的本地Maven settings.xml如下所示:
<settings>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://myserver:8080/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository> …Run Code Online (Sandbox Code Playgroud) 我编写了Jersey RESTful客户端,它们使用Dumb X509TrustManager和HostnameVerifier来信任我们实验室系统上的所有SSL证书,以便更轻松地处理自签名的证书.
ClientConfig config = new DefaultClientConfig();
SSLContext context = null;
try
{
context = SSLContext.getInstance("SSL");
context.init(null,
new TrustManager[] { new DumbX509TrustManager() },
null);
config.getProperties()
.put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
new HTTPSProperties(this.getHostnameVerifier(),
context));
webClient = Client.create(config);
}
....
Run Code Online (Sandbox Code Playgroud)
有没有办法让我使用CXF做类似的事情?
我试图通过Maven发布插件进行发布,并且遇到了SCM配置问题.我正在使用安装了m2eclipse的Eclipse.我们使用Mercurial并在我的机器(Win7)上安装了TortoiseHg.我有一个创建jar的测试项目.我们为项目使用超级pom,因此测试项目pom也可以.我在超级pom中设置了这个:
<build>
<plugins>
....
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin
<version>1.6</version>
<configuration>
<connectionType>connection</connectionType>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
我的测试项目pom看起来像这样:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>my.group</groupId>
<artifactId>TestJar
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>my.group</groupId>
<artifactId>super-pom</artifactId>
<version>1.0</version>
</parent>
<scm>
<connection>
scm:hg:ssh://our.scm.server:22//path/to/TestJarProject
</connection>
<developerConnection>
scm:hg:ssh://our.scm.server:22//path/to/TestJarProject
</developerConnection>
</scm>
</project>
Run Code Online (Sandbox Code Playgroud)
请注意,我们ssh到我们的SCM服务器.我怀疑我遇到的一些问题与此有关.我只能找到使用http的例子.
在我的settings.xml文件中,我添加了这个:
<servers>
...
<server>
<id>our.scm.server</id>
<username>username</username>
<password>password</password>
</server>
</servers>
Run Code Online (Sandbox Code Playgroud)
当我运行release:prepare release:perform时,会弹出一个TortoisePlink对话框,提示我输入密码.对话框询问"@ our.scm.server的密码".
它似乎没有使用settings.xml文件中的用户名或密码,这是我期望通过向其添加服务器元素.应该是吗?我也尝试将我的用户名添加到连接网址:
<connection>
scm:hg:ssh://username@our.scm.server:22//path/to/TestJarProject
</connection>
Run Code Online (Sandbox Code Playgroud)
但仍然提示输入空用户名的密码.
问题一
做Maven发布时有没有人成功使用ssh连接到Mercurial?
由于我最终想要在Hudson中进行构建,因此我设置了一个Hudson作业来进行发布,但它失败并出现此错误:
[INFO] o.h.m.e.h.MavenExecutionResultHandler - Build failed with exception(s)
[INFO] o.h.m.e.h.MavenExecutionResultHandler - [1] org.apache.maven.lifecycle.\
LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:\
maven-release-plugin:2.0:prepare (default-cli) …Run Code Online (Sandbox Code Playgroud) 我试图找到一个工具,允许我测试multipart/form-data POST请求并调整请求.具体来说,我想测试内容类型标题中是否存在分号:
multipart/form-data; boundary=140f0f40c9f411e19b230800200c9a66
Run Code Online (Sandbox Code Playgroud)
我们有一个不发送分号的客户端,我们的新servlet(使用Apache Commons FileUpload)无法解析上传的文件.旧版本的servlet使用不同的库方法来接受/解析请求,它可以解析文件.在我通过包含分号来证明请求将成功之前,客户端应用程序的所有者不希望对其进行任何更改.
我一直在使用cURL来对servlet运行我的测试,但我不能调整它生成的请求以排除分号.我已经尝试了Firefox和Fiddler的Poster插件来生成测试POST请求,但是它们导致了这个错误:
org.apache.commons.fileupload.FileUploadException: Stream ended unexpectedly
Run Code Online (Sandbox Code Playgroud)
有没有人找到一种方法来成功测试带有上传文件的multipart/form-data POST请求?
我最近在我的计算机上安装了 Windows 版 Git ( https://git-scm.com/download/win ),但在查找全局 .gitconfig 文件时遇到问题(请参阅 stackoverflow.com/questions/39670247/cant-find-global- gitconfig-文件/39671485)。
原来它位于共享/网络驱动器上。为什么 Git 要把全局 .gitconfig 文件放在那里?
有没有办法记录使用 ResteasyClientBuilder 创建的客户端发出的传出 HTTP 请求?
我们的一个服务向另一个服务发出的请求存在问题,并且想要查看 RESTEasy/JBoss EAP 7 正在创建/发送的实际 HTTP 请求的标头、正文等。