??xml version="1.0" encoding="utf-8" standalone="yes"?>岛国一区二区三区高清视频,亚洲国产另类 国产精品国产免费,91精品国产综合久久小美女http://www.aygfsteel.com/sxyx2008/category/45653.html温馨提示Q?zhn)的每一ơ{?体现?jin)我写此文的意?!!?ch)请?zhn)在转蝲时注明出处http://www.aygfsteel.com/sxyx2008/谢谢合作!!! zh-cnTue, 02 Apr 2013 13:23:24 GMTTue, 02 Apr 2013 13:23:24 GMT60Zmaven的多框架和多视图融合技?Struts1、Struts2、Spring、SpringMVC、Hibernate、Ibatis、MyBatis、Spring Data JPA、DWR)http://www.aygfsteel.com/sxyx2008/archive/2012/09/25/388490.html雪山飞鹄雪山飞鹄Tue, 25 Sep 2012 03:40:00 GMThttp://www.aygfsteel.com/sxyx2008/archive/2012/09/25/388490.htmlhttp://www.aygfsteel.com/sxyx2008/comments/388490.htmlhttp://www.aygfsteel.com/sxyx2008/archive/2012/09/25/388490.html#Feedback0http://www.aygfsteel.com/sxyx2008/comments/commentRss/388490.htmlhttp://www.aygfsteel.com/sxyx2008/services/trackbacks/388490.html该项目基于maven3.0构徏的,目中融合了(jin)Struts1、Struts2、Spring、SpringMVC、Hibernate、Ibatis、MyBatis、Spring Data JPA、Spring JDBC、Spring DWR。页面展现这里用Struts1、Struts2、SpringMVCQjsp视图、velocity视图、freemarker视图、pdf视图、excel视图、xml视图、json视图{)(j)。是一个综合性行的项目。该目后期?x)陆l集成Spring的一些好的框架进来比如说Spring Web Flow、Spring Security 、Jbpm、WebService、Compass、Solr、nutch{。M是一个综合性的目。该目不处理业务,主要是把目前自己工作中用到过的各U框架糅合到一个项目中。纯_Ҏ(gu)一个jee框架的糅合,主要是介l各U技术?/p>

介绍下目前用的各个框架的版本信?/p>

Struts1 1.3.10

Struts2 2.3.8

Spring 3.2.0.RELEASE

Hibernate 4.2.0.Final

Ibatis 2.3.4.726

MyBatis 3.1.1

Spring Data JPA 1.3.0.RELEASE

DWR 3.0.M1

目中的持久化框架sql语句的跟t采用了(jin)log4jdbc4l合log4jQ在控制台可以看到完整的sql语句?/p>

该项目中使用到的技术均与Spring已集成。除?jin)DWR与Spring集成使用xml文g中配|bean?其他的bean均用注解完善。每一个与数据库有关的都有事务处理?/p>

目l构?/p>


目托管SVN地址Q?/span>http://maven-framework-project.googlecode.com/svn/trunk/ (限于大陆google code 不稳?Dl常无法讉K,该地址已不在同?使用github地址)
目托管GitHub地址Q?/span>https://github.com/sxyx2008/maven-framework-project/Q推荐用)(j)

最后希望有兴趣的朋友可以加入进来,大家一起完善他。把自己的技术分享出来。如有Q何问题可以与我联p?/p>

联系方式

QQQ?84675420

EmailQsxyx2008@gmail.com



雪山飞鹄 2012-09-25 11:40 发表评论
]]>
xfire集成spring发布webservicehttp://www.aygfsteel.com/sxyx2008/archive/2011/06/15/352330.html雪山飞鹄雪山飞鹄Wed, 15 Jun 2011 02:03:00 GMThttp://www.aygfsteel.com/sxyx2008/archive/2011/06/15/352330.htmlhttp://www.aygfsteel.com/sxyx2008/comments/352330.htmlhttp://www.aygfsteel.com/sxyx2008/archive/2011/06/15/352330.html#Feedback0http://www.aygfsteel.com/sxyx2008/comments/commentRss/352330.htmlhttp://www.aygfsteel.com/sxyx2008/services/trackbacks/352330.html<servlet>
        
<servlet-name>xfire</servlet-name>
        
<servlet-class>
            org.springframework.web.servlet.DispatcherServlet
        
</servlet-class>
</servlet>
<servlet-mapping>
        
