本文整理汇总了Java中org.apache.axis.client.Call.registerTypeMapping方法的典型用法代码示例。如果您正苦于以下问题:Java Call.registerTypeMapping方法的具体用法?Java Call.registerTypeMapping怎么用?Java Call.registerTypeMapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis.client.Call
的用法示例。
在下文中一共展示了Call.registerTypeMapping方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _remove
import org.apache.axis.client.Call; //导入方法依赖的package包/类
private boolean _remove(String cacheName,String method,String key) throws ServiceException, MalformedURLException, RemoteException {
Service service = new Service();
Call call = (Call) service.createCall();
call.registerTypeMapping(
Element.class,
element,
BeanSerializerFactory.class,
BeanDeserializerFactory.class);
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("http://soap.server.ehcache.sf.net/", method));
call.addParameter("arg0", Constants.XSD_STRING, String.class, ParameterMode.IN);
call.addParameter("arg1", Constants.XSD_STRING, String.class, ParameterMode.IN);
call.setReturnClass(boolean.class);
call.setReturnQName(Constants.XSD_BOOLEAN);
return ((Boolean)call.invoke( new Object[] {cacheName,key } )).booleanValue();
}
示例2: _get
import org.apache.axis.client.Call; //导入方法依赖的package包/类
private CacheEntry _get(String cacheName,String method,String key) throws ServiceException, MalformedURLException, RemoteException {
Service service = new Service();
Call call = (Call) service.createCall();
call.registerTypeMapping(
Element.class,
element,
BeanSerializerFactory.class,
BeanDeserializerFactory.class);
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("http://soap.server.ehcache.sf.net/", method));
call.addParameter("arg0", Constants.XSD_STRING, String.class, ParameterMode.IN);
call.addParameter("arg1", Constants.XSD_STRING, String.class, ParameterMode.IN);
call.setReturnClass(Element.class);
call.setReturnQName(element);
return new SoapCacheEntry((Element) call.invoke( new Object[] {cacheName,key } ));
}
示例3: _put
import org.apache.axis.client.Call; //导入方法依赖的package包/类
private void _put(String cacheName,String method,Element el) throws ServiceException, MalformedURLException, RemoteException {
Service service = new Service();
Call call = (Call) service.createCall();
el.setResourceUri(endpoint);
call.registerTypeMapping(
Element.class,
element,
BeanSerializerFactory.class,
BeanDeserializerFactory.class);
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("http://soap.server.ehcache.sf.net/", method));
call.addParameter("arg0", Constants.XSD_STRING, String.class, ParameterMode.IN);
call.addParameter("arg1", element, Element.class, ParameterMode.IN);
call.setReturnType(Constants.XSD_ANYSIMPLETYPE);
call.invoke( new Object[] {cacheName,el } );
//call.invokeOneWay(new Object[] {cacheName,el } );
}
示例4: main
import org.apache.axis.client.Call; //导入方法依赖的package包/类
public static void main(String [] args) throws Exception
{
Options options = new Options(args);
Order order = new Order();
order.setCustomerName("Glen Daniels");
order.setShippingAddress("275 Grove Street, Newton, MA");
String [] items = new String[] { "mp3jukebox", "1600mahBattery" };
int [] quantities = new int [] { 1, 4 };
order.setItemCodes(items);
order.setQuantities(quantities);
Service service = new Service();
Call call = (Call) service.createCall();
QName qn = new QName( "urn:BeanService", "Order" );
call.registerTypeMapping(Order.class, qn,
new org.apache.axis.encoding.ser.BeanSerializerFactory(Order.class, qn),
new org.apache.axis.encoding.ser.BeanDeserializerFactory(Order.class, qn));
String result;
try {
call.setTargetEndpointAddress( new java.net.URL(options.getURL()) );
call.setOperationName( new QName("OrderProcessor", "processOrder") );
call.addParameter( "arg1", qn, ParameterMode.IN );
call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING );
result = (String) call.invoke( new Object[] { order } );
} catch (AxisFault fault) {
result = "Error : " + fault.toString();
}
System.out.println(result);
}
示例5: validateToken
import org.apache.axis.client.Call; //导入方法依赖的package包/类
public static Result validateToken(String remoteAddr, String token) throws ServiceException, RemoteException {
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
call.setEncodingStyle(nameSpace);//传非字符串类型参数需要明确
QName qn = new QName(nameSpace, "Result");
call.setReturnType(qn, Result.class);
call.registerTypeMapping(Result.class, qn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
call.setOperationName(new QName(nameSpace, "userLogon"));
call.addParameter("remoteAddr", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("appID", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("token", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("timestamp", XMLType.XSD_LONG, ParameterMode.IN);
call.addParameter("msgAbstract", XMLType.XSD_STRING, ParameterMode.IN);
long timestamp = new java.util.Date().getTime();
String msgBofore = remoteAddr + appID + token + timestamp + key;
String msg = "";
Result user = null;
try {
byte[] msgByte = java.security.MessageDigest.getInstance("MD5").digest(msgBofore.getBytes());
msg = bytes2HexString(msgByte);
user = (Result) call.invoke(new Object[]{remoteAddr, appID, token, timestamp, msg});
} catch (Exception e) {
e.printStackTrace();
}
return user;
}
开发者ID:pengchengluo,项目名称:Peking-University-Open-Research-Data-Platform,代码行数:29,代码来源:IaaaValidation.java
示例6: getSinglePerson
import org.apache.axis.client.Call; //导入方法依赖的package包/类
public static Result getSinglePerson(String personID) throws ServiceException, RemoteException {
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(personUrl);
QName qn = new QName(personNameSpace, "Result");
call.setReturnType(qn, Result.class);
call.registerTypeMapping(Result.class, qn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
call.setOperationName(new QName(personNameSpace, "getSinglePerson"));
call.addParameter("personID", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("euid", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("personName", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("nameAbbr", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("deptID", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("userType", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("appID", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("appIP", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("messageAbstract", XMLType.XSD_STRING, ParameterMode.IN);
String msgBofore = personID + "7696baa1fa4ed9679441764a271e556e";
String msg = "";
try {
byte[] msgByte = java.security.MessageDigest.getInstance("MD5").digest(msgBofore.getBytes());
msg = bytes2HexString(msgByte);
} catch (Exception e) {
e.printStackTrace();
}
Result user = (Result) call.invoke(new Object[]{personID, "", "", "", "", "", "dvn", "162.105.138.117", msg});
return user;
}
开发者ID:pengchengluo,项目名称:Peking-University-Open-Research-Data-Platform,代码行数:28,代码来源:IaaaValidation.java
示例7: regTypes
import org.apache.axis.client.Call; //导入方法依赖的package包/类
/**
* Register a set of types against the SOAP call.
* @param call The call to register against.
* @param classes The classes to register.
*/
public static void regTypes(Call call, Class...classes) {
for(int i=0; i<classes.length; i++) {
Mapping mapping = REG_CLASS_TYPES.get(classes[i]);
if(mapping != null) {
call.registerTypeMapping(classes[i], mapping.qname, mapping.serializer, mapping.deserializer);
}
}
}
示例8: regType
import org.apache.axis.client.Call; //导入方法依赖的package包/类
/**
* Register a type against the SOAP call.
* @param call The call to register against.
* @param clazz The class to register.
*/
public static void regType(Call call, Class clazz) {
Mapping mapping = REG_CLASS_TYPES.get(clazz);
if(mapping != null) {
call.registerTypeMapping(clazz, mapping.qname, mapping.serializer, mapping.deserializer);
}
}
示例9: buy
import org.apache.axis.client.Call; //导入方法依赖的package包/类
public String buy(String serverURL, int quantity, int numItems, double price)
throws Exception
{
try {
int i ;
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new URL(serverURL) );
call.setUseSOAPAction( true );
call.setSOAPActionURI( "http://www.soapinterop.org/Buy" );
call.setReturnType( XMLType.XSD_STRING );
/* sd.addOutputParam("BuyResult",
SOAPTypeMappingRegistry.XSD_STRING);
sd.addOutputParam("Result",
SOAPTypeMappingRegistry.XSD_STRING);
sd.addOutputParam("return",
SOAPTypeMappingRegistry.XSD_STRING); */
// register the PurchaseOrder class
QName poqn = new QName("http://www.soapinterop.org/Bid", "PurchaseOrder");
Class cls = PurchaseOrder.class;
call.registerTypeMapping(cls, poqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
// register the Address class
QName aqn = new QName("http://www.soapinterop.org/Bid", "Address");
cls = Address.class;
call.registerTypeMapping(cls, aqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
// register the LineItem class
QName liqn = new QName("http://www.soapinterop.org/Bid", "LineItem");
cls = LineItem.class;
call.registerTypeMapping(cls, liqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
LineItem[] lineItems = new LineItem[numItems];
for ( i = 0 ; i < numItems ; i++ )
lineItems[i] = new LineItem("Widget"+i,quantity,new BigDecimal(price));
PurchaseOrder po = new PurchaseOrder( "PO1",
Calendar.getInstance(),
new Address("Mr Big",
"40 Wildwood Lane",
"Weston",
"CT",
"06883"),
new Address("Mr Big's Dad",
"40 Wildwood Lane",
"Weston",
"CT",
"06883"),
lineItems );
call.addParameter( "PO", poqn, ParameterMode.IN );
call.setOperationName( new QName("http://www.soapinterop.org/Bid", "Buy") );
String res = (String) call.invoke( new Object[] { po } );
return( res );
}
catch( Exception e ) {
e.printStackTrace();
throw e ;
}
}
示例10: main
import org.apache.axis.client.Call; //导入方法依赖的package包/类
/**
* Main entry point. Tests a variety of echo methods and reports
* on their results.
*
* Arguments are of the form:
* -h localhost -p 8080 -s /soap/servlet/rpcrouter
*/
public static void main(String args[]) throws Exception {
// set up the call object
Options opts = new Options(args);
service = new Service();
call = (Call) service.createCall();
call.setTargetEndpointAddress( new URL(opts.getURL()) );
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://www.soapinterop.org/Bid");
// register the PurchaseOrder class
QName poqn = new QName("http://www.soapinterop.org/Bid",
"PurchaseOrder");
Class cls = PurchaseOrder.class;
call.registerTypeMapping(cls, poqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
// register the Address class
QName aqn = new QName("http://www.soapinterop.org/Bid", "Address");
cls = Address.class;
call.registerTypeMapping(cls, aqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
// register the LineItem class
QName liqn = new QName("http://www.soapinterop.org/Bid", "LineItem");
cls = LineItem.class;
call.registerTypeMapping(cls, liqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
try {
// Default return type based on what we expect
call.setOperationName( new QName("http://www.soapinterop.org/Bid", "Buy" ));
call.addParameter( "PO", poqn, ParameterMode.IN );
call.setReturnType( XMLType.XSD_STRING );
LineItem[] li = new LineItem[2];
li[0] = new LineItem("Tricorder", 1, "2500.95");
li[1] = new LineItem("Phasor", 3, "7250.95");
PurchaseOrder po = new PurchaseOrder(
"NCC-1701",
Calendar.getInstance(),
new Address("Sam Ruby", "Home", "Raleigh", "NC", "27676"),
new Address("Lou Gerstner", "Work", "Armonk", "NY", "15222"),
li
);
// issue the request
String receipt = (String) call.invoke( new Object[] {po} );
System.out.println(receipt);
} catch (Exception e) {
System.out.println("Buy failed: " + e);
throw e;
}
}
示例11: register
import org.apache.axis.client.Call; //导入方法依赖的package包/类
protected void register(Call call, Class klass, QName qname) {
call.registerTypeMapping(klass, qname, BeanSerializerFactory.class,
BeanDeserializerFactory.class);
}
示例12: testGetAssociation
import org.apache.axis.client.Call; //导入方法依赖的package包/类
private void testGetAssociation(String url, Service service, Object containingObj, Class associationClass, String rolename) throws Exception {
//Sample Scenario: http://localhost:8080/example/GetHTML?query=Bank&Credit[@id=3]&roleName=issuingBank
Call call = (Call) service.createCall();
for(Class klassToMap:getClasses())
{
QName searchClassQNameToMap = new QName("urn:"+getInversePackageName(klassToMap), klassToMap.getSimpleName());
call.registerTypeMapping(klassToMap, searchClassQNameToMap,
new org.apache.axis.encoding.ser.BeanSerializerFactory(klassToMap, searchClassQNameToMap),
new org.apache.axis.encoding.ser.BeanDeserializerFactory(klassToMap, searchClassQNameToMap));
}
QName searchClassQName = new QName("urn:"+getInversePackageName(associationClass), associationClass.getSimpleName());
call.setTargetEndpointAddress(new java.net.URL(url));
call.setOperationName(new QName("DmrService", "getAssociation"));
call.addParameter("arg1", searchClassQName, ParameterMode.IN);
call.addParameter("arg2", org.apache.axis.encoding.XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("arg3", searchClassQName, ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_ARRAY);
/*
//This block inserts the security headers in the service call
SOAPHeaderElement headerElement = new SOAPHeaderElement(call.getOperationName().getNamespaceURI(),"CSMSecurityHeader");
headerElement.setPrefix("csm");
headerElement.setMustUnderstand(false);
SOAPElement usernameElement = headerElement.addChildElement("username");
usernameElement.addTextNode("userId");
SOAPElement passwordElement = headerElement.addChildElement("password");
passwordElement.addTextNode("password");
call.addHeader(headerElement);
*/
System.out.println("Searching for association: " + containingObj.getClass().getName() + "." + rolename);
Object[] results = (Object[])call.invoke(new Object[] { containingObj, rolename, 0 });
if (results!=null && results.length> 0) {
for(Object obj : results)
{
printObject(obj, associationClass);
break;
}
}
}
示例13: getCache
import org.apache.axis.client.Call; //导入方法依赖的package包/类
public Cache getCache(String cacheName) throws Exception {
Service service = new Service();
TypeMapping tm = service.getTypeMappingRegistry().getDefaultTypeMapping();
TypeMappingUtil.registerBeanTypeMapping(tm, CacheConfiguration.class, cacheConfiguration);
TypeMappingUtil.registerBeanTypeMapping(tm, Cache.class, cache);
Call call = (Call) service.createCall();
call.registerTypeMapping(
Cache.class,
cache,
BeanSerializerFactory.class,
BeanDeserializerFactory.class);
call.registerTypeMapping(
CacheConfiguration.class,
cacheConfiguration,
BeanSerializerFactory.class,
BeanDeserializerFactory.class);
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("http://soap.server.ehcache.sf.net/", "getCache"));
call.addParameter("arg0", Constants.XSD_STRING, String.class, ParameterMode.IN);
call.setReturnClass(Element.class);
call.setReturnQName(cache);
//Object ret = call.invoke( new Object[] { } );
return (Cache) call.invoke( new Object[] {cacheName } );
}