helloservicewsifclient.java
来自「精通Jboss——Ejb和Web Services开发精解的随书源代码」· Java 代码 · 共 30 行
JAVA
30 行
package com.liuyang.wsif.client;
import org.apache.wsif.WSIFException;
import org.apache.wsif.WSIFMessage;
import org.apache.wsif.WSIFOperation;
import org.apache.wsif.WSIFPort;
import org.apache.wsif.WSIFService;
import org.apache.wsif.WSIFServiceFactory;
public class HelloServiceWSIFClient {
public static void main(String[] args) throws WSIFException {
String url = "http://localhost:8080/axis/services/HelloService?wsdl";
WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
WSIFService service =factory.getService(url,
"http://localhost:8080/axis/services/HelloService",
"HelloServiceService",
"http://localhost:8080/axis/services/HelloService",
"HelloService");
WSIFPort port = service.getPort();
WSIFOperation operation = port.createOperation("sayHello","sayHelloRequest",null);
WSIFMessage input = operation.createInputMessage();
input.setObjectPart("name", "liuyang");
WSIFMessage output = operation.createOutputMessage();
WSIFMessage fault = operation.createFaultMessage();
operation.executeRequestResponseOperation(input, output, fault);
System.out.println(output.getObjectPart("sayHelloReturn"));
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?