<servlet-name>xfire</servlet-name>
        
<url-pattern>*.ws</url-pattern>
</servlet-mapping>在spring配置文g中加入以?
<bean id="xfire.annotationServiceFactory"
        class
="org.codehaus.xfire.annotations.AnnotationServiceFactory">
        
<constructor-arg index="0">
            
<ref bean="xfire.commonsAnnotations"/>
        
</constructor-arg>
        
<constructor-arg index="1">
            
<ref bean="xfire.transportManager"/>
        
</constructor-arg>
        
<constructor-arg index="2">
            
<ref bean="xfire.aegisBindingProvider"/>
        
</constructor-arg>
    
</bean>

    
<bean id="xfire.commonsAnnotations"
        class
="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations"/>
    
    
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        
<property name="urlMap">
            
<map>
                
<entry key="/SynchronizService.ws">
                    
<ref bean="synchronizservice"/>
                
</entry>
            
</map>
        
</property>
    
</bean>
    
    
<bean name="synchronizservice" class="org.codehaus.xfire.spring.remoting.XFireExporter">
        
<property name="serviceBean" ref="synchronizserviceBean"/>
        
<property name="serviceClass"><value>com.futuresoftware.webservices.SynchronizService</value></property>
        
<property name="serviceFactory" ref="xfire.annotationServiceFactory"/>
      
</bean>

      
<bean id="synchronizserviceBean" class="com.futuresoftware.webservices.SynchronizServiceImpl"/>

以上是基于注解方式的配置具体配置可参?br />http://xfire.codehaus.org/Advanced+Configuration



雪山飞鹄 2011-06-15 10:03 发表评论
]]>
使用CXF发布和调用webservice之HelloWorld入门http://www.aygfsteel.com/sxyx2008/archive/2010/09/15/332058.html雪山飞鹄雪山飞鹄Wed, 15 Sep 2010 03:18:00 GMThttp://www.aygfsteel.com/sxyx2008/archive/2010/09/15/332058.htmlhttp://www.aygfsteel.com/sxyx2008/comments/332058.htmlhttp://www.aygfsteel.com/sxyx2008/archive/2010/09/15/332058.html#Feedback7http://www.aygfsteel.com/sxyx2008/comments/commentRss/332058.htmlhttp://www.aygfsteel.com/sxyx2008/services/trackbacks/332058.html依赖的JAR
    cxf-2.2.10.jar
    jetty-6.1.21.jar
    jetty-util-6.1.21.jar
    servlet-2_5-api.jar
    wsdl4j-1.6.2.jar
    XmlSchema-1.4.5.jar
创徏一个普通的Java工程卛_

创徏webservice接口
package com.cxf.interfaces;

import javax.jws.WebParam;
import javax.jws.WebService;

@WebService
public interface HelloWorldServiceInf {
    
    String sayHello(@WebParam(name
="username") String username);
    
}
发布和调用webservice
        Ҏ(gu)一
发布webservice
package com.cxf.impl;

import javax.jws.WebService;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;

import com.cxf.interfaces.HelloWorldServiceInf;

@WebService(endpointInterface
="com.cxf.interfaces.HelloWorldServiceInf",serviceName="helloWorldService")
public class Server implements HelloWorldServiceInf {

    
public String sayHello(String username) {
        
return "Hello,"+username;
    }

    
    
public static void main(String[] args) {
        Server impl
=new Server();
        JaxWsServerFactoryBean factoryBean
=new JaxWsServerFactoryBean();
        factoryBean.setAddress(
"http://localhost:9000/hello");
        factoryBean.setServiceClass(HelloWorldServiceInf.
class);
        factoryBean.setServiceBean(impl);
        factoryBean.getInInterceptors().add(
new LoggingInInterceptor());
        factoryBean.getOutInterceptors().add(
new LoggingOutInterceptor());
        factoryBean.create();
    }
    
}
wsdl描述文g
  <?xml version="1.0" ?> 
<wsdl:definitions name="HelloWorldServiceInfService" targetNamespace="http://interfaces.cxf.com/" xmlns:ns1="http://schemas.xmlsoap.org/wsdl/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://interfaces.cxf.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://interfaces.cxf.com/" xmlns:tns="http://interfaces.cxf.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  
<xsd:element name="sayHello" type="tns:sayHello" /> 
<xsd:complexType name="sayHello">
<xsd:sequence>
  
