📄 echoclient.java
字号:
/**
* EchoClient.java Created on 2003-12-4
*
*/
package com.liuyang.axis.client;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.net.URL;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.message.SOAPEnvelope;
/**
* @author 刘洋
*
*/
public class EchoClient {
public static String msg = "<SOAP-ENV:Envelope " +
"xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
"xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" > " +
"<SOAP-ENV:Body>\n" +
"<echo:Echo xmlns:echo=\"EchoService\">\n" +
"<symbol>IBM</symbol>\n" +
"</echo:Echo>\n" +
"</SOAP-ENV:Body></SOAP-ENV:Envelope>\n";
public static void main(String[] args) throws Exception {
String url = "http://localhost:8080/axis/services/EchoService";
String action = "EchoService" ;
InputStream input = new ByteArrayInputStream(msg.getBytes());
Service service = new Service();
Call call = (Call) service.createCall();
SOAPEnvelope env = new SOAPEnvelope(input);
call.setTargetEndpointAddress( new URL(url) );
if (action != null) {
call.setUseSOAPAction( true );
call.setSOAPActionURI( action );
}
System.out.println( "Request:\n" + msg );
env = call.invoke( env );
System.out.println( "Response:\n" + env.toString() );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -