小编joe*_*rgl的帖子

wsimport生成的客户端如何工作?

在此之前,我想让您知道我已经可以连接到Web服务服务器了.我问这个问题是因为我希望深入了解wsimport生成的客户端是如何工作的.根据我的研究,wsimport使用JAXWS.请注意,我不了解JAXWS.

我使用wsimport生成了我的客户端.我使用的WSDL来自Axis2 Web服务,由Axis2自动生成.下面的类是wsimport的结果:

com.datamodel.xsd

  • DataBeanRequest.java
  • DataBeanResponse.java
  • ObjectFactory.java
  • package-info.java

com.service

  • MyWebService.java
  • MyWebServicePortType.java
  • MyMethod.java
  • MyMethodResponse.java
  • ObjectFactory.java
  • package-info.java

使用上面的类,我可以告诉它com.datamodel.xsd包含Web服务服务器使用的bean(不包括ObjectFactorypackage-info).同时,MyMethodMyMethodResponse也用于设置的web服务方法/操作的请求和响应参数豆.

以下是我的问题:(如果你不知道我的一些问题的答案,你真的不必回答所有问题.:)请随时分享你认为我可能会觉得有用的任何信息.)

我是否正确

  • 我的上述假设是否正确?
  • 其他课程的功能是什么?
  • 我检查过MyWebService,它包含一个注释,指的是我用来生成客户端的WSDL的绝对位置.wsdllocation在客户端中指定的相关性是什么?客户如何使用该信息?
  • 我注意到Web服务的实际URL未在生成的任何类中声明.客户如何知道需要连接的位置?
  • 是否对WSDL文件进行了注释,以便客户端可以在连接时读取WSDL文件上的URL?如果是这样,那么是否意味着在必须建立新连接时始终读取WSDL文件?
  • 由于我需要编译我的应用程序并将其安装在不同的服务器上,因此将无效.我可以将其设置为相对路径而不是绝对路径吗?怎么样?(答案:是的,它可以设置为相对路径.该wsimport命令有一个wsdllocation属性,其中wsdllocation可以指定值.)
  • 如果我需要连接到HTTPS,该怎么办?如何设置服务器证书?
  • 当我使用wsimport生成客户端时以及使用Axis2或Apache CXF生成客户端时有什么区别.

java axis2 web-services jax-ws wsimport

30
推荐指数
1
解决办法
4万
查看次数

关于端点接口的jax-ws

用注释@WebService定义了一个Java接口 编译好的代码

例:

@WebService
public interface HelloWorldIfc{
Run Code Online (Sandbox Code Playgroud)

现在我尝试将端点接口定义为

