⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logpersonwebserviceclientnospring.java

📁 《精通Spring》源代码
💻 JAVA
字号:
/*
 * Created on 2005-2-10
 * 
 * http://www.open-v.com 提供代码的维护工作
 */
package com.openv.spring;

import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;

import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceException;
import javax.xml.rpc.ServiceFactory;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * LogPersonWebServiceClientNoSpring客户应用
 * 
 * @author luoshifei
 */
public class LogPersonWebServiceClientNoSpring {
    private static final Log log = LogFactory
            .getLog(LogPersonWebServiceClientNoSpring.class);

    public static void main(String[] args) {
        String wsdlDocumentUrl = 
            "http://localhost:8080/example28/axis/LogPerson?wsdl";
        String namespaceUri = 
            "http://localhost:8080/example28/axis/LogPerson";
        String serviceName = "JaxRpcLogPersonServiceService";
        String portName = "LogPerson";

        QName serviceQN = new QName(namespaceUri, serviceName);
        QName portQN = new QName(namespaceUri, portName);

        try {
            
            ServiceFactory sf = ServiceFactory.newInstance();
            Service service = sf.createService(new URL(wsdlDocumentUrl),
                    serviceQN);

            RemoteILogPerson iLogPerson = (RemoteILogPerson) service.getPort(
                    portQN, RemoteILogPerson.class);
            
            log.info(iLogPerson.getPerson("Shifei,Luo"));
            
        } catch (ServiceException se) {
            log.error("ServiceException异常", se);
        } catch (MalformedURLException mu) {
            log.error("MalformedURLException异常", mu);
        } catch (RemoteException re) {
            log.error("RemoteException异常", re);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -