axis 源码初步研读

经过反复跟踪,这段代码比较重要:

org.apache.axis.Message.java

    public void writeTo(java.io.OutputStream os) throws SOAPException, IOException {
         //Do it the old fashion way.
    	Thread.dumpStack();
        if (getSendType() == Attachments.SEND_TYPE_NONE || mAttachments == null || 0 == mAttachments.getAttachmentCount()) {
            try {
                String charEncoding = XMLUtils.getEncoding(this, msgContext);;
                mSOAPPart.setEncoding(charEncoding);
                mSOAPPart.writeTo(os);
            	System.out.println("(Message.java:540)");
            } catch (java.io.IOException e) {
                log.error(Messages.getMessage("javaIOException00"), e);
            }
        } else {
            try {
                mAttachments.writeContentToStream(os);
                //BufferedOutputStream bos = new BufferedOutputStream();
                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                mAttachments.writeContentToStream(bos);
                //String str = bos.toString();
                System.out.println("(Message.java:553) mAttachments:" + bos.toString());
            	System.out.println("(Message.java:554) " + mAttachments);
            } catch (java.lang.Exception e) {
                log.error(Messages.getMessage("exception00"), e);
            }
        }
    }




另外,贴一些通过 Thread.dumpStack() 打印出来的程序流程:

java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:189)
	at org.apache.axis.configuration.EngineConfigurationFactoryFinder.access$2(EngineConfigurationFactoryFinder.java:163)
	at org.apache.axis.configuration.EngineConfigurationFactoryFinder$1.run(EngineConfigurationFactoryFinder.java:128)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:113)
	at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:160)
	at org.apache.axis.client.Service.getEngineConfiguration(Service.java:813)
	at org.apache.axis.client.Service.getAxisClient(Service.java:104)
	at org.apache.axis.client.Service.<init>(Service.java:113)
	at com.mns.SendMessageServiceLocator.<init>(SendMessageServiceLocator.java:12)
	at com.mns.ZTestSendMsg.test_main1(ZTestSendMsg.java:114)
	at com.mns.ZTestSendMsg.main(ZTestSendMsg.java:55)

java.lang.Exception: Stack trace
	at java.lang.Thread.dumpStack(Unknown Source)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2816)
	at org.apache.axis.client.Call.invoke(Call.java:2799)
	at org.apache.axis.client.Call.invoke(Call.java:2444)
	at org.apache.axis.client.Call.invoke(Call.java:2367)
	at org.apache.axis.client.Call.invoke(Call.java:1812)
	at com.mns.SendMessageBindingStub.sendMessage(SendMessageBindingStub.java:442)
	at com.mns.ZTestSendMsg.test_main1(ZTestSendMsg.java:278)
	at com.mns.ZTestSendMsg.main(ZTestSendMsg.java:55)2817:service.getEngine():org.apache.axis.client.AxisClient@5812f9ee

java.lang.Exception: Stack trace
	at java.lang.Thread.dumpStack(Unknown Source)
	at org.apache.axis.attachments.MimeUtils.createMP(MimeUtils.java:248)
	at org.apache.axis.attachments.AttachmentsImpl.getContentType(AttachmentsImpl.java:567)
	at org.apache.axis.Message.getContentType(Message.java:489)
	at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:343)
	at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:175)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2818)
	at org.apache.axis.client.Call.invoke(Call.java:2799)
	at org.apache.axis.client.Call.invoke(Call.java:2444)
	at org.apache.axis.client.Call.invoke(Call.java:2367)
	at org.apache.axis.client.Call.invoke(Call.java:1812)
	at com.mns.SendMessageBindingStub.sendMessage(SendMessageBindingStub.java:442)
	at com.mns.ZTestSendMsg.test_main1(ZTestSendMsg.java:278)
	at com.mns.ZTestSendMsg.main(ZTestSendMsg.java:55)


java.lang.Exception: Stack trace
	at java.lang.Thread.dumpStack(Unknown Source)
	at org.apache.axis.Message.writeTo(Message.java:536)
	at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:514)
	at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:175)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2818)
	at org.apache.axis.client.Call.invoke(Call.java:2799)
	at org.apache.axis.client.Call.invoke(Call.java:2444)
	at org.apache.axis.client.Call.invoke(Call.java:2367)
	at org.apache.axis.client.Call.invoke(Call.java:1812)
	at com.mns.SendMessageBindingStub.sendMessage(SendMessageBindingStub.java:442)
	at com.mns.ZTestSendMsg.test_main1(ZTestSendMsg.java:278)
	at com.mns.ZTestSendMsg.main(ZTestSendMsg.java:55)
java.lang.Exception: Stack trace
	at java.lang.Thread.dumpStack(Unknown Source)
	at org.apache.axis.attachments.AttachmentsImpl.writeContentToStream(AttachmentsImpl.java:520)
	at org.apache.axis.Message.writeTo(Message.java:548)
	at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:514)
	at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:175)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2818)
	at org.apache.axis.client.Call.invoke(Call.java:2799)
	at org.apache.axis.client.Call.invoke(Call.java:2444)
	at org.apache.axis.client.Call.invoke(Call.java:2367)
	at org.apache.axis.client.Call.invoke(Call.java:1812)
	at com.mns.SendMessageBindingStub.sendMessage(SendMessageBindingStub.java:442)
	at com.mns.ZTestSendMsg.test_main1(ZTestSendMsg.java:278)
	at com.mns.ZTestSendMsg.main(ZTestSendMsg.java:55)
(org.apache.axis.attachments.AttachmentsImpl.java:522) 


你可能感兴趣的:(java,webservice,axis)