<xsd:element minOccurs="0" name="username" type="xsd:string" /> 
  
</xsd:sequence>
  
</xsd:complexType>
  
<xsd:element name="sayHelloResponse" type="tns:sayHelloResponse" /> 
<xsd:complexType name="sayHelloResponse">
<xsd:sequence>
  
<xsd:element minOccurs="0" name="return" type="xsd:string" /> 
  
</xsd:sequence>
  
</xsd:complexType>
  
</xsd:schema>
  
</wsdl:types>
<wsdl:message name="sayHelloResponse">
  
<wsdl:part element="tns:sayHelloResponse" name="parameters" /> 
  
</wsdl:message>
<wsdl:message name="sayHello">
  
<wsdl:part element="tns:sayHello" name="parameters" /> 
  
</wsdl:message>
<wsdl:portType name="HelloWorldServiceInf">
<wsdl:operation name="sayHello">
  
<wsdl:input message="tns:sayHello" name="sayHello" /> 
  
<wsdl:output message="tns:sayHelloResponse" name="sayHelloResponse" /> 
  
</wsdl:operation>
  
</wsdl:portType>
<wsdl:binding name="HelloWorldServiceInfServiceSoapBinding" type="tns:HelloWorldServiceInf">
  
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
<wsdl:operation name="sayHello">
  
<soap:operation soapAction="" style="document" /> 
<wsdl:input name="sayHello">
  
<soap:body use="literal" /> 
  
</wsdl:input>
<wsdl:output name="sayHelloResponse">
  
<soap:body use="literal" /> 
  
</wsdl:output>
  
</wsdl:operation>
  
</wsdl:binding>
<wsdl:service name="HelloWorldServiceInfService">
<wsdl:port binding="tns:HelloWorldServiceInfServiceSoapBinding" name="HelloWorldServiceInfPort">
  
<soap:address location="http://localhost:9000/hello" /> 
  
</wsdl:port>
  
</wsdl:service>
  
</wsdl:definitions>
客户端调?br />
package com.cxf.client;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import com.cxf.interfaces.HelloWorldServiceInf;

public class Client {
    
public static void main(String[] args) {
        JaxWsProxyFactoryBean  factoryBean
=new JaxWsProxyFactoryBean();
        factoryBean.getInInterceptors().add(
new LoggingInInterceptor());
        factoryBean.getOutInterceptors().add(
new LoggingOutInterceptor());
        factoryBean.setServiceClass(HelloWorldServiceInf.
class);
        factoryBean.setAddress(
"http://localhost:9000/hello");
        HelloWorldServiceInf impl
=(HelloWorldServiceInf) factoryBean.create();
        System.out.println(impl.sayHello(
"张三"));
    }
}
        Ҏ(gu)?br /> 发布webservice
package com.cxf.impl;

import javax.jws.WebService;
import javax.xml.ws.Endpoint;

import com.cxf.interfaces.HelloWorldServiceInf;

@WebService(endpointInterface
="com.cxf.interfaces.HelloWorldServiceInf",serviceName="helloWorldService")
public class Server implements HelloWorldServiceInf {

    
public String sayHello(String username) {
        
return "Hello,"+username;
    }
    
public static void main(String[] args) {
        Server impl
=new Server();
        String address
="http://localhost:9000/hello";
        Endpoint.publish(address, impl);
    }
}
wsdl文g
  <?xml version="1.0" ?> 
<wsdl:definitions name="helloWorldService" targetNamespace="http://impl.cxf.com/" xmlns:ns1="http://interfaces.cxf.com/" xmlns:ns2="http://schemas.xmlsoap.org/wsdl/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://impl.cxf.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  
<wsdl:import location="http://localhost:9000/hello?wsdl=HelloWorldServiceInf.wsdl" namespace="http://interfaces.cxf.com/" /> 
<wsdl:binding name="helloWorldServiceSoapBinding" type="ns1:HelloWorldServiceInf">
  
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
<wsdl:operation name="sayHello">
  
<soap:operation soapAction="" style="document" /> 
<wsdl:input name="sayHello">
  
<soap:body use="literal" /> 
  
</wsdl:input>
<wsdl:output name="sayHelloResponse">
  
<soap:body use="literal" /> 
  
</wsdl:output>
  
</wsdl:operation>
  
</wsdl:binding>
<wsdl:service name="helloWorldService">
<wsdl:port binding="tns:helloWorldServiceSoapBinding" name="ServerPort">
  
<soap:address location="http://localhost:9000/hello" /> 
  
</wsdl:port>
  
</wsdl:service>
  
</wsdl:definitions>
客户端调?br />
package com.cxf.client;

import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPBinding;

import com.cxf.interfaces.HelloWorldServiceInf;

public class Client {
    
//注意Q此处http://interfaces.cxf.com/  来源于wsdl文g中namespace   <wsdl:import location="http://localhost:9000/hello?wsdl=HelloWorldServiceInf.wsdl" namespace="http://interfaces.cxf.com/" /> 

    
private static final QName SERVICE_NAME=new QName("http://interfaces.cxf.com/","HelloWorldServiceInf");//HelloWorldServiceInf接口cȝ名称
    private static final QName PORT_NAME=new QName("http://interfaces.cxf.com/""HelloWorldServiceInfPort");//HelloWorldServiceInfPort 接口cȝ名称+Port
    public static void main(String[] args) {
        String endPointAddress
="http://localhost:9000/hello";
        Service service
=Service.create(SERVICE_NAME);
        service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endPointAddress);
        HelloWorldServiceInf inf
=service.getPort(HelloWorldServiceInf.class);
        System.out.println(inf.sayHello(
"张三"));
    }
}
CXFҎ(gu)wsdl文g动态调用WebService
package com.cxf.client;

import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;

public class ClientFromWsdl {
    
    
public static void main(String[] args) throws Exception{
        JaxWsDynamicClientFactory dcf 
= JaxWsDynamicClientFactory.newInstance();
        org.apache.cxf.endpoint.Client client 
= dcf.createClient("http://localhost:9000/hello?wsdl");
        
//sayHello 为接口中定义的方法名U?nbsp;  张三Z递的参数   q回一个Object数组
        Object[] objects=client.invoke("sayHello""张三"); 
        
//输出调用l果
        System.out.println(objects[0].toString());
    }
}
下蝲工程代码

雪山飞鹄 2010-09-15 11:18 发表评论
]]>
Apache之CXF HelloWorld入门http://www.aygfsteel.com/sxyx2008/archive/2010/09/10/331613.html雪山飞鹄雪山飞鹄Fri, 10 Sep 2010 01:51:00 GMThttp://www.aygfsteel.com/sxyx2008/archive/2010/09/10/331613.htmlhttp://www.aygfsteel.com/sxyx2008/comments/331613.htmlhttp://www.aygfsteel.com/sxyx2008/archive/2010/09/10/331613.html#Feedback7http://www.aygfsteel.com/sxyx2008/comments/commentRss/331613.htmlhttp://www.aygfsteel.com/sxyx2008/services/trackbacks/331613.htmlFelix?a title="Service Framework" >CXF{?a title="OSGi Framework and components." >Felix是Apache对OSGI R4规范的一个轻量实现。你使用eclipse创徏的plugin(插g)工程都是可以正常q行?a title="OSGi Framework and components." >Felix中的。前提是你创建bundle的时候选择标准选项q一栏。好?jin)本文章主要是用来介?a title="Service Framework" >CXF的,关于Felix׃再深入讨Z(jin)Q有兴趣的可以自行去研究下?br />         关于CXFQ不做过多的解释。官方的解释已经够清楚了(jin)。相信大家之前在Java环境下创建webserviceE序大多数选择的是xfireq个框架吧。后来好多专家不再推荐这个东东。都使用CXF。在未接触到CXF之前Q本Z向喜Ƣ用xfireq个框架来创qwebservice。还?sh)(jin),废话不多_(d)先来看个HelloWorld的程序,教大家快速上手?br />         首先去Apache|站下蝲CXF所需要的jarQ我本h下蝲?a class="external-link" rel="nofollow">apache-cxf-2.2.10.zipq个包。这里ؓ(f)?jin)方便期间创Z个java工程。啊Qjava工程Q这有点不可思议?jin),不是要创建webservice吗?怎么是java工程Q呵呵,q里是CXF的神奇之?
        d必须的jarC的classpath路径下?br />         cxf-2.2.10.jar 核心(j)jar
        jetty-6.1.21.jar 用来启动jetty服务?br />         jetty-util-6.1.21.jar jetty辅助工具
        wsdl4j-1.6.2.jar wsdl支持工具
        XmlSchema-1.4.5.jar 
        q就?a title="Service Framework" >CXF的最配|,以上jar包缺一不可
        创徏一个接?br />
package com.cxf.service;

public interface HelloWorldCxfService {
    
    String sayHello(String username);
}
        创徏该接口的实现c?br />
package com.cxf.service;

public class HelloWorldCxfServiceImpl implements HelloWorldCxfService {

    
public String sayHello(String username) {
        
return "Hello,"+username;
    }
}
        发布webservice
package com.cxf.server;

import org.apache.cxf.frontend.ServerFactoryBean;

import com.cxf.service.HelloWorldCxfService;
import com.cxf.service.HelloWorldCxfServiceImpl;

public class Server {
    
    
public static void main(String[] args){
        HelloWorldCxfServiceImpl worldCxfServiceImpl
=new HelloWorldCxfServiceImpl();
        ServerFactoryBean factoryBean
=new ServerFactoryBean();
        factoryBean.setAddress(
"http://localhost:8080/hello");
        factoryBean.setServiceClass(HelloWorldCxfService.
class);
        factoryBean.setServiceBean(worldCxfServiceImpl);
        factoryBean.create();
    }
}
        q行ServerQ注意不要关闭,在控制台?x)打印如下信息?x)
2010-9-10 9:44:16 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
信息: Creating Service {http://service.cxf.com/}HelloWorldCxfService from class com.cxf.service.HelloWorldCxfService
2010-9-10 9:44:16 org.apache.cxf.endpoint.ServerImpl initDestination
信息: Setting the server's publish address to be http://localhost:8080/hello
2010-09-10 09:44:16.296::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
2010-09-10 09:44:16.296::INFO:  jetty-6.1.21
2010-09-10 09:44:16.390::INFO:  Started SelectChannelConnector@localhost:8080
        客户端调?br />
package com.cxf.server;

import org.apache.cxf.frontend.ClientProxyFactoryBean;

import com.cxf.service.HelloWorldCxfService;

public class Client {
    
    
public static void main(String[] args) {
        ClientProxyFactoryBean factoryBean
=new ClientProxyFactoryBean();
        factoryBean.setAddress(
"http://localhost:8080/hello");
        factoryBean.setServiceClass(HelloWorldCxfService.
class);
        HelloWorldCxfService worldCxfService
=(HelloWorldCxfService) factoryBean.create();
        System.out.println(worldCxfService.sayHello(
"张三"));
    }
}
        q行Client代码Q控制台打印如下信息Q?br />
2010-9-10 9:46:58 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
信息: Creating Service {http://service.cxf.com/}HelloWorldCxfService from class com.cxf.service.HelloWorldCxfService
Hello,张三
        到此Q我们的webserviceQ已l成功调用了(jin)。大家是不是q不?qing)待的想看下wsdl文g是啥L(fng)呢?
在浏览器中输?a href="http://localhost:8080/hello?wsdl">http://localhost:8080/hello?wsdlQ即可看到wsdl文g?jin)。其?a href="http://localhost:8080/hello?wsdl">http://localhost:8080/hello部分Z码里指定的Address?br />         wsdl文g信息Q?br />
  <?xml version="1.0" ?> 
<wsdl:definitions name="HelloWorldCxfService" targetNamespace="http://service.cxf.com/" xmlns:ns1="http://schemas.xmlsoap.org/wsdl/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service.cxf.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://service.cxf.com/" xmlns:tns="http://service.cxf.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  
<xsd:element name="sayHello" type="tns:sayHello" /> 
<xsd:complexType name="sayHello">
<xsd:sequence>
  
<xsd:element minOccurs="0" name="arg0" type="xsd:string" /> 
  
</xsd:sequence>
  
</xsd:complexType>
  
<xsd:element name="sayHelloResponse" type="tns:sayHelloResponse" /> 
<xsd:complexType name="sayHelloResponse">
<xsd:sequence>
  
<xsd:element minOccurs="0" name="return" type="xsd:string" /> 
  
</xsd:sequence>
  
</xsd:complexType>
  
</xsd:schema>
  
</wsdl:types>
<wsdl:message name="sayHelloResponse">
  
<wsdl:part element="tns:sayHelloResponse" name="parameters" /> 
  
</wsdl:message>
<wsdl:message name="sayHello">
  
<wsdl:part element="tns:sayHello" name="parameters" /> 
  
</wsdl:message>
<wsdl:portType name="HelloWorldCxfServicePortType">
<wsdl:operation name="sayHello">
  
<wsdl:input message="tns:sayHello" name="sayHello" /> 
  
<wsdl:output message="tns:sayHelloResponse" name="sayHelloResponse" /> 
  
</wsdl:operation>
  
</wsdl:portType>
<wsdl:binding name="HelloWorldCxfServiceSoapBinding" type="tns:HelloWorldCxfServicePortType">
  
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
<wsdl:operation name="sayHello">
  
<soap:operation soapAction="" style="document" /> 
<wsdl:input name="sayHello">
  
<soap:body use="literal" /> 
  
</wsdl:input>
<wsdl:output name="sayHelloResponse">
  
<soap:body use="literal" /> 
  
</wsdl:output>
  
</wsdl:operation>
  
</wsdl:binding>
<wsdl:service name="HelloWorldCxfService">
<wsdl:port binding="tns:HelloWorldCxfServiceSoapBinding" name="HelloWorldCxfServicePort">
  
<soap:address location="http://localhost:8080/hello" /> 
  
</wsdl:port>
  
</wsdl:service>
  
</wsdl:definitions>
                

雪山飞鹄 2010-09-10 09:51 发表评论
]]>
Hessian一个轻量的remoting on http工具http://www.aygfsteel.com/sxyx2008/archive/2010/09/01/330493.html雪山飞鹄雪山飞鹄Wed, 01 Sep 2010 01:24:00 GMThttp://www.aygfsteel.com/sxyx2008/archive/2010/09/01/330493.htmlhttp://www.aygfsteel.com/sxyx2008/comments/330493.htmlhttp://www.aygfsteel.com/sxyx2008/archive/2010/09/01/330493.html#Feedback2http://www.aygfsteel.com/sxyx2008/comments/commentRss/330493.htmlhttp://www.aygfsteel.com/sxyx2008/services/trackbacks/330493.html         Hessian是一个轻量的remoting on http工具Q用简单的Ҏ(gu)提供?jin)RMI的功? 相比WebServiceQHessian更简单、快捗采用的是二q制RPC协议Q因为采用的是二q制协议Q所以它很适合于发送二q制数据.
        开元百U这样介l它Q?br />         Hessian是Caucho开发的一U二q制Web Service协议。采取Apache许可协议. 
        The Hessian binary web service protocol makes web services usable without requiring a large framework, and without learning yet another alphabet soup of protocols. Because it is a binary protocol, it is well-suited to sending binary data without any need to extend the protocol with attachments.
Hessian是一个精?j)打造的Web Service实现Q它支持Java、C#、Ruby、PHP和PythonQ又新增?jin)ActionScript。用Adobe Flash和Flex的RIA开发者们在需要集成业务服务的时候,Hessian应该是一个不错的选择?br />         既然都它q么奇Q那么我们就又要去认识下q位新朋友?br />         目主页Q?a >http://hessian.caucho.com/
        大家仔细认真阅读下官方网站?br />         q是先从helloworld着手?br />         它只需要一个jar包即?br />         d方下载适用于java环境下的jar包支?br />         hessian-4.0.7.jar   hessian-4.0.7-src.jar
        创徏web工程?br />         ~写接口Q?br />
package com.hessian.demo.inf;

public interface HelloWorld {
    
    
public String sayHelloWorld(String name);
    
}
        ~写实现c:(x)
package com.hessian.demo.impl;

import com.hessian.demo.inf.HelloWorld;

public class HelloWorldImpl implements HelloWorld {

    
public String sayHelloWorld(String name) {
        
return "Hello ,"+name+"Welcome to use hessian ! ";
    }

}
        配置web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
    xmlns
="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation
="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>
    
<servlet>
        
<servlet-name>helloworld</servlet-name>
        
<servlet-class>com.caucho.hessian.server.HessianServlet</servlet-class>
        
<init-param>
            
<!-- 此处hom-api为固定写?为HessianServlet中定义的参数详细可参考HessianServlet -->
            
<!-- 其gؓ(f)接口的类长名?nbsp;包名+cd -->
            
<param-name>home-api</param-name>
            
<param-value>com.hessian.demo.inf.HelloWorld</param-value>
        
</init-param>
        
<init-param>
            
<!-- 此处hom-class为固定写?为HessianServlet中定义的参数详细可参考HessianServlet -->
            
<!-- 其gؓ(f)实现cȝc长名即 包名+cd -->
            
<param-name>home-class</param-name>
            
<param-value>com.hessian.demo.impl.HelloWorldImpl</param-value>
        
</init-param>
    
</servlet>
    
<servlet-mapping>
        
<servlet-name>helloworld</servlet-name>
        
<url-pattern>/helloworld</url-pattern>
    
</servlet-mapping>
</web-app>
        此处web.xml中配|的初始化参数具体可参考HessianServlet的init()Ҏ(gu)
public void init(ServletConfig config)
    
throws ServletException
  {
    
super.init(config);
    
    
try {
      
if (_homeImpl != null) {
      }
      
else if (getInitParameter("home-class"!= null) {
    String className 
= getInitParameter("home-class");
    
    Class homeClass 
= loadClass(className);

    _homeImpl 
= homeClass.newInstance();
    
    init(_homeImpl);
      }
      
else if (getInitParameter("service-class"!= null) {
    String className 
= getInitParameter("service-class");
    
    Class homeClass 
= loadClass(className);

    _homeImpl 
= homeClass.newInstance();
    
    init(_homeImpl);
      }
      
else {
    
if (getClass().equals(HessianServlet.class))
      
throw new ServletException("server must extend HessianServlet");

    _homeImpl 
= this;
      }

      
if (_homeAPI != null) {
      }
      
else if (getInitParameter("home-api"!= null) {
    String className 
= getInitParameter("home-api");
    
    _homeAPI 
= loadClass(className);
      }
      
else if (getInitParameter("api-class"!= null) {
    String className 
= getInitParameter("api-class");

    _homeAPI 
= loadClass(className);
      }
      
else if (_homeImpl != null) {
    _homeAPI 
= findRemoteAPI(_homeImpl.getClass());

    
if (_homeAPI == null)
      _homeAPI 
= _homeImpl.getClass();
      }
      
      
if (_objectImpl != null) {
      }
      
else if (getInitParameter("object-class"!= null) {
    String className 
= getInitParameter("object-class");
    
    Class objectClass 
= loadClass(className);

    _objectImpl 
= objectClass.newInstance();

    init(_objectImpl);
      }

      
if (_objectAPI != null) {
      }
      
else if (getInitParameter("object-api"!= null) {
    String className 
= getInitParameter("object-api");
    
    _objectAPI 
= loadClass(className);
      }
      
else if (_objectImpl != null)
    _objectAPI 
= _objectImpl.getClass();

      _homeSkeleton 
= new HessianSkeleton(_homeImpl, _homeAPI);
      
if (_objectAPI != null)
    _homeSkeleton.setObjectClass(_objectAPI);

      
if (_objectImpl != null) {
    _objectSkeleton 
= new HessianSkeleton(_objectImpl, _objectAPI);
    _objectSkeleton.setHomeClass(_homeAPI);
      }
      
else
    _objectSkeleton 
= _homeSkeleton;

      
if ("true".equals(getInitParameter("debug")))
    _isDebug 
= true;

      
if ("false".equals(getInitParameter("send-collection-type")))
    setSendCollectionType(
false);
    } 
catch (ServletException e) {
      
throw e;
    } 
catch (Exception e) {
      
throw new ServletException(e);
    }
  }
         ~写客户端测试代码:(x)
package com.hessian.demo.client;

import com.caucho.hessian.client.HessianProxyFactory;
import com.hessian.demo.inf.HelloWorld;

public class HelloWorldClient {
    
    
public static void main(String[] args) throws Exception{
        
//servlet的访问\?/span>
        String url="http://localhost:8080/hessian/helloworld";
        
//创徏一HessianProxyFactory对象,用法与xfire很像
        HessianProxyFactory proxyFactory=new HessianProxyFactory();
        
//获得HelloWorld的实?传递两个参Cơؓ(f):接口.class,该servlet的访问\?/span>
        HelloWorld helloWorld=(HelloWorld) proxyFactory.create(HelloWorld.class, url);
        System.out.println(helloWorld.sayHelloWorld(
"张三"));
    }
}
        效果图:(x)




雪山飞鹄 2010-09-01 09:24 发表评论
]]>
L使用xfire~写q回gؓ(f)list的webservice服务http://www.aygfsteel.com/sxyx2008/archive/2010/07/14/326063.html雪山飞鹄雪山飞鹄Wed, 14 Jul 2010 03:05:00 GMThttp://www.aygfsteel.com/sxyx2008/archive/2010/07/14/326063.htmlhttp://www.aygfsteel.com/sxyx2008/comments/326063.htmlhttp://www.aygfsteel.com/sxyx2008/archive/2010/07/14/326063.html#Feedback2http://www.aygfsteel.com/sxyx2008/comments/commentRss/326063.htmlhttp://www.aygfsteel.com/sxyx2008/services/trackbacks/326063.html阅读全文

雪山飞鹄 2010-07-14 11:05 发表评论
]]>
在XFire中用友好的接口参数?/title><link>http://www.aygfsteel.com/sxyx2008/archive/2010/06/07/322945.html</link><dc:creator>雪山飞鹄</dc:creator><author>雪山飞鹄</author><pubDate>Mon, 07 Jun 2010 02:13:00 GMT</pubDate><guid>http://www.aygfsteel.com/sxyx2008/archive/2010/06/07/322945.html</guid><wfw:comment>http://www.aygfsteel.com/sxyx2008/comments/322945.html</wfw:comment><comments>http://www.aygfsteel.com/sxyx2008/archive/2010/06/07/322945.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.aygfsteel.com/sxyx2008/comments/commentRss/322945.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/sxyx2008/services/trackbacks/322945.html</trackback:ping><description><![CDATA[<p>        q期在做多个数据库应用交互系l,其中数据交互采用?jin)webservice的方式,说到webservice目中不得不用到xfireq个框架Q有?jin)它我们几乎不用写代码,可以很快速的创徏自己的webservice<br />         但在使用的过E中遇到一些小l节上的问题Q?br /> 是在写webservice接口的时候,通常大家都会(x)定义一些方法的参数Q但是根据xfire的xsd文g描述情况来看Q它的参数命名通常是in0,in1{等Q一ơ类推,很不友好?br />         按照XFire-Spring生成的WSDL文中接口参数名极不友好Q?<br /> <xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true" type="xsd:string" /> <br /> <xsd:element maxOccurs="1" minOccurs="1" name="in1" nillable="true" type="xsd:string" /> <br /> <xsd:element maxOccurs="1" minOccurs="1" name="in2" nillable="true" type="xsd:string" /> <br /> <xsd:element maxOccurs="1" minOccurs="1" name="in3" nillable="true" type="xsd:string" /> <br />         大家都知道,作ؓ(f)一个合格的E序员,在写代码的时候方法参数命名什么的要尽量做到见名知意,昄他这U风格是不适合我们的。因此我们要创新Q这有?jin)下文?br />         如何自动in0与in1替换成友好的参数名称??<br />         Ҏ(gu)如下Q?<br />   1.在与接口cd一包下面徏一个接口类名称.aegis.xml 的文Ӟ内容如下 <br /> <?xml version="1.0" encoding="UTF-8"?>   <br /> <mappings>   <br />     <mapping>   <br />        <method name="settleMessage">   <br />            <parameter index="0"  mappedName="id" /> <br />            <parameter index="1"  mappedName="username" /> <br />            <parameter index="2"  mappedName="pass" />  <br />        </method> <br />    </mapping>   <br /> </mappings>  </p> <p>        注意Q?br />                 name为接口中Ҏ(gu)名称 <br />                 index为方法中W一个参?<br />                 mappedName为替换后的名U?<br />                 该XML文g的位|一定要与你定义的webservice的接口位于同一个目录(包下Q否则不起作?/p> <p> </p> <img src ="http://www.aygfsteel.com/sxyx2008/aggbug/322945.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/sxyx2008/" target="_blank">雪山飞鹄</a> 2010-06-07 10:13 <a href="http://www.aygfsteel.com/sxyx2008/archive/2010/06/07/322945.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ԫ</a>| <a href="http://" target="_blank">Dz</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ʳ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̩</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϣ</a>| <a href="http://" target="_blank">ƺ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">û</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">޻</a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ӱ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ƽɽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">˰</a>| <a href="http://" target="_blank"></a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>