 @WebService (endpointInterface = "com.ws.HelloWorldIfc")
    public interface HelloWorldIfc{
Run Code Online (Sandbox Code Playgroud)

这也很好

那么 - 我应该在接口上还是在实现类时定义端点接口?
这是任何用途的属性 - 它的目的是什么?
如果我不定义会发生什么 - 我会失去什么?
谢谢,
饱餐一顿

web-services jax-ws

11
推荐指数
1
解决办法
1万
查看次数

在Java中使用SAXON Xpath引擎

这是我的代码:

public static void main(String[] args) {

    // System.setProperty(
    // "javax.xml.xpath.XPathFactory", 
    // "net.sf.saxon.xpath.XPathFactoryImpl");

    String xml="<root><a>#BBB#</a><a>#CCC#</a><b><a>#DDD#</a></b></root>";
    try{
        JDocument dom = new JDocument(xml);

        XPathFactory factory = net.sf.saxon.xpath.XPathFactoryImpl.newInstance();
        XPath xpath = factory.newXPath();
        XPathExpression expr = xpath.compile("//a[matches(.,'#...#')]");

        Object result = expr.evaluate(dom, XPathConstants.NODESET);
        NodeList nodes = (NodeList) result;
        Nodes sharped = new Nodes(nodes);

        for (Node n:sharped){
            System.out.println(n.toString());
        }
    }
    catch(Exception e){
        e.printStackTrace();
    }

}
Run Code Online (Sandbox Code Playgroud)

我得到了这个:

javax.xml.transform.TransformerException: Impossible to find the function : matches
at org.apache.xpath.compiler.XPathParser.error(XPathParser.java:608)
at org.apache.xpath.compiler.XPathParser.FunctionCall(XPathParser.java:1505)
at org.apache.xpath.compiler.XPathParser.PrimaryExpr(XPathParser.java:1444)
at org.apache.xpath.compiler.XPathParser.FilterExpr(XPathParser.java:1343)
at org.apache.xpath.compiler.XPathParser.PathExpr(XPathParser.java:1276)
Run Code Online (Sandbox Code Playgroud)

这意味着org.apache.xpath.compiler.XPathParser …

java xpath saxon

7
推荐指数
1
解决办法
1万
查看次数

Java REST ful客户端代码是个问题

我试图在java中创建REST-ful Web服务.这个REST-ful Web服务包含Hibernate配置和Rest-ful配置.实际上java web服务是完美的.但是当我尝试执行该Web服务的客户端代码时.

我正在使用的jar文件是

activation
antlr-2.7.6
asm-3.1
asm-attrs
cglib-nodep
commons-collections-2.1.1
commons-fileupload-1.2.1
commons-io-1.3.2
commons-logging-1.1
dom4j-1.6.1
ehcache-1.2.3
ejb3-persistence
grizzly-servlet-webserver-1.7.3.2
hibernate-annotations
hibernate-commons-annotations
hibernate-entitymanager
hibernate-tools
hibernate3
http
javassist
jaxb-api
jaxb-impl
jaxb-xjc
jdbc2_0-stdext
jdom-1.0
jersey-core-1.7
jersey-server-1.7
jersey-spring
jersey
jettison-1.0-RC1
jsr173_api
jsr311-api
jta
mysql-connector-java-5.1.12-bin
osgi
rome-0.9
wadl2java
Run Code Online (Sandbox Code Playgroud)

我的问题是

Exception in thread "main" java.lang.NoSuchMethodError: com.sun.jersey.spi.inject.InjectableProviderContext.getInjectable(Ljava/lang/Class;Lcom/sun/jersey/spi/service/ComponentContext;Ljava/lang/annotation/Annotation;Ljava/lang/Object;Ljava/util/List;)Lcom/sun/jersey/spi/inject/Injectable;
        at com.sun.jersey.spi.service.ComponentConstructor.getConstructor(ComponentConstructor.java:139)
        at com.sun.jersey.impl.application.ComponentProviderCache.getComponent(ComponentProviderCache.java:177)
        at com.sun.jersey.impl.application.ComponentProviderCache.getProvidersAndServices(ComponentProviderCache.java:122)
        at com.sun.jersey.impl.application.MessageBodyFactory.getProviderMap(MessageBodyFactory.java:133)
        at com.sun.jersey.impl.application.MessageBodyFactory.initReaders(MessageBodyFactory.java:107)
        at com.sun.jersey.impl.application.MessageBodyFactory.init(MessageBodyFactory.java:102)
        at com.sun.jersey.api.client.Client.<init>(Client.java:284)
        at com.sun.jersey.api.client.Client.<init>(Client.java:209)
        at com.sun.jersey.api.client.Client.create(Client.java:429)
        at pack1.client.Test.main(Test.java:20)
Run Code Online (Sandbox Code Playgroud)

客户端Java代码是

package pack1.client;

import java.net.URI;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
import com.sun.jersey.api.client.Client; …
Run Code Online (Sandbox Code Playgroud)

java rest

6
推荐指数
1
解决办法
2万
查看次数

关闭单个窗口会关闭java中的所有帧

我希望能够在java中导航帧.每当我关闭一帧时,剩下的帧也会被打开关闭;整个程序停止.

请帮忙...

java swing frame

6
推荐指数
2
解决办法
7863
查看次数

UniversalConnectionPoolManagerMBean在应用程序"重新启动"后已经存在

当我部署一个在我的weblogic服务器上有一个servlet的application.war时,它运行正常.它使用一个实例UniversalConnectionPoolManagerMBean并启动正常.

在管理控制台中,我在工作完成时使用stop命令,并在我destroy()调用的方法中调用:

UniversalConnectionPoolManagerImpl.getUniversalConnectionPoolManager()
                .startConnectionPool(mConnectionPoolName);
Run Code Online (Sandbox Code Playgroud)

当我在管理控制台中单击"开始服务请求"命令时,我得到以下异常:

 java.sql.SQLException: Unable to start the Universal Connection Pool: java.sql.SQLException: Unable to start the Universal Connection Pool: oracle.ucp.UniversalConnectionPoolException: MBean exception occurred while registering or unregistering the MBean
at com.exzac.dal.jdbc.Database.getConnection(Database.java:134)
at com.exzac.dal.jdbc.Database.executeQuery(Database.java:161)
at com.exzac.profilesystem.ProfileSystemConfiguration.retrieveConfigurationTable(ProfileSystemConfiguration.java:214)
... 49 more
Caused by: java.sql.SQLException: Unable to start the Universal Connection Pool:     java.sql.SQLException: Unable to start the Universal Connection Pool: oracle.ucp.UniversalConnectionPoolException: MBean exception occurred while registering or unregistering the MBean
at oracle.ucp.util.UCPErrorHandler.newSQLException(UCPErrorHandler.java:541)
at oracle.ucp.jdbc.PoolDataSourceImpl.throwSQLException(PoolDataSourceImpl.java:587)
at oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java:276)
at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:646) …
Run Code Online (Sandbox Code Playgroud)

java webserver weblogic connection-pooling

6
推荐指数
1
解决办法
6112
查看次数