?
package
?com.timing.env.client.axis;


/**?*/
/**
?*?
@author
?崔宏
?*?
@version
?2006-5-15?10:48:55
?
*/
import
?com.timing.env.client.proxy.AxisProxy;
import
?com.timing.env.bean.Item;

import
?javax.xml.namespace.QName;
import
?javax.xml.rpc.encoding.TypeMapping;
import
?javax.xml.rpc.encoding.TypeMappingRegistry;
import
?javax.xml.rpc.ServiceFactory;
import
?javax.xml.rpc.Service;


import
?java.net.URL;

import
?org.apache.axis.encoding.ser.BeanSerializerFactory;
import
?org.apache.axis.encoding.ser.BeanDeserializerFactory;



public
?
class
?AxisClient?
{
 ????
public
?
static
??
void
?doService()?
{
 ????????
try
?
{
????????????String?wsdlUrl?
=
????????????????????
"
http://localhost:8080/axis/services/AxisService?wsdl
"
;
????????????String?nameSpaceUri?
=
????????????????????
"
http://localhost:8080/axis/services/AxisService
"
;
????????????String?serviceName?
=
?
"
AxisServiceService
"
;
????????????String?portName?
=
?
"
AxisService
"
;

????????????ServiceFactory?serviceFactory?
=
ServiceFactory.newInstance();


????????????Service?afService?
=
????????????????????serviceFactory.createService(
new
?URL(wsdlUrl),
????????????????????????????
new
?QName(nameSpaceUri,?serviceName));
????????????TypeMappingRegistry?typeMappingRegistry
=
?afService.getTypeMappingRegistry();
????????????TypeMapping?map
=
typeMappingRegistry.getDefaultTypeMapping();
????????????QName?qName
=
new
?QName(nameSpaceUri,
"
Item
"
);
????????????Class?c
=
Class.forName(
"
com.timing.env.bean.Item
"
);
????????????map.register(c,qName,
new
?BeanSerializerFactory(c,qName),
new
?BeanDeserializerFactory(c,qName));
????????????AxisProxy?proxy?
=
?(AxisProxy)
????????????????????afService.getPort(
new
?QName(
????????????????????????????nameSpaceUri,?portName),
????????????????????????????AxisProxy.
class
);
//
???????????serviceFactory.
????????????System.out.println(
"
proxy=
"
+
proxy
==
null
);
????????????Item?item
=
proxy.doService(
new
?Item());
????????????System.out.println(item.getName());
 ????????}
?
catch
?(Exception?ex)?
{
????????????ex.printStackTrace();
????????}
????}
????
public
?
static
?
void
?main(String[]?args)?
{
????????AxisClient.doService();
????}
?
package
?com.timing.env.client.proxy;

import
?com.timing.common.TransfersData;
import
?com.timing.env.bean.Item;

import
?java.rmi.Remote;
import
?java.rmi.RemoteException;


/**?*/
/**
?*?
@author
?崔宏
?*?
@version
?2006-5-15?10:42:14
?
*/
public
?
interface
?AxisProxy?
extends
??Remote?
{
??????
public
?Item?doService(Item?item)?
throws
?RemoteException;
}
package
?com.timing.env.webservice.axis;

import
?com.timing.common.TransfersData;
import
?com.timing.env.bean.Item;


/**?*/
/**
?*?
@author
?崔宏
?*?
@version
?2006-5-12?15:44:03
?
*/
public
?
class
?AxisService?
{
 ????
public
?Item?doService(Item?_item?)
{
????????System.out.println(
"
we?do?axis
"
);
?????????
????????Item?item
=
?
new
?Item();
????????item.setName(
"
Test?OK
"
);
????????
return
?item;
????}
}
<?
xml?version
=
"
1.0
"
?encoding
=
"
UTF-8
"
?>
<
deployment?xmlns
=
"
http://xml.apache.org/axis/wsdd/
"
?xmlns:java
=
"
http://xml.apache.org/axis/wsdd/providers/java
"
>
?
<
globalConfiguration
>
??
<
parameter?name
=
"
sendMultiRefs
"
?value
=
"
true
"
/>
??
<
parameter?name
=
"
disablePrettyXML
"
?value
=
"
true
"
/>
??
<
parameter?name
=
"
adminPassword
"
?value
=
"
admin
"
/>
??
<
parameter?name
=
"
attachments.Directory
"
?value
=
"
E:\Tomcat\webapps\axis\WEB-INF\attachments
"
/>
??
<
parameter?name
=
"
dotNetSoapEncFix
"
?value
=
"
true
"
/>
??
<
parameter?name
=
"
enableNamespacePrefixOptimization
"
?value
=
"
false
"
/>
??
<
parameter?name
=
"
sendXMLDeclaration
"
?value
=
"
true
"
/>
??
<
parameter?name
=
"
sendXsiTypes
"
?value
=
"
true
"
/>
??
<
parameter?name
=
"
attachments.implementation
"
?value
=
"
org.apache.axis.attachments.AttachmentsImpl
"
/>
??
<
requestFlow
>
???
<
handler?type
=
"
java:org.apache.axis.handlers.JWSHandler
"
>
????
<
parameter?name
=
"
scope
"
?value
=
"
session
"
/>
???
</
handler
>
???
<
handler?type
=
"
java:org.apache.axis.handlers.JWSHandler
"
>
????
<
parameter?name
=
"
scope
"
?value
=
"
request
"
/>
????
<
parameter?name
=
"
extension
"
?value
=
"
.jwr
"
/>
???
</
handler
>
??
</
requestFlow
>
?
</
globalConfiguration
>
?
<
handler?name
=
"
LocalResponder
"
?type
=
"
java:org.apache.axis.transport.local.LocalResponder
"
/>
?
<
handler?name
=
"
URLMapper
"
?type
=
"
java:org.apache.axis.handlers.http.URLMapper
"
/>
?
<
handler?name
=
"
Authenticate
"
?type
=
"
java:org.apache.axis.handlers.SimpleAuthenticationHandler
"
/>
?
<
service?name
=
"
AdminService
"
?provider
=
"
java:MSG
"
>
??
<
parameter?name
=
"
allowedMethods
"
?value
=
"
AdminService
"
/>
??
<
parameter?name
=
"
enableRemoteAdmin
"
?value
=
"
false
"
/>
??
<
parameter?name
=
"
className
"
?value
=
"
org.apache.axis.utils.Admin
"
/>
??
<
namespace
>
http:
//
xml.apache.org/axis/wsdd/</namespace>
?
</
service
>
?
<
service?name
=
"
Version
"
?provider
=
"
java:RPC
"
>
??
<
parameter?name
=
"
allowedMethods
"
?value
=
"
getVersion
"
/>
??
<
parameter?name
=
"
className
"
?value
=
"
org.apache.axis.Version
"
/>
?
</
service
>
?
<
service?name
=
"
AxisService
"
?provider
=
"
java:RPC
"
>
??
<
parameter?name
=
"
allowedMethods
"
?value
=
"
*
"
/>
??
<
parameter?name
=
"
className
"
?value
=
"
com.timing.env.webservice.axis.AxisService
"
/>
??
<
typeMapping?deserializer
=
"
org.apache.axis.encoding.ser.BeanDeserializerFactory
"
?
????encodingStyle
=
"
http://schemas.xmlsoap.org/soap/encoding/
"
?
????qname
=
"
ns1:Item
"
?
????serializer
=
"
org.apache.axis.encoding.ser.BeanSerializerFactory
"
?
????type
=
"
java:com.timing.env.bean.Item
"
????xmlns:ns1
=
"
http://localhost:8080/axis/services/AxisService
"
/>
???
<
typeMapping?deserializer
=
"
org.apache.axis.encoding.ser.BeanDeserializerFactory
"
?
????encodingStyle
=
"
http://schemas.xmlsoap.org/soap/encoding/
"
?
????qname
=
"
ns1:TransfersData
"
?
????serializer
=
"
org.apache.axis.encoding.ser.BeanSerializerFactory
"
?
????type
=
"
java:com.timing.common.TransfersData
"
????xmlns:ns1
=
"
http://localhost:8080/axis/services/AxisService
"
/>
????
?
</
service
>
?
<
transport?name
=
"
http
"
>
??
<
requestFlow
>
???
<
handler?type
=
"
URLMapper
"
/>
???
<
handler?type
=
"
java:org.apache.axis.handlers.http.HTTPAuthHandler
"
/>
??
</
requestFlow
>
??
<
parameter?name
=
"
qs:list
"
?value
=
"
org.apache.axis.transport.http.QSListHandler
"
/>
??
<
parameter?name
=
"
qs:wsdl
"
?value
=
"
org.apache.axis.transport.http.QSWSDLHandler
"
/>
??
<
parameter?name
=
"
qs.list
"
?value
=
"
org.apache.axis.transport.http.QSListHandler
"
/>
??
<
parameter?name
=
"
qs.method
"
?value
=
"
org.apache.axis.transport.http.QSMethodHandler
"
/>
??
<
parameter?name
=
"
qs:method
"
?value
=
"
org.apache.axis.transport.http.QSMethodHandler
"
/>
??
<
parameter?name
=
"
qs.wsdl
"
?value
=
"
org.apache.axis.transport.http.QSWSDLHandler
"
/>
?
</
transport
>
?
<
transport?name
=
"
local
"
>
??
<
responseFlow
>
???
<
handler?type
=
"
LocalResponder
"
/>
??
</
responseFlow
>
?
</
transport
>
</
deployment
>
|
|
隨筆:2
文章:0
評論:2
引用:0
| 日 | 一 | 二 | 三 | 四 | 五 | 六 |
---|
28 | 29 | 30 | 31 | 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 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|
常用鏈接
留言簿(1)
隨筆分類
隨筆檔案
搜索
最新評論

閱讀排行榜
評論排行榜
|
|