目前我们有一个包含多个模块的Web应用程序.我们正在使用以下技术堆栈
应用服务器: IBM Websphere 7.0(生产),Apache Tomcat 7.0.X(开发)我们使用JAX-WS注释将类标记为Web服务,除此之外我们不在Data Objects中使用任何JAXB注释,我们将离开这个任务为ws运行时.
在Apache Tomcat上部署应用程序后,Web服务不会在AS上发布.作为解决方案,我们需要在spring上下文文件中添加"org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter"属性,然后Web服务才能完美地运行.但是当我们在WAS上部署应用程序时,Web服务无需设置前面提到的属性即可发布.当我们向网络服务提出第一个请求时,它反应缓慢,在此问题的研发期间我们发现了以下内容;
className_used_in_web_service_method$JaxbAccessorM_getFieldName_setFieldName_java_util_Set from: <unknown>
层次结构中的所有类一样.这只是第一次发生.我们试图在应用程序启动时加载这些,但无法成功.任何人都可以帮助我们解决这个问题吗?我正在从ColdFusion 9升级到ColdFusion 2016,我的网络服务突然不再起作用了.我相信这是因为Axis 2是在Cold Fusion 10中引入的,并且它使我现有的Web服务无法正常运行.
即使我在ColdFusion Administrator中将Web服务版本设置为1,它仍然无效.
我称这些Web服务的方式是createObject
这样的功能:
<cfscript>
objSoapHeader = XmlParse("<wsse:Security mustUnderstand=""true"" xmlns:wsse=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd""><wsse:UsernameToken><wsse:Username>USERNAME</wsse:Username><wsse:Password>PASSWORD</wsse:Password></wsse:UsernameToken></wsse:Security>");
Application.UserWebService = CreateObject("webservice", PATH & "Requests/UserService.asmx?WSDL");
addSOAPRequestHeader(Application.UserWebService,"","",objSoapHeader,true);
// Get the .Net resources
Application.NetResources = Application.UserWebService.GetNetResources();
</cfscript>
Run Code Online (Sandbox Code Playgroud)
我收到的错误是:
无法执行Web服务调用GetNetResources.
调用Web服务操作时返回的错误是:java.lang.RuntimeException:从数据源获取解析器时出错:LanguageHeader不能为null!
它表明LangaugeHeader
不可能null
.WSDL显示与GetNetResources
操作关联的两条消息:
<wsdl:portType name="UserServiceSoap">
<wsdl:operation name="GetNetResources">
<wsdl:input message="tns:GetNetResourcesSoapIn"/>
<wsdl:output message="tns:GetNetResourcesSoapOut"/>
</wsdl:operation>
</wsdl:portType >
Run Code Online (Sandbox Code Playgroud)
但是,在查看消息列表时,我可以看到与GetNetResources相关的三条消息:
<wsdl:message name="GetNetResourcesSoapIn">
<wsdl:part name="parameters" element=tns:GetNetResources"/>
</wsdl:message>
<wsdl:message name="GetNetResourcesSoapOut">
<wsdl:part name="parameters" element=tns:GetNetResourcesResponse"/>
</wsdl:message>
<wsdl:message name="GetNetResourcesLanguageHeader">
<wsdl:part name="parameters" element=tns:LanguageHeader"/>
</wsdl:message>
Run Code Online (Sandbox Code Playgroud)
如果操作只指定了两条消息,那么WSDL文件中第三条消息与操作相关联的位置是什么?
看起来LanguageHeader参数在ColdFusion 2016中是绝对必需的,所以为什么它在ColdFusion …
错误是:
读取或写入文件{0}时发生异常由于尚未设置Axis2运行时位置,因此无法安装Axis2构面.转到"Web服务"首选项页面,并在"Axis2首选项"下设置Axis2运行时位置.
在提到的首选项中,位置设置正确,实际上,在加载正确的运行时位置后,它表示"Axis2运行时已成功加载".发生什么了?除了重新安装eclipse或创建新工作区之外的任何解决方案?
我正在使用Axis2 1.4.1和eclipse.
我使用AXIS2创建的ADB-stub访问SOAP服务.我想记录服务返回的任何Axis Fault的原始XML响应.我可以将这些错误视为"ServiceError".但是,我找不到一种方法来检索原始XML(参见下面的示例).
我找到了一种使用getOMElement访问原始XML请求/响应以进行常规处理的方法(参见下面的示例).但是,这不适用于故障.
如何使用ADB存根获取原始XML错误?
示例Java代码:
public void testRequest(String URL) throws AxisFault {
MyServiceStub myservice = new MyServiceStub(URL);
MyRequest req = new MyRequest();
try {
TypeMyFunctionResponse response = myservice.myFunction(req);
// logging full soap response
System.out.println("SOAP Response: "
+ response.getOMElement(null,
OMAbstractFactory.getOMFactory())
.toStringWithConsume());
} catch (RemoteException e) {
//...
} catch (ServiceError e) {
// how to get the raw xml?
}
}
Run Code Online (Sandbox Code Playgroud)
示例故障响应,我想获取并记录:
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:Receiver</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">service error</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail>
<ns1:error xmlns:ns1="http://www.somehost.com/webservices/someservice">
<ns1:code>500</ns1:code> …
Run Code Online (Sandbox Code Playgroud) 我不知道什么是aar档案文件以及它们与战争的区别.我读到它们有点可兑换.什么时候使用哪一个?什么是利弊和限制.
在我的项目中,我有以下项目结构:
我有一个生成war文件的模块,可以部署在Tomcat应用程序服务器中.该模块依赖于Axis2库:
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-webapp</artifactId>
<type>war</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)
此类包含WEB-INF下conf文件夹中的axis2.xml文件.
现在这个模块依赖于一个单元模块,它具有jar的包类型.
现在在我的web模块中,在我的存根的代码中,我有以下代码:
.GazelleObjectValidator.getInstance()validateObject();
XcpdValidationService是jar模块(依赖项)中的一个类,此方法通过SSL调用外部Web服务并使用代理.
此Web服务客户端由JAX WS RI生成
但是这个类不使用父模块中的axis2.xml配置并使用它自己的轴配置,这是默认设置,我的代理没有配置...
@WebEndpoint(name = "GazelleObjectValidatorPort")
public GazelleObjectValidator getGazelleObjectValidatorPort() {
return super.getPort(new QName("http://ws.validator.sch.gazelle.ihe.net/", "GazelleObjectValidatorPort"), GazelleObjectValidator.class);
}
Run Code Online (Sandbox Code Playgroud)
该方法本身如下所示:
@WebMethod
@WebResult(name = "validationResult", targetNamespace = "")
@RequestWrapper(localName = "validateObject", targetNamespace = "http://ws.validator.sch.gazelle.ihe.net/", className = "net.ihe.gazelle.schematron.ValidateObject")
@ResponseWrapper(localName = "validateObjectResponse", targetNamespace = "http://ws.validator.sch.gazelle.ihe.net/", className = "net.ihe.gazelle.schematron.ValidateObjectResponse")
public String validateObject(
@WebParam(name = "base64ObjectToValidate", targetNamespace = "")
String base64ObjectToValidate,
@WebParam(name = "xmlReferencedStandard", targetNamespace = "") …
Run Code Online (Sandbox Code Playgroud) 所有,我正在尝试编写一个在Axis2.1.5中调用Web服务客户端的Junit测试,并且我对如何将其设置为使用WS-Addressing感到困惑.
我使用wsdl2java生成了一个客户端存根,我正在使用来自axis2二进制分发的axis2.xml和modules存储库.
我知道我需要使用的WS-Addressing的MemberSubmission版本,我想我已经得到了正确设置(使用选项),但似乎是头不得到正确生成.(我说'似乎'因为我无法弄清楚如何使用SOAPMonitor模块 - 我也欢迎任何提示!).
然而,我的主要困惑在于"参与"寻址模块究竟需要什么.是否足以使用具有对寻址模块的引用的axis2.xml文件来设置ConfigurationContext?像这样?:
//standard out of the box axis2 configs
ConfigurationContext myConfigContext = ConfigurationContextFactory
.createConfigurationContextFromFileSystem("C:/devapps/axis2-1.5.1/repository","C:/devapps/axis2-1.5.1/conf/axis2.xml");
Options options = new Options();
EndpointReference targetEPR = new EndpointReference(
"https://host:port/service.asmx");
options.setTo(targetEPR);
//I believe this is what I'm supposed to do to specify the
//MemberSubmission version of WS-Addressing
options.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
AddressingConstants.Submission.WSA_NAMESPACE);
//No idea of this is needed or not.
options.setProperty(AddressingConstants.INCLUDE_OPTIONAL_HEADERS,
Boolean.TRUE);
options.activate(myConfigContext);
options.setAction("someAction");
CaseDetailsServiceStub stub = new CaseDetailsServiceStub(
"https://host:port/service.asmx");
stub._getServiceClient().setOptions(options);
//I'm calling this from a Junit test
assertNotNull(stub.someAction(someParam));
Run Code Online (Sandbox Code Playgroud)
使用上面设置的选项,在日志文件中看到模块从axis2.xml加载:
[INFO] Deploying …
Run Code Online (Sandbox Code Playgroud) 我想使用"Web服务客户端"向导在Eclipse中创建Web服务客户端,但向导不允许我选择Axis2作为Web服务运行时; 我只是简单的Axis.
我从以下屏幕开始(我通过文件 - >新建 - >其他 - > Web服务客户端):
我点击"Web服务运行时:Apache Axis",以获得这个新的"客户端环境配置"对话框:
我选择了"Apache Axis2",但OK按钮显示为灰色.无论我在这个对话框中选择什么 - 即使我选择"Apache Axis" - OK按钮显示为灰色.我无法超越这一步.我使用的是Eclipse的坏版本(Indigo版本20110615-0604),我是否需要安装/升级一些插件(我已经安装了Axis2 Tools 1.1.200v201103022)?这有什么不对?
这是在Windows 7 64位计算机上.
是否可以轻松地将客户端证书附加到使用wsdl2java生成的Axis2存根?我需要在每个请求的基础上动态更改客户端证书,因此只需将其存储在密钥库中就不适用于我们的情况.
我已经找到了为非SOAP调用执行此操作的示例,但找不到与使用Axis客户端存根相关的任何内容.试图破解XML for SOAP调用是一个选项,我猜,albiet是一个痛苦的选择!呻吟!
我创建了一个AXIS服务,它连接到WSO2 Identity Server并验证令牌.当我在WSO2 App Server上部署此轴服务时,我得到了正确的响应.当我在WSO2 ESB上部署它时,我收到以下错误
org.apache.axis2.AxisFault: The input stream for an incoming message is null.
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:93)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:68)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:346)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:413)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:224)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub.validate(OAuth2TokenValidationServiceStub.java:184)
at com.xxx4.yyy.security.token.service.TokenValidationService.validateToken(TokenValidationService.java:67)
at com.xxx4.yyy.security.token.facade.TokenValidationFacade.validateToken(TokenValidationFacade.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:404)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:184)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Run Code Online (Sandbox Code Playgroud)
[2013-10-03 14:42:56,160]错误 - TargetHandler I/O错误:主机的主机名验证失败:172.20.5.110 javax.net.ssl.SSLException:主机的主机名验证失败:org的172.20.5.110位于org.apache.http的org.apache.http.nio.reactor.ssl.SSLIOSession.doHandshake(SSLIOSession.java:285)的.apache.synapse.transport.http.conn.ClientSSLSetupHandler.verify(ClientSSLSetupHandler.java:152)位于org.apache.http.impl.nio的org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:118)的.nio.reactor.ssl.SSLIOSession.isAppInputReady(SSLIOSession.java:372)位于org.apache.http.impl.nio.reactor.AbstractIOReactor的org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:342)的.reactor.BaseIOReactor.readable(BaseIOReactor.java:160). .processEvents(AbstractIOReactor.java:320)org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:280)org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:106)at org java.lang.Thread.run中的.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor $ Worker.run(AbstractMultiworkerIOReactor.java:604)(Thread.java:724)