我正在使用一个Web服务,它在SOAP信封头中放置一个身份验证令牌.看来(通过查看WS WSDL附带的示例),如果在.NET中生成存根,则此标头信息通过存根类中的成员变量公开.但是,当我使用WSDL2Java生成Axis2 java存根时,它似乎不会在任何地方暴露.
从SOAP信封标题中提取此信息的正确方法是什么?
WSDL: http ://www.vbar.com/zangelo/SecurityService.wsdl
C#示例:
using System;
using SignInSample.Security; // web service
using SignInSample.Document; // web service
namespace SignInSample
{
class SignInSampleClass
{
[STAThread]
static void Main(string[] args)
{
// login to the Vault and set up the document service
SecurityService secSvc = new SecurityService();
secSvc.Url = "http://localhost/AutodeskDM/Services/SecurityService.asmx";
secSvc.SecurityHeaderValue = new SignInSample.Security.SecurityHeader();
secSvc.SignIn("Administrator", "", "Vault");
DocumentServiceWse docSvc = new DocumentServiceWse();
docSvc.Url = "http://localhost/AutodeskDM/Services/DocumentService.asmx";
docSvc.SecurityHeaderValue = new SignInSample.Document.SecurityHeader();
docSvc.SecurityHeaderValue.Ticket = secSvc.SecurityHeaderValue.Ticket;
docSvc.SecurityHeaderValue.UserId = secSvc.SecurityHeaderValue.UserId;
}
}
} …Run Code Online (Sandbox Code Playgroud) 我正在尝试连接到第三方SOAP Web服务.当HTTP SOAPAction头是空字符串("")时,服务似乎可以工作.这是wsdl的片段:
<wsdl:binding name="detailsRequestMessage" type="tns:UssdPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="details">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
Run Code Online (Sandbox Code Playgroud)
你在哪里看到soapAction =""
我生成了一个stubis Axis2(1.5)wsdl2java.
我希望得到以下内容(使用SoapUI运行时成功输出):
POST /details HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
User-Agent: Jakarta Commons-HttpClient/3.1
Host: some.host
Content-Length: 323
Run Code Online (Sandbox Code Playgroud)
但相反,我得到:
POST /details HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SOAPAction: "http://some.url/wsussd/ussdtypes/UssdPortType/detailsRequest"
User-Agent: Axis2
Host: some.host
Content-Length: 300
Run Code Online (Sandbox Code Playgroud)
有谁知道这是什么问题或如何在程序中设置soapAction.
谢谢,罗恩
我正在使用Axis2 1.5.1(wsdl2java)从给定的WSDL文件生成代码(客户端存根).
Web服务由外部应用程序提供.
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility- 1.0.xsd"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:tns="http://tempuri.org/"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:i0="http://schemas.microsoft.com/ws/2005/02/mex/bindings"
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:wsa10="http://www.w3.org/2005/08/addressing"
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
name="service" targetNamespace="http://tempuri.org/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:include schemaLocation="SampleApp.App.ApplicationManager.RemoteApplication0.xsd" />
<xsd:include schemaLocation="SampleApp.App.ApplicationManager.RemoteApplication1.xsd" />
<xsd:include schemaLocation="SampleApp.App.ApplicationManager.RemoteApplication2.xsd" />
<xsd:include schemaLocation="SampleApp.App.ApplicationManager.RemoteApplication3.xsd" />
</xsd:schema>
</wsdl:types>
...
</wsdl:definition>
Run Code Online (Sandbox Code Playgroud)
RemoteApplication0.xsd的内容如下:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://schemas.microsoft.com/Message"
elementFormDefault="qualified"
targetNamespace="http://schemas.microsoft.com/Message"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="MessageBody">
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="##any" />
</xs:sequence>
</xs:complexType>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
命令行:
wsdl2java -ss -g -d adb -or -p com.sampleapp.ws.generated.client -uri SampleRemoteProcess.wsdl
Run Code Online (Sandbox Code Playgroud)
生成过程会导致异常.
堆栈跟踪:
Using AXIS2_HOME: …Run Code Online (Sandbox Code Playgroud) 请帮助:我试图从SOAPUI调用WebService,我注意到该服务需要用户名和密码,我通过请求参数提供.我注意到原始XML包含添加到SOAPHeader的用户/密码片段.摘录如下:
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken wsu:Id="UsernameToken-3" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsse:Username>testuser</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">testpassword&</wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">RYadQak91mr7dB+5hyt8yw==</wsse:Nonce><wsu:Created>2011-10-24T20:13:43.039Z</wsu:Created></wsse:UsernameToken>
</wsse:Security>
Run Code Online (Sandbox Code Playgroud)
现在我想通过添加用户/密码详细信息来实现同样的目的,如下面的代码所示:代码片段是:
org.tempuri.myService.MyServiceStub stub = new org.tempuri.myService.MyServiceStub();
ServiceClient sc = stub._getServiceClient();
HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
auth.setUsername("testuser");
auth.setPassword("password$");
sc.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,auth);
org.tempuri.myService.MyServiceDocument myService4 = (org.tempuri.myService.MyServiceDocument)getTestObject(org.tempuri.myService.MyServiceDocument.class);
MyService lval = MyService4.addNewMyService();
MyServiceParameters lvParams = lval.addNewParameters();
lvParams.setA("24");
lvParams.setB("10");
lval.setParameters(lvParams);
myService4.setMyService(lval);
Run Code Online (Sandbox Code Playgroud)
但我得到了Axis故障异常,需要帮助我正在用上面的代码做的错误.轴故障异常详细信息:
org.apache.axis2.AxisFault: Exception occurred while executing service 'MyService'.
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.tempuri.myService.MyServiceStub.myService(MyServiceStub.java:182)
at org.tempuri.myService.MyServiceTest.main(MyServiceTest.java:55)
MyServiceResponseDocument lvdoc = stub.myService(myService4);
Run Code Online (Sandbox Code Playgroud) 我正在使用Coldfusion 10构建SOAP Web服务,我在IIS 7.5上运行,Coldfusion通过AJP 1.3连接器连接到独立的Java Tomcat服务器.
我正在达到对我的服务器将接受的SOAP请求大小的4-8KB限制,如果超过该限制,则重置连接 - 不会显示错误.
但在我的CF日志中,我得到:
The fault returned when invoking the web service operation is:<br> <pre>org.apache.axis2.AxisFault: Connection reset at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197) at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:402) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) at reverserisk_ncm.Reverserisk_ncmStub.dumpHeader(Reverserisk_ncmStub... The specific sequence of files included or processed is: C:\rr1.5\Clarence\webservice\test_ncm.cfm, line: 36
Run Code Online (Sandbox Code Playgroud)
我尝试了一些事情,首先我确保它是一个大小限制,添加睡眠30秒产生相同的结果,所以我尝试:
如果有人遇到类似的问题,那就太棒了,我知道这也可能是一个ServerFault问题 - 但希望有人在CF上做过类似的东西,谢谢!
我是java web服务和apache axis2的新手.每次运行我的客户端时都会收到一条错误,即传入消息的输入流为空.问题可能是什么?我附上了我的日志log4j:WARN No appenders could be found for logger (org.apache.axis2.util.Loader).
log4j:WARN Please initialize the log4j system properly.
org.apache.axis2.AxisFault: The input stream for an incoming message is null.
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:92)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.csapi.www.wsdl.parlayx.sms.notification_manager.v2_3.service.SmsNotificationManagerServiceStub.startSmsNotification(SmsNotificationManagerServiceStub.java:619)
at org.di.custom.Notification.startNotification(Notification.java:142)
at org.di.custom.Notification.main(Notification.java:57).
亲爱的Stackoverflow用户,我最近在使用Spring框架的axis2 Web服务的一个特定问题时遇到了很多痛苦.我已经阅读了很多不同的指南并阅读了不同的论坛,但发现人们有同样的问题,但没有解决方案.基本上最后用双手握住显示器并大喊"你发现了什么是BudapestHacker938?".无论如何,我的axis2 Web服务类需要Spring bean,因此它们在Web服务类中自动装配.在我有servletContext的jetty服务器里,一切都运行良好.只需在web.xml中定义所需的侦听器即可.这样的幸福.但不幸的是,在某些方面所有好事都落到了尽头,对我来说,魔鬼是大型机内部的CICS环境.Jetty/Tomcat中没有servletcontext,幸运的是,它仍然支持axis2.因此,根据不同的用户指南,我决定将我的网络服务存档到.aar并将其添加到services文件夹下.Axis2文件夹结构如下:
当我构建这个.aar存档时,我也在生成我自己的wsdl,而不是使用axis2内置的wsdl生成器,根据services.xml生成给定类的服务(当我运行axis2server时,不使用因为doesn'就我所知,我喜欢JAX-WS注释.要初始化Spring框架,我需要编写初始化Spring bean的SpringInit类.不幸的是,由于某种原因它也会根据其注释初始化我的web服务类,然后占用主端口(怀疑SpringInit通过自己的Web服务类初始化,因为它也被定义为Spring bean而SpringInit扩展了Axis2类ServiceLifeCycle)我得到JVM BIND异常,它说明地址已被使用.我希望根据存储在WSDL内部的wsdl构建服务,而不是生成新服务,因为我有各种环境:1)本地机器 - Jetty 2)大型机.无论如何,我深入了解了我的services.xml:
<service name="Absence" class="org.services.SpringInit">
<description>
random description
</description>
<parameter name="ServiceTCCL">composite</parameter>
<parameter name="useOriginalwsdl" locked="false">true</parameter>
<parameter name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier</parameter>
<parameter name="ServiceClass">org.services.Absence</parameter>
<parameter name="SpringBeanName">absence</parameter>
<parameter name="SpringContextLocation">META-INF/applicationContextAar.xml</parameter>
</service>
Run Code Online (Sandbox Code Playgroud)
Spring applicationContextAar.xml,为亲爱的Stack社区进行了一点点重构:
<beans>
<bean id="applicationContext" class="org.apache.axis2.extensions.spring.receivers.ApplicationContextHolder" />
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>
<bean id="ds" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.h2.Driver" />
<property name="url" value="jdbc:h2:tcp://localhost/~/devDb" />
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
<bean id="absence" class="org.services.Absence"></bean>
<bean id="jtemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
<constructor-arg ref="ds"></constructor-arg>
</bean>
<bean id="datasetFactory" class="org.vsam.DataSetFactory"></bean>
<bean id="dataManagerFactory" class="org.datamanager.DataManagerFactory"></bean>
<bean …Run Code Online (Sandbox Code Playgroud) 我一直试图找出错误的确切原因,这看起来像许多人使用Axis的常见错误,但我无法用任何我能够在网上找到的东西修复它们.
我能看到我的服务
http://localhost:8080/axis2/services/listServices. when i hit the service epr on browser
http://localhost:8080/axis2/services/AuthService, it is working fine also.
Run Code Online (Sandbox Code Playgroud)
我使用SoapUI及其工作测试了该服务.但我想知道为什么当我点击listServices页面中的以下链接时,我看不到wsdl:
http://localhost:8080/axis2/services/AuthService?wsdl>. I get this error
Run Code Online (Sandbox Code Playgroud)
org.apache.axis2.AxisFault:服务器没有wsdl的epr ==>
https://localhost:8080/services/TestService?wsdl>
at org.apache.axis2.description.AxisService.getLocationURI(AxisService.java:1615)
at org.apache.axis2.description.AxisService.setPortAddress(AxisService.java:1498)
at org.apache.axis2.description.AxisService.printDefinitionObject(AxisService.java:1078)
at org.apache.axis2.description.AxisService.printUserWSDL(AxisService.java:1112)
at org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1386)
at org.apache.axis2.transport.http.ListingAgent.handleWSDLRequest(ListingAgent.java:327)
at org.apache.axis2.transport.http.ListingAgent.processListService(ListingAgent.java:183)
at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.highradius.payrad.HeaderFilter.doFilter(HeaderFilter.java:182)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) …Run Code Online (Sandbox Code Playgroud) 我正在将WSO2 DSS 3.2.2服务器升级到3.5.0,但我最终收到此错误:
Caused by: java.lang.ClassNotFoundException: org.apache.axis2.transport.tcp.TCPTransportSender cannot be found by axis2_1.6.1.wso2v15
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:195)
at org.apache.axis2.util.Loader.loadClass(Loader.java:261)
at org.apache.axis2.deployment.AxisConfigBuilder.processTransportSenders(AxisConfigBuilder.java:686)
Run Code Online (Sandbox Code Playgroud)
这是配置问题还是我需要添加特定的JAR库?如果是的话,哪一个?
编辑:我刚刚发现axis2_1.6.1.wso2v10.jar有这个org.apache.axis2.transport.tcp.TCPTransportSender类,但是axis2_1.6.1.wso2v15.jar没有.
在这里清晰可见,Axis 2 Maven依赖项有几个版本高于1.6.3版本.但是,当我在Eclipse中构建(实际上当我编辑并保存我的pom.xml)时,它们都无法下载.我有一个java 8项目和版本1.5.4到1.6.3所有工作.当我将它们添加到我的pom.xml中时,它们会自动出现在我的maven依赖项中.当我尝试1.6.4 - 1.7.3之间的任何版本时,我的pom.xml中出现了一个缺失的工件错误,就像它们在中央存储库中找不到一样.
我使用Eclipse Mars的嵌入式Maven 3.3.可能是它链接到一个不包含ne版本的过时的存储库?如何将其连接到另一个存储库(我已经检查了Preferences/Maven以设置此属性但未找到它).另外,什么是一个好的"中央"存储库?
axis2 ×10
java ×5
soap ×4
web-services ×3
wsdl ×2
cics ×1
coldfusion ×1
header ×1
iis ×1
integration ×1
mainframe ×1
maven ×1
soapheader ×1
spring ×1
wsdl2java ×1
wso2 ×1