- 浏览: 75363 次
- 性别:
- 来自: 苏州
文章分类
最新评论
-
夜曲6763:
org.apache.axis2.AxisFault: Fir ...
axis2 笔记 -
bestree007:
感谢楼主的总结,最近遇到chunk传输编码的问题。
axis2 笔记 -
stevenjohn:
总结的不错
axis2 笔记 -
stevenjohn:
org.apache.axis2.AxisFault: Fir ...
axis2 笔记 -
paladin1988:
nice,总结的很好。谢谢了
axis2 笔记
1. MTOM优先于Swa<parameter name="enableMTOM">true</parameter>
<parameter name="enableSwA">true</parameter>
if axis2.xml was configed as above, enableSwA was unenabled because enableMTOM has a high priority.
Now if you try get the haldler, you will get null.
2. when download(upload) a large file from server, countering the exception below.
Exception in thread "HttpConnection-8080-2" java.lang.IllegalStateException: Res
ponse already committed
(Client.java)
options.setProperty(Constants.Configuration.CACHE_ATTACHMENTS,Constants.VALUE_TRUE);
options.setProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR,"D:/");
options.setProperty(Constants.Configuration.FILE_SIZE_THRESHOLD, "4000");
When we uoload a large file.(axis2.xml)
<parameter name="cacheAttachments">true</parameter>
<parameter name="attachmentDIR">D:/</parameter>
<parameter name="sizeThreshold">4000</parameter>
3.延长上传下载时间。
// Increase the time out when sending large attachments
options.setTimeOutInMilliSeconds(1000);
Exception Read out
options.setTimeOutInMilliSeconds(1000000);
4. The input stream for an incoming message is null.
org.apache.axis2.AxisFault: The input stream for an incoming message is null.
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:71)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:326)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at com.XXX.XXX.axis2.sample.attachment.client.AttachmentClient.downloadFile(AttachmentClient.java:84)
at com.XXX.XXX.axis2.sample.attachment.client.AttachmentClient.main(AttachmentClient.java:48)
Then I found targetEPR is ERROR.
private static EndpointReference targetEPR = new EndpointReference(
"http://localhost:8080/sample/services/AttachmentService");
5.JMS config
Caused by: javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616?wireFormat.maxInactivityDuration=0. Reason: java.net.ConnectException: Connection refused: connect
Make Sure you have start ActiveMQ
When use JMS (ActiveMQ Implement)transport,it is required to make the following JAR files available: activeio-core-3.0-beta1.jar, activemq-core-4.0-RC2.jar, geronimo-j2ee-management_1.0_spec-1.0.jar at a minimum
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="myTopicConnectionFactory">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616?wireFormat.maxInactivityDuration=0</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</parameter>
</parameter>
<parameter name="myQueueConnectionFactory">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616?wireFormat.maxInactivityDuration=0</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
</parameter>
<parameter name="default">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616?wireFormat.maxInactivityDuration=0</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
</parameter>
</transportReceiver>
Add paramter "?wireFormat.maxInactivityDuration=0" to java.naming.provider.url.
6,org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
tcp://localhost:6060/sample/services/TCPCustomerService;
tcp://localhost:6060/axis2/services/TCPCustomerService
org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:89)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:326)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at com.XXX.XXX.axis2.sample.stub.custdir.TCPCustomerServiceStub.searchCustomer(TCPCustomerServiceStub.java:1091)
at com.XXX.XXX.axis2.sample.transport.client.TCPClient.doSearchCustomer(TCPClient.java:92)
at com.XXX.XXX.axis2.sample.transport.client.TCPClient.run(TCPClient.java:57)
at com.XXX.XXX.base.standalone.AppRunner.run(AppRunner.java:38)
at com.XXX.XXX.axis2.sample.transport.client.TCPClient.main(TCPClient.java:222)
Caused by: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:239)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:161)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:110)
at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:609)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:178)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:111)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:87)
... 9 more
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:661)
at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2134)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2040)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:153)
... 15 more
[TCPClient] Operation completed in 16350ms.
[2008-06-25 16:45:48.853] Unable to parse request URL [tcp://localhost:6060/samp
le/services/TCPCustomerService][axis2/services]
[2008-06-25 16:46:04.749] The [action] cannot be processed at the receiver.
org.apache.axis2.AxisFault: The [action] cannot be processed at the receiver.
at org.apache.axis2.addressing.AddressingFaultsHelper.triggerAddressingF
ault(AddressingFaultsHelper.java:355)
at org.apache.axis2.addressing.AddressingFaultsHelper.triggerActionNotSu
pportedFault(AddressingFaultsHelper.java:320)
at org.apache.axis2.handlers.addressing.AddressingValidationHandler.chec
kAction(AddressingValidationHandler.java:140)
at org.apache.axis2.handlers.addressing.AddressingValidationHandler.invo
ke(AddressingValidationHandler.java:53)
at org.apache.axis2.engine.Phase.invoke(Phase.java:292)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:212)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:132)
at org.apache.axis2.transport.tcp.TCPWorker.run(TCPWorker.java:88)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.runTask(ThreadPoolExecutor.java:650)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
[2008-06-25 16:46:04.921]
java.lang.NullPointerException
at org.apache.axis2.handlers.soapmonitor.SOAPMonitorHandler.getMessageId
(SOAPMonitorHandler.java:130)
at org.apache.axis2.handlers.soapmonitor.SOAPMonitorHandler.invoke(SOAPM
onitorHandler.java:81)
at org.apache.axis2.engine.Phase.invoke(Phase.java:292)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:212)
at org.apache.axis2.engine.AxisEngine.sendFault(AxisEngine.java:468)
at org.apache.axis2.transport.tcp.TCPWorker.run(TCPWorker.java:104)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.runTask(ThreadPoolExecutor.java:650)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Axis2是常用的一种SOAP engine,但是它提供的wsdl2java的命令行工具的说明比较简单,没有具体的例子。下面举出几个例子:
从最简单的开始 ,-uri 指定wsdl文件
> WSDL2Java -uri currencyConvert.wsdl
-d 使用不同的data binding方法
> WSDL2Java -uri currencyConvert.wsdl -d xmlbeans
-a 生成异步的方法
> WSDL2Java -uri currencyConvert.wsdl -a
-t 生成测试case
> WSDL2Java -uri currencyConvert.wsdl -t ...
稍微复杂一些的,-p可以指定生成的package,-o指定生成的路径,-ss生成服务端代码
wsdl2java -uri ../wsdl/currencyConvert.wsdl -o ../gen_src -ss -sd -g -p foo.bat
再复杂一些,-ns2p 将namespace进行替换,多个中间用逗号隔开
wsdl2java -uri ../wsdl/currencyConvert.wsdl -o ../wsdl/gen_src -ss -sd -g -p com.foo.bar -ns2p "http://www.xxx.yyy.com/zzz/v1.0"=com.foo.bar,"http://www.xxx.yyy.com/ddd/v1.1"=com.foo.bar.goo
wsdl2java模板及其参数介绍
axis版本为1.2RC3
wsdl2java.bat
SET AXIS_HOME=D:\mywork\Sea\WebRoot\WEB-INF\lib\
set CLASSPATH=%CLASSPATH%;%AXIS_HOME%axis.jar;%AXIS_HOME%jaxrpc.jar;%AXIS_HOME%saaj.jar;%AXIS_HOME%commons-logging.jar;%AXIS_HOME%commons-discovery.jar;%AXIS_HOME%wsdl4j.jar;%AXIS_HOME%mail.jar;%AXIS_HOME%activation.jar;%AXIS_HOME%commons-httpclient-3.0-alpha1.jar;.
java org.apache.axis.wsdl.WSDL2Java -a -t -p com.sea.ws.passportstub -o D:\mywork\Sea\src http://10.5.0.143/passportWsApi/services/PassportSeaOnlineApi?wsdl
java org.apache.axis.wsdl.WSDL2Java -a -t -p com.sea.ws.seastub -o D:\mywork\Sea\src http://10.5.0.143/sea/services/Sea?wsdl
参数介绍
Usage: java org.apache.axis.wsdl.WSDL2Java [options] WSDL-URI
Options:
-h, --help
print this message and exit
-v, --verbose
print informational messages
-n, --noImports
only generate code for the immediate WSDL document
-O, --timeout <argument>
timeout in seconds (default is 45, specify -1 to disable)
-D, --Debug
print debug information
-W, --noWrapped
turn off support for "wrapped" document/literal
-q, --quiet
do not print any informational or debug messages (except err
ors)
-s, --server-side
emit server-side bindings for web service
-S, --skeletonDeploy <argument>
deploy skeleton (true) or implementation (false) in deploy.w
sdd. Default is false. Assumes --server-side.
-N, --NStoPkg <argument>=<value>
mapping of namespace to package
-f, --fileNStoPkg <argument>
file of NStoPkg mappings (default NStoPkg.properties)
-p, --package <argument>
override all namespace to package mappings, use this package
name instead
-o, --output <argument>
output directory for emitted files
-d, --deployScope <argument>
add scope to deploy.wsdd: "Application", "Request", "Session
"
-t, --testCase
emit junit testcase class for web service
-a, --all
generate code for all elements, even unreferenced ones
-T, --typeMappingVersion <argument>
indicate 1.1 or 1.2. The default is 1.1 (SOAP 1.1 JAX-RPC c
ompliant. 1.2 indicates SOAP 1.1 encoded.)
-F, --factory <argument>
name of a custom class that implements GeneratorFactory inte
rface (for extending Java generation functions)
-H, --helperGen
emits separate Helper classes for meta data
-B, --buildFile
emit Ant Buildfile for web service
-U, --user <argument>
username to access the WSDL-URI
-P, --password <argument>
password to access the WSDL-URI
-X, --classpath
additional classpath elements
-i, --nsInclude <argument>
include namespace in generated code
-x, --nsExclude <argument>
exclude namespace from generated code
-c, --implementationClassName <argument>
custom name of web service implementation
-u, --allowInvalidURL
emit file even if WSDL endpoint URL is not a valid URL
org.apache.axis2.AxisFault: First Element must contain the local name, Envelope , but found html
解决办法:stub._getServiceClient().getOptions().
setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
Chunk选项阻碍axis2集成.NET服务
昨天用.NET创建了一项WEB服务,实现一个应用集成接口。使用C#和VB.NET客户端均可以正常实现调用。为了实现JAVA客户端的集成,下载了axis2。在生成客户端stub以后,使用一个简单的测试代码,可无论如何均不能实现服务调用,郁闷。
回想起以前使用axis的时候是可以正常调用的,同事们也都用过,重新下载axis,在生成wsil并根据wsil生成客户端代理以后,JAVA客户端可以正常调用那项服务了。
使用协议分析工具,发现在axis中使用的是HTTP/1.0协议,而.NET和axis2使用的是HTTP/1.1协议,后两者的区别在于.NET未使用ns1的命名空间前缀打包SOAP请求,且axis2使用了Content-Encoding: chunked头。
通过修改wsdl2java生成的stub程序,取消ns1的命名空间前缀,故障依然存在。查了HTTP/1.1相关说明,并查找axis2相关javadoc,修改了stub类带(ConfigurationContext configurationContext, String targetEndpoint, boolean useSeparateListener)参数的构造方法,在最后加入一句禁止使用chunk选项,终于调用成功:_serviceClient.getOptions().setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement return
The response message uses an undeclared namespace prefix "ax21" rather than the "ns" prefix used in the rest of the message.
axis2客户端需要使用的最少jar包2008-06-10 10:40axis2客户端jar包太多,全部加载会影响效率,偶尔也会存在冲突问题。网上有人说 axis2客户端需要使用的最少jar包 如下:
总结客户端必须加载:
activation-1.1.jar
axiom-api-1.2.4.jar
axiom-impl-1.2.4.jar
axis2-adb-1.2.jar
axis2-adb-codegen-1.2.jar
axis2-codegen-1.2.jar
axis2-java2wsdl-1.2.jar
axis2-kernel-1.2.jar
commons-codec-1.3.jar
commons-httpclient-3.0.1.jar
commons-logging-1.1.jar
stax-api-1.0.1.jar
wsdl4j-1.6.2.jar
wstx-asl-3.2.1.jar
XmlSchema-1.3.1.jar
自己使用adb方式调用下,实际需要最少jar包 如下:
activation-1.1.jar
axiom-api-1.2.2.jar
axiom-impl-1.2.2.jar
axis2-adb-1.1.1.jar
axis2-kernel-1.1.1.jar
commons-codec-1.3.jar
commons-httpclient-3.0.1.jar
commons-logging-1.1.jar
stax-api-1.0.1.jar
wsdl4j-1.6.2.jar
wstx-asl-3.2.1.jar
XmlSchema-1.3.1.jar
<parameter name="enableSwA">true</parameter>
if axis2.xml was configed as above, enableSwA was unenabled because enableMTOM has a high priority.
Now if you try get the haldler, you will get null.
2. when download(upload) a large file from server, countering the exception below.
Exception in thread "HttpConnection-8080-2" java.lang.IllegalStateException: Res
ponse already committed
(Client.java)
options.setProperty(Constants.Configuration.CACHE_ATTACHMENTS,Constants.VALUE_TRUE);
options.setProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR,"D:/");
options.setProperty(Constants.Configuration.FILE_SIZE_THRESHOLD, "4000");
When we uoload a large file.(axis2.xml)
<parameter name="cacheAttachments">true</parameter>
<parameter name="attachmentDIR">D:/</parameter>
<parameter name="sizeThreshold">4000</parameter>
3.延长上传下载时间。
// Increase the time out when sending large attachments
options.setTimeOutInMilliSeconds(1000);
Exception Read out
options.setTimeOutInMilliSeconds(1000000);
4. The input stream for an incoming message is null.
org.apache.axis2.AxisFault: The input stream for an incoming message is null.
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:71)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:326)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at com.XXX.XXX.axis2.sample.attachment.client.AttachmentClient.downloadFile(AttachmentClient.java:84)
at com.XXX.XXX.axis2.sample.attachment.client.AttachmentClient.main(AttachmentClient.java:48)
Then I found targetEPR is ERROR.
private static EndpointReference targetEPR = new EndpointReference(
"http://localhost:8080/sample/services/AttachmentService");
5.JMS config
Caused by: javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616?wireFormat.maxInactivityDuration=0. Reason: java.net.ConnectException: Connection refused: connect
Make Sure you have start ActiveMQ
When use JMS (ActiveMQ Implement)transport,it is required to make the following JAR files available: activeio-core-3.0-beta1.jar, activemq-core-4.0-RC2.jar, geronimo-j2ee-management_1.0_spec-1.0.jar at a minimum
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="myTopicConnectionFactory">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616?wireFormat.maxInactivityDuration=0</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</parameter>
</parameter>
<parameter name="myQueueConnectionFactory">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616?wireFormat.maxInactivityDuration=0</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
</parameter>
<parameter name="default">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616?wireFormat.maxInactivityDuration=0</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
</parameter>
</transportReceiver>
Add paramter "?wireFormat.maxInactivityDuration=0" to java.naming.provider.url.
6,org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
tcp://localhost:6060/sample/services/TCPCustomerService;
tcp://localhost:6060/axis2/services/TCPCustomerService
org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:89)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:326)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at com.XXX.XXX.axis2.sample.stub.custdir.TCPCustomerServiceStub.searchCustomer(TCPCustomerServiceStub.java:1091)
at com.XXX.XXX.axis2.sample.transport.client.TCPClient.doSearchCustomer(TCPClient.java:92)
at com.XXX.XXX.axis2.sample.transport.client.TCPClient.run(TCPClient.java:57)
at com.XXX.XXX.base.standalone.AppRunner.run(AppRunner.java:38)
at com.XXX.XXX.axis2.sample.transport.client.TCPClient.main(TCPClient.java:222)
Caused by: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:239)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:161)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:110)
at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:609)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:178)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:111)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:87)
... 9 more
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:661)
at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2134)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2040)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:153)
... 15 more
[TCPClient] Operation completed in 16350ms.
[2008-06-25 16:45:48.853] Unable to parse request URL [tcp://localhost:6060/samp
le/services/TCPCustomerService][axis2/services]
[2008-06-25 16:46:04.749] The [action] cannot be processed at the receiver.
org.apache.axis2.AxisFault: The [action] cannot be processed at the receiver.
at org.apache.axis2.addressing.AddressingFaultsHelper.triggerAddressingF
ault(AddressingFaultsHelper.java:355)
at org.apache.axis2.addressing.AddressingFaultsHelper.triggerActionNotSu
pportedFault(AddressingFaultsHelper.java:320)
at org.apache.axis2.handlers.addressing.AddressingValidationHandler.chec
kAction(AddressingValidationHandler.java:140)
at org.apache.axis2.handlers.addressing.AddressingValidationHandler.invo
ke(AddressingValidationHandler.java:53)
at org.apache.axis2.engine.Phase.invoke(Phase.java:292)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:212)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:132)
at org.apache.axis2.transport.tcp.TCPWorker.run(TCPWorker.java:88)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.runTask(ThreadPoolExecutor.java:650)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
[2008-06-25 16:46:04.921]
java.lang.NullPointerException
at org.apache.axis2.handlers.soapmonitor.SOAPMonitorHandler.getMessageId
(SOAPMonitorHandler.java:130)
at org.apache.axis2.handlers.soapmonitor.SOAPMonitorHandler.invoke(SOAPM
onitorHandler.java:81)
at org.apache.axis2.engine.Phase.invoke(Phase.java:292)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:212)
at org.apache.axis2.engine.AxisEngine.sendFault(AxisEngine.java:468)
at org.apache.axis2.transport.tcp.TCPWorker.run(TCPWorker.java:104)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.runTask(ThreadPoolExecutor.java:650)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Axis2是常用的一种SOAP engine,但是它提供的wsdl2java的命令行工具的说明比较简单,没有具体的例子。下面举出几个例子:
从最简单的开始 ,-uri 指定wsdl文件
> WSDL2Java -uri currencyConvert.wsdl
-d 使用不同的data binding方法
> WSDL2Java -uri currencyConvert.wsdl -d xmlbeans
-a 生成异步的方法
> WSDL2Java -uri currencyConvert.wsdl -a
-t 生成测试case
> WSDL2Java -uri currencyConvert.wsdl -t ...
稍微复杂一些的,-p可以指定生成的package,-o指定生成的路径,-ss生成服务端代码
wsdl2java -uri ../wsdl/currencyConvert.wsdl -o ../gen_src -ss -sd -g -p foo.bat
再复杂一些,-ns2p 将namespace进行替换,多个中间用逗号隔开
wsdl2java -uri ../wsdl/currencyConvert.wsdl -o ../wsdl/gen_src -ss -sd -g -p com.foo.bar -ns2p "http://www.xxx.yyy.com/zzz/v1.0"=com.foo.bar,"http://www.xxx.yyy.com/ddd/v1.1"=com.foo.bar.goo
wsdl2java模板及其参数介绍
axis版本为1.2RC3
wsdl2java.bat
SET AXIS_HOME=D:\mywork\Sea\WebRoot\WEB-INF\lib\
set CLASSPATH=%CLASSPATH%;%AXIS_HOME%axis.jar;%AXIS_HOME%jaxrpc.jar;%AXIS_HOME%saaj.jar;%AXIS_HOME%commons-logging.jar;%AXIS_HOME%commons-discovery.jar;%AXIS_HOME%wsdl4j.jar;%AXIS_HOME%mail.jar;%AXIS_HOME%activation.jar;%AXIS_HOME%commons-httpclient-3.0-alpha1.jar;.
java org.apache.axis.wsdl.WSDL2Java -a -t -p com.sea.ws.passportstub -o D:\mywork\Sea\src http://10.5.0.143/passportWsApi/services/PassportSeaOnlineApi?wsdl
java org.apache.axis.wsdl.WSDL2Java -a -t -p com.sea.ws.seastub -o D:\mywork\Sea\src http://10.5.0.143/sea/services/Sea?wsdl
参数介绍
Usage: java org.apache.axis.wsdl.WSDL2Java [options] WSDL-URI
Options:
-h, --help
print this message and exit
-v, --verbose
print informational messages
-n, --noImports
only generate code for the immediate WSDL document
-O, --timeout <argument>
timeout in seconds (default is 45, specify -1 to disable)
-D, --Debug
print debug information
-W, --noWrapped
turn off support for "wrapped" document/literal
-q, --quiet
do not print any informational or debug messages (except err
ors)
-s, --server-side
emit server-side bindings for web service
-S, --skeletonDeploy <argument>
deploy skeleton (true) or implementation (false) in deploy.w
sdd. Default is false. Assumes --server-side.
-N, --NStoPkg <argument>=<value>
mapping of namespace to package
-f, --fileNStoPkg <argument>
file of NStoPkg mappings (default NStoPkg.properties)
-p, --package <argument>
override all namespace to package mappings, use this package
name instead
-o, --output <argument>
output directory for emitted files
-d, --deployScope <argument>
add scope to deploy.wsdd: "Application", "Request", "Session
"
-t, --testCase
emit junit testcase class for web service
-a, --all
generate code for all elements, even unreferenced ones
-T, --typeMappingVersion <argument>
indicate 1.1 or 1.2. The default is 1.1 (SOAP 1.1 JAX-RPC c
ompliant. 1.2 indicates SOAP 1.1 encoded.)
-F, --factory <argument>
name of a custom class that implements GeneratorFactory inte
rface (for extending Java generation functions)
-H, --helperGen
emits separate Helper classes for meta data
-B, --buildFile
emit Ant Buildfile for web service
-U, --user <argument>
username to access the WSDL-URI
-P, --password <argument>
password to access the WSDL-URI
-X, --classpath
additional classpath elements
-i, --nsInclude <argument>
include namespace in generated code
-x, --nsExclude <argument>
exclude namespace from generated code
-c, --implementationClassName <argument>
custom name of web service implementation
-u, --allowInvalidURL
emit file even if WSDL endpoint URL is not a valid URL
org.apache.axis2.AxisFault: First Element must contain the local name, Envelope , but found html
解决办法:stub._getServiceClient().getOptions().
setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
Chunk选项阻碍axis2集成.NET服务
昨天用.NET创建了一项WEB服务,实现一个应用集成接口。使用C#和VB.NET客户端均可以正常实现调用。为了实现JAVA客户端的集成,下载了axis2。在生成客户端stub以后,使用一个简单的测试代码,可无论如何均不能实现服务调用,郁闷。
回想起以前使用axis的时候是可以正常调用的,同事们也都用过,重新下载axis,在生成wsil并根据wsil生成客户端代理以后,JAVA客户端可以正常调用那项服务了。
使用协议分析工具,发现在axis中使用的是HTTP/1.0协议,而.NET和axis2使用的是HTTP/1.1协议,后两者的区别在于.NET未使用ns1的命名空间前缀打包SOAP请求,且axis2使用了Content-Encoding: chunked头。
通过修改wsdl2java生成的stub程序,取消ns1的命名空间前缀,故障依然存在。查了HTTP/1.1相关说明,并查找axis2相关javadoc,修改了stub类带(ConfigurationContext configurationContext, String targetEndpoint, boolean useSeparateListener)参数的构造方法,在最后加入一句禁止使用chunk选项,终于调用成功:_serviceClient.getOptions().setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement return
The response message uses an undeclared namespace prefix "ax21" rather than the "ns" prefix used in the rest of the message.
axis2客户端需要使用的最少jar包2008-06-10 10:40axis2客户端jar包太多,全部加载会影响效率,偶尔也会存在冲突问题。网上有人说 axis2客户端需要使用的最少jar包 如下:
总结客户端必须加载:
activation-1.1.jar
axiom-api-1.2.4.jar
axiom-impl-1.2.4.jar
axis2-adb-1.2.jar
axis2-adb-codegen-1.2.jar
axis2-codegen-1.2.jar
axis2-java2wsdl-1.2.jar
axis2-kernel-1.2.jar
commons-codec-1.3.jar
commons-httpclient-3.0.1.jar
commons-logging-1.1.jar
stax-api-1.0.1.jar
wsdl4j-1.6.2.jar
wstx-asl-3.2.1.jar
XmlSchema-1.3.1.jar
自己使用adb方式调用下,实际需要最少jar包 如下:
activation-1.1.jar
axiom-api-1.2.2.jar
axiom-impl-1.2.2.jar
axis2-adb-1.1.1.jar
axis2-kernel-1.1.1.jar
commons-codec-1.3.jar
commons-httpclient-3.0.1.jar
commons-logging-1.1.jar
stax-api-1.0.1.jar
wsdl4j-1.6.2.jar
wstx-asl-3.2.1.jar
XmlSchema-1.3.1.jar
评论
6 楼
夜曲6763
2013-11-25
org.apache.axis2.AxisFault: First Element must contain the local name, Envelope , but found html
这个是用Axis生成客户端调的吗?如果是RPC的方式报这个异常呢?没有stub这个变量啊
这个是用Axis生成客户端调的吗?如果是RPC的方式报这个异常呢?没有stub这个变量啊
5 楼
bestree007
2013-01-22
感谢楼主的总结,最近遇到chunk传输编码的问题。
4 楼
stevenjohn
2012-02-02
总结的不错
3 楼
stevenjohn
2012-02-02
org.apache.axis2.AxisFault: First Element must contain the local name, Envelope , but found html
解决办法:stub._getServiceClient().getOptions().
setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
这个问题,上回我们自己的客户端java代码,调用.net程序老是报错,最后就是用这个方法解决的问题。
解决办法:stub._getServiceClient().getOptions().
setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);
这个问题,上回我们自己的客户端java代码,调用.net程序老是报错,最后就是用这个方法解决的问题。
2 楼
paladin1988
2011-08-18
nice,总结的很好。谢谢了
1 楼
wangacidlemon
2009-06-16
你写的什么玩意儿啊?写了那么多,P都没看懂,贴了那么多异常,你解决没有啊 ?
相关推荐
本笔记将深入探讨Axis2的核心概念、版本差异、安装配置以及在实际项目中的应用。 1. **核心概念** - **SOAP**: Axis2是基于SOAP(Simple Object Access Protocol)协议的,它允许应用程序通过HTTP进行通信,实现跨...
### MyEclipse下Axis2插件安装步骤及注意事项 #### 一、下载MyEclipse Axis2插件 在安装MyEclipse下的Axis2插件之前,首先需要从官方网站下载所需的插件包。根据给定的部分内容,我们可以了解到具体的下载地址如下...
当我们谈论“Axis2,CXF版本学习笔记”时,这通常涉及到两个主要的Java Web服务框架:Apache Axis2和Apache CXF。这两个框架都用于构建和部署SOAP(简单对象访问协议)和RESTful(Representational State Transfer)...
AXIS学习笔记
AXIS学习笔记主要涵盖如何使用AXIS框架来开发SOAP Web服务和客户端程序。SOAP(简单对象访问协议)是一种用于交换结构化信息的标准协议,常用于Web服务交互,尤其是在企业内部系统如ERP的集成中。 首先,你需要搭建...
**Axis学习笔记(网页转贴)** Axis是一个开源的Java库,主要用于创建和使用Web服务。它是Apache软件基金会的一部分,广泛应用于开发基于SOAP(简单对象访问协议)的Web服务。本学习笔记将深入探讨Axis在Web服务开发...
标题"Axis2_1.X学习笔记"指的是关于Axis2的一个学习资源,其中1.X代表可能是1.4或者1.5等版本,Axis2是Apache软件基金会开发的一个开放源代码Web服务平台,主要用于构建和部署Web服务。这个学习笔记可能是对Axis2在1...
标题“Axis2学习笔记”揭示了本篇内容主要围绕Apache Axis2框架展开,这是一个用于构建Web服务和客户端的开源工具。Axis2是基于Axis1的升级版,它提供了更高效、模块化和可扩展的架构,使得开发和部署Web服务变得...
Axis2的Webservice资源汇总,关于Webservice的一些知识,里边有自己的一些阅读笔记或标记,用特殊标记标出来了,有些内容的评论也比较不错,应该全部阅读
axis学习资料汇总: Axis实例与分析详解; Axis学习笔记.pdf; Tomcat5.0.28下AXIS完全安装手册.doc; Axis1.4 开发指南_V1.0.pdf; AXIS入门及应用.rar; Axis开发Web+Services.doc 等等
**Axis开发Web Service学习笔记** 在信息技术领域,Web服务是一种基于开放标准的互联网通信协议,允许不同的应用程序之间进行互操作。而Axis是Apache软件基金会的一个开源项目,它提供了一个强大的工具集,用于创建...
项目收集的axis的相关资料~~ Axis.pdf ...AXIS学习笔记.txt WebService之axis的复杂对象传输方案.txt 使用Apache Axis部署 Web服务时的常见问题及其解决方法.txt 使用Axis开发Web Service程序.txt
axis1.4 webservice个人学习笔记
一、生成webservice服务 二、根据wsdl文件生成客户端