我正在使用axis2 1.5.4和rampart 1.5.1。我不时会收到以下错误:
java.lang.UnsupportedOperationException:解析器已被使用! 在org.apache.axiom.om.impl.llom.OMElementImpl.getXMLStreamReader(OMElementImpl.java:792) at org.apache.axiom.om.impl.llom.OMElementImpl.getXMLStreamReaderWithoutCaching(OMElementImpl.java:765) 在org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMSerializerUtil.java:552) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:249) at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193) at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:79) 在org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84) 在org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499) 在org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114) 在org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096) 在org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398) 在org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) 在org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) 在org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346) at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:557) 在org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199) 在org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76) 在org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400) 在org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225) 在org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:438) 在org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) 在org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
我用来调用WS的代码是:
EndpointReference targetEPR = new EndpointReference(SERVICEOPERPREFIX + oper);
ConfigurationContext ctx = ClsConfigurationContextFactory.getInstance(AXIS_REPOSITORY, AXIS_CONFIG).getContext();
ServiceClient sender = new ServiceClient(ctx, null);
sender.engageModule("rampart");
this.options.setTo(targetEPR);
this.options.setAction(OPERPREFIX + oper);
this.options.setProperty(WSSHandlerConstants.OUTFLOW_SECURITY, getOutflowConfiguration(""+user));
sender.setOptions(this.options);
MultiThreadedHttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager();
HttpConnectionManagerParams mParams = new HttpConnectionManagerParams();
mParams.setDefaultMaxConnectionsPerHost(MAXNUMCONNECTIONS);
mParams.setConnectionTimeout(new Integer(OSBHTTPConnectionTimeout));
mParams.setSoTimeout(new Integer(OSBHTTPReadTimeout));
httpConnectionManager.setParams(mParams);
HttpClient httpClient = new HttpClient(httpConnectionManager);
sender.getOptions().setProperty("REUSE_HTTP_CLIENT", "true");
sender.getOptions().setProperty("CACHED_HTTP_CLIENT", httpClient);
MessageContext requestMsgCtx = new MessageContext();
SOAPEnvelope inEnvelope = createSOAPEnvelope();
requestMsgCtx.setEnvelope(inEnvelope);
OperationClient opClient= sender.createClient(ServiceClient.ANON_OUT_IN_OP);
opClient.addMessageContext(requestMsgCtx);
sender.cleanupTransport();
opClient.execute(true);
有什么想法吗?
提前致谢