我正在使用Maven2创建一个使用多个Web服务的客户端.我仅限于使用Axis2或支持Apache HttpClient作为HTTP管道的其他框架,因为这些服务需要与基于托管证书解决方案的集成集成HttpClient.
我熟悉CXF的代码生成Maven插件,允许在代码生成期间输入多个WSDL.但是,Axis2代码生成插件一次只能处理一个WSDL.
如何wsdl2code在代码生成阶段为每个WSDL 运行Maven ?我需要多个配置文件吗?
POM的构建部分如下所示:
<build>
<plugins>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>wsdl2code</goal>
</goals>
</execution>
</executions>
<configuration>
<unpackClasses>true</unpackClasses>
<databindingName>adb</databindingName>
<packageName>org.example.stackoverflow.axis2-maven</packageName>
<!-- only one of these actually gets used by code generator -->
<wsdlFile>src/main/resources/service1.wsdl</wsdlFile>
<wsdlFile>src/main/resources/service2.wsdl</wsdlFile>
<outputDirectory>target/generated-sources</outputDirectory>
<syncMode>sync</syncMode>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
请帮助我目前正在构建一个系统,允许一些webservices(Axis2)调用restful(jersey 1.12),方案是这样的:
客户端 - > webservice(Axis2) - > restful services(Jersey 1.12)...在tomcat中运行Apache 7每当我尝试调用jersey时都会出现一些问题.说
java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl
Run Code Online (Sandbox Code Playgroud)
这里是apache中的完整错误,
[ERROR] java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.jav
a:212)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic
(RPCMessageReceiver.java:117)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusines
sLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMe
ssageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReq
uest(HTTPTransportUtils.java:172)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:1
46)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal …Run Code Online (Sandbox Code Playgroud) 我正在连接到具有axis/rampart的web服务,并被告知要删除InclusiveNamespaces,因为prefixList是"",这是不允许的.我怎么做?
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsa soapenv" />
</ds:CanonicalizationMethod>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<ds:Reference URI="#Id-289005241">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="" />
</ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<ds:DigestValue>bla bla bla=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
Run Code Online (Sandbox Code Playgroud)
是否可以将轴/ rampart配置为在其为空时不打印包含名称空间?
我正在使用axis/rampart 1.6.2并连接到.NET服务
任何想法如何存档?或者我如何使它呈现非空前缀列表?
我正在尝试弄清楚如何使用ADB Axis2 1.5版客户端进行基本身份验证.
我正在尝试以下方法:
HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator();
basicAuth.setUsername(username);
basicAuth.setPassword(password);
final Options clientOptions = serviceStub._getServiceClient().getOptions();
clientOptions.setProperty(HTTPConstants.AUTHENTICATE, basicAuth);
Run Code Online (Sandbox Code Playgroud)
但是这不起作用,并且未添加消息头中所需的行.
所以我对Web服务有点新意,最近出现了一种情况,我们在数据类型中添加了一个返回给客户端的元素.客户抱怨这打破了他们的实施,因为它扼杀了它没想到的新元素.(我们通过Axis2提供服务).
对我来说,这似乎是一个无害的变化,客户端应该能够优雅地处理(我已经使用了一些非Web服务框架,其中添加可选信息是完全可以接受的).我可以理解,如果我们删除或重命名了一些会导致客户端出现问题的字段.
基本上我希望wsdl像界面一样.如果我们进行基本上是接口的子类型的更改,我希望客户端愉快地忽略无关的元素.这只是网络服务的短暂出现,还是有一种理智的方式对服务进行被动更改,以便新客户可以获得额外的数据,而老客户可以在闲暇时更新?
我有一个WCF客户端连接到基于Java的Axis2 Web服务(在我的控制之外).它即将应用WS-Security,我需要修复.NET客户端.但是,我正在努力提供正确的身份验证.我知道WSE 3.0可能会让它变得更容易,但我宁愿不再使用过时的技术.
SOAP消息应如下所示:
<wsse:UsernameToken>
<wsse:Username><!-- Removed--></wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"><!-- Removed--></wsse:Password>
<wsse:Nonce><!-- Removed--></wsse:Nonce>
<wssu:Created>2010-05-28T12:50:33.675+01:00</wssu:Created>
</wsse:UsernameToken>
Run Code Online (Sandbox Code Playgroud)
但是,我的看起来像这样:
<s:Header>
<h:Security xmlns:h="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"></h:Security>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>2010-06-23T10:31:23.441Z</u:Created>
<u:Expires>2010-06-23T10:36:23.441Z</u:Expires>
</u:Timestamp>
<o:UsernameToken u:Id="uuid-d329b3b2-6a1f-4882-aea6-ec6b8a492de7-1">
<o:Username>
<!-- Removed-->
</o:Username>
<o:Password>
<!-- Removed-->
</o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
Run Code Online (Sandbox Code Playgroud)
我的客户端看起来像这样:PS注意所需的 SecurityHeaderType参数.那是什么?
public MyAck SendRequest(MyRequest request)
{
RemoteServicePortTypeClient client = new RemoteServicePortTypeClient();
client.ClientCredentials.UserName.UserName = "JAY";
client.ClientCredentials.UserName.Password = "AND";
// what is the difference between the two different Credential …Run Code Online (Sandbox Code Playgroud) 我一直在努力应对以下错误,过去几天你可以帮忙!
我使用wsdl 2.0文件中的wsdl2java工具生成了我的服务器和客户端代码.在调用webservice时,我收到以下错误:
org.apache.axis2.AxisFault: The endpoint reference (EPR) for the
Operation not found is
/axis2/services/MyService/authentication/?username=Denise345&password=xxxxx
and the WSA Action = null
Run Code Online (Sandbox Code Playgroud)
我的服务显示在axis2网页上,包含所有可用方法.这是TcpMon的输出
==============
Listen Port: 8090
Target Host: 127.0.0.1
Target Port: 8080
==== Request ====
GET /axis2/services/MyService/authentication/?username=Denise345&password=xxxxx
HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
SOAPAction: ""
User-Agent: Axis2
Host: 127.0.0.1:8090
==== Response ====
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: application/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 12 May 2011 15:53:20 GMT
Connection: close
12b
<soapenv:Reason xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Text xml:lang="en-US">The endpoint reference (EPR) for the …Run Code Online (Sandbox Code Playgroud) 我们正在将WebLogic 10.3.5 Web应用程序迁移到WebLogic 12.1.3,并且我们遇到了一个我们认为可能与Web服务安全性相关的问题.该应用程序使用Axis 1.5.6调用SOA Suite SOAP服务(仍在WebLogic 10.3.5上运行).禁用Web服务安全性后,我们会收到预期的响应:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns3:getNamesResponse
xmlns:ns2="http://www.example.com/ABC/Common"
xmlns:ns3="http://www.example.com/ABC/Profile">
<ns3:OperatingName>
<ns3:Number>123456789</ns3:Number>
<ns3:Name>Company Name, Inc.</ns3:Name>
</ns3:OperatingName>
</ns3:getNamesResponse>
Run Code Online (Sandbox Code Playgroud)
但是一旦启用了Web服务安全性(使用Apache Rampart 1.5.2,Apache Neethi 2.0.5),我们就会开始收到空响应:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:getNamesResponse
xmlns:ns2="http://www.example.com/ABC/Profile"
xmlns:ns4="http://www.example.com/ABC/Common" />
Run Code Online (Sandbox Code Playgroud)
奇怪的是,在查看SOA套件控制台时,SOA中的响应回到Web应用程序(启用了安全性)看起来是正确的:
<message>
<properties>
<property name="tracking.compositeInstanceId" value="2110209"/>
<property name="tracking.ecid" value="0058XKIkdpHFw00Fzzw0w00004Et005Kmk"/>
<property name="ws.wsu.id" value="Body-Body_tTzuB5XmRNQPR7Y7"/>
</properties>
<parts>
<part name="getNamesResponse">
<bp:getNamesResponse>
<bp:OperatingName>
<bp:Number>123456789</bp:Number>
<bp:Name>Company Name, Inc.</bp:Name>
</bp:OperatingName>
</bp:getNamesResponse>
</part>
</parts>
</message>
Run Code Online (Sandbox Code Playgroud)
没有记录异常.还有其他人经历过并解决过这类问题吗?
我在Openshift中创建了一个Tomcat 7应用程序,并在那里部署了我的Web服务.问题是我的Web服务应该调用另一个服务.没有显示结果.我测试了localhost中的服务,它工作得很好但不是在openshift中!
我应该将服务的URL更改为myapp-myDomain.rhcloud.com吗?或者有什么问题?
更新
它是否与端口转发有关,因为我的应用程序试图调用部署在tomcat中的另一个Web服务以及另一个来自wsdl url地址的外部服务(扮演客户端Web服务的角色),所有部署在Openshift中?
我收到以下异常,看起来像某种Permission问题WRT Axis上Openshift.
完成StackTrace
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
org.apache.axis2.AxisFault: Permission denied
org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197)
org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
java.net.BindException: Permission denied
java.net.PlainSocketImpl.socketBind(Native Method)
java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
java.net.Socket.bind(Socket.java:631)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:139)
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:125)
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:621)
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Run Code Online (Sandbox Code Playgroud)
这里有一个带有详细信息的简单示例
我正在尝试使用Axis2和构建一个使用外部服务器应用程序的客户端应用程序rampat 1.6.
检查SOAP请求时,一切似乎都很好,因为SOAP按预期加密和签名.以下是用于此目的的policy.xml文件:
<wsp:Policy wsu:Id="MyPolicy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"
xmlns:wsam="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wst="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.0#SAMLAssertionID">
<wsp:ExactlyOne>
<wsp:All>
<sp:SignedSupportingTokens xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
<wsp:Policy>
<sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient" />
</wsp:Policy>
</sp:SignedSupportingTokens>
<sp:SymmetricBinding>
<wsp:Policy>
<sp:ProtectionToken>
<wsp:Policy>
<sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
<wsp:Policy>
<sp:RequireIssuerSerialReference/>
<sp:WssX509V3Token10/>
</wsp:Policy>
</sp:X509Token>
</wsp:Policy>
</sp:ProtectionToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic128/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:IncludeTimestamp/>
<sp:Layout>
<wsp:Policy>
<sp:Strict/>
</wsp:Policy>
</sp:Layout>
<sp:OnlySignEntireHeadersAndBody/>
</wsp:Policy>
</sp:SymmetricBinding>
<sp:EncryptedParts>
<sp:Body />
</sp:EncryptedParts>
<sp:SignedParts>
<sp:Body/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="ReplyTo"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="To"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="From"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="AckRequested"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="CreateSequence"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="Sequence"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="MessageID"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" …Run Code Online (Sandbox Code Playgroud)