1 2 3 4 | package xmethods.bn; public interface BNQuotePortType extends java.rmi.Remote { public float getPrice(java.lang.String isbn) throws java.rmi.RemoteException; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import java.net.URL; import javax.xml.namespace.QName; import javax.xml.rpc.Service; import javax.xml.rpc.ServiceFactory; public class SEITip { public static void main(String args[]) { try { // Create a service class with WSDL information. QName serviceName = new QName( "http://www.xmethods.net/sd/BNQuoteService.wsdl", "BNQuoteService"); URL wsdlLocation = new URL ("http://www.xmethods.net/sd/2001/BNQuoteService.wsdl"); ServiceFactory factory = ServiceFactory.newInstance(); Service service = factory.createService( wsdlLocation, serviceName); } catch (Throwable t) { t.printStackTrace(); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import java.net.URL; import javax.xml.namespace.QName; import javax.xml.rpc.Service; import javax.xml.rpc.ServiceFactory; import xmethods.bn.BNQuotePortType; public class SEITip { public static void main(String args[]) { try { // Create a service class with WSDL information. QName serviceName = new QName( "http://www.xmethods.net/sd/BNQuoteService.wsdl", "BNQuoteService"); URL wsdlLocation = new URL ("http://www.xmethods.net/sd/2001/BNQuoteService.wsdl"); ServiceFactory factory = ServiceFactory.newInstance(); Service service = factory.createService( wsdlLocation, serviceName); // Get an implementation for the SEI for the given port QName portName = new QName("", "BNQuotePort"); BNQuotePortType quote = (BNQuotePortType) service.getPort( portName, BNQuotePortType.class); } catch (Throwable t) { t.printStackTrace(); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | import java.net.URL; import javax.xml.namespace.QName; import javax.xml.rpc.Service; import javax.xml.rpc.ServiceFactory; import xmethods.bn.BNQuotePortType; public class SEITip { public static void main(String args[]) { try { // Create a service class with WSDL information. QName serviceName = new QName( "http://www.xmethods.net/sd/BNQuoteService.wsdl", "BNQuoteService"); URL wsdlLocation = new URL ("http://www.xmethods.net/sd/2001/BNQuoteService.wsdl"); ServiceFactory factory = ServiceFactory.newInstance(); Service service = factory.createService( wsdlLocation, serviceName); // Get an implementation for the SEI for the given port QName portName = new QName("", "BNQuotePort"); BNQuotePortType quote = (BNQuotePortType) service.getPort( portName, BNQuotePortType.class); // Invoke the operation float price = quote.getPrice("0672324229"); System.out.println("price = " + price); } catch (Throwable t) { t.printStackTrace(); } } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |