📄 testhelloworld.java
字号:
package com.foshanshop.AppTest;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
import org.jboss.ws.jaxrpc.ServiceFactoryImpl;
import com.foshanshop.client.HelloWorld;
public class TestHelloWorld {
public static void main(String[] args) {
try {
URL helloWsdlUrl = new URL("http://localhost:8080/Services/HelloWorldService?wsdl");
String nameSpaceUri = "http://com.foshanshop.ws";
URL mappingURL = new TestHelloWorld().getClass().getClassLoader().getResource("META-INF/jaxrpc-mapping.xml");
ServiceFactoryImpl factory = new ServiceFactoryImpl();
Service service = factory.createService(helloWsdlUrl, new QName(nameSpaceUri, "HelloWorldService"), mappingURL);
HelloWorld port = (HelloWorld) service.getPort(HelloWorld.class);
String out = port.sayHello("佛山人");
System.out.println("结果:"+out);
} catch (Exception e) {
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -