protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException { try { org.apache.axis.client.Call _call = super._createCall(); if (super.maintainSessionSet) { _call.setMaintainSession(super.maintainSession); } if (super.cachedUsername != null) { _call.setUsername(super.cachedUsername); } if (super.cachedPassword != null) { _call.setPassword(super.cachedPassword); } if (super.cachedEndpoint != null) { _call.setTargetEndpointAddress(super.cachedEndpoint); } if (super.cachedTimeout != null) { _call.setTimeout(super.cachedTimeout); } if (super.cachedPortName != null) { _call.setPortName(super.cachedPortName); } java.util.Enumeration keys = super.cachedProperties.keys(); while (keys.hasMoreElements()) { java.lang.String key = (java.lang.String) keys.nextElement(); _call.setProperty(key, super.cachedProperties.get(key)); } // All the type mapping information is registered // when the first call is made. // The type mapping information is actually registered in // the TypeMappingRegistry of the service, which // is the reason why registration is only needed for the first call. synchronized (this) { if (firstCall()) { // must set encoding style before registering serializers _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC); for (int i = 0; i < cachedSerFactories.size(); ++i) { java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i); javax.xml.namespace.QName qName = (javax.xml.namespace.QName) cachedSerQNames.get(i); java.lang.Object x = cachedSerFactories.get(i); if (x instanceof Class) { java.lang.Class sf = (java.lang.Class) cachedSerFactories.get(i); java.lang.Class df = (java.lang.Class) cachedDeserFactories.get(i); _call.registerTypeMapping(cls, qName, sf, df, false); } else if (x instanceof javax.xml.rpc.encoding.SerializerFactory) { org.apache.axis.encoding.SerializerFactory sf = (org.apache.axis.encoding.SerializerFactory) cachedSerFactories.get(i); org.apache.axis.encoding.DeserializerFactory df = (org.apache.axis.encoding.DeserializerFactory) cachedDeserFactories.get(i); _call.registerTypeMapping(cls, qName, sf, df, false); } } } } return _call; } catch (java.lang.Throwable _t) { throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t); } }
/** * Main entry point. Tests a variety of echo methods and reports on their results. * * <p>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; } }
public static void main(String[] args) { try { String fileName = "/log4j.properties"; DataHandler dh = new DataHandler( new FileDataSource(FileSenderClient.class.getResource(fileName).getPath())); String url = "http://127.0.0.1:8080/axis1/services/FileReceiverServer"; Service serv = new Service(); Call call = (Call) serv.createCall(); call.setTargetEndpointAddress(url); call.setOperationName(new QName(url, "receive")); QName qn = new QName("DataHandler", "myNs:DataHandler"); call.registerTypeMapping( DataHandler.class, qn, JAFDataHandlerSerializerFactory.class, JAFDataHandlerDeserializerFactory.class); call.addParameter("s1", qn, ParameterMode.IN); call.addParameter("s2", XMLType.XSD_STRING, ParameterMode.IN); call.setReturnClass(String.class); String returnStr = (String) call.invoke(new Object[] {dh, "server.txt"}); System.out.println("Server response: " + returnStr); } catch (ServiceException e) { e.printStackTrace(); } catch (RemoteException e) { e.printStackTrace(); } }
/** * @see RepositoryWfsClient#deleteRepositoryItem(hu.sztaki.lpds.wfs.com.RepositoryWorkflowBean) */ @Override public String deleteRepositoryItem(RepositoryWorkflowBean bean) { String ret = new String(""); try { Service service; Call call; QName qn; service = new Service(); call = (Call) service.createCall(); call.setTargetEndpointAddress(serviceURL + serviceID); call.setOperationName("deleteRepositoryItem"); qn = new QName("urn:BeanService", "RepositoryWorkflowBean"); call.registerTypeMapping( RepositoryWorkflowBean.class, qn, new BeanSerializerFactory(RepositoryWorkflowBean.class, qn), new BeanDeserializerFactory(RepositoryWorkflowBean.class, qn)); call.addParameter("arg1", qn, ParameterMode.IN); call.setReturnType(Constants.XSD_STRING); ret = (String) call.invoke(new Object[] {bean}); if (ret == null) { ret = new String("Not valid response ! ret = (" + ret + ")"); } return ret; } catch (Exception fault) { System.out.println("HIBA" + fault.toString()); fault.printStackTrace(); } return ret; }
private void initCall() throws ReportException { try { // set up the call object Service service = new Service(); call = (Call) service.createCall(); call.setTargetEndpointAddress(new URL(webServiceEndPoint)); // Register type mappings // register the ItemData class QName itemData = new QName(BIP_NAMESPACE, "ItemData"); call.registerTypeMapping( ItemData.class, itemData, BeanSerializerFactory.class, BeanDeserializerFactory.class); // register the ParamNameValue class QName nmvals = new QName(BIP_NAMESPACE, "ParamNameValue"); call.registerTypeMapping( ParamNameValue.class, nmvals, BeanSerializerFactory.class, BeanDeserializerFactory.class); // register the ReportDefinition class QName reportDef = new QName(BIP_NAMESPACE, "ReportDefinition"); call.registerTypeMapping( ReportDefinition.class, reportDef, BeanSerializerFactory.class, BeanDeserializerFactory.class); // register the ReportRequest class QName reportReq = new QName(BIP_NAMESPACE, "ReportRequest"); call.registerTypeMapping( ReportRequest.class, reportReq, BeanSerializerFactory.class, BeanDeserializerFactory.class); // register the BIPReportResponse class QName reportRespqn = new QName(BIP_NAMESPACE, "ReportResponse"); call.registerTypeMapping( ReportResponse.class, reportRespqn, BeanSerializerFactory.class, BeanDeserializerFactory.class); // register the Schedule Request class QName scheduleReq = new QName(BIP_NAMESPACE, "ScheduleRequest"); call.registerTypeMapping( ScheduleRequest.class, scheduleReq, BeanSerializerFactory.class, BeanDeserializerFactory.class); // register the Delivery Request class QName deliveryReq = new QName(BIP_NAMESPACE, "DeliveryRequest"); call.registerTypeMapping( DeliveryRequest.class, deliveryReq, BeanSerializerFactory.class, BeanDeserializerFactory.class); // register the PrintDeliveryOption class QName printDeliveryOption = new QName(BIP_NAMESPACE, "PrintDeliveryOption"); call.registerTypeMapping( PrintDeliveryOption.class, printDeliveryOption, BeanSerializerFactory.class, BeanDeserializerFactory.class); // register the JobHistoryInfo class QName jobHistoryInfo = new QName(BIP_NAMESPACE, "JobHistoryInfo"); call.registerTypeMapping( JobHistoryInfo.class, jobHistoryInfo, BeanSerializerFactory.class, BeanDeserializerFactory.class); // register the JobInfo class QName jobInfo = new QName(BIP_NAMESPACE, "JobInfo"); call.registerTypeMapping( JobInfo.class, jobInfo, BeanSerializerFactory.class, BeanDeserializerFactory.class); // register the JobInfo class QName jobStatus = new QName(BIP_NAMESPACE, "JobStatus"); call.registerTypeMapping( JobStatus.class, jobStatus, BeanSerializerFactory.class, BeanDeserializerFactory.class); // TODO: Register new type mappings } catch (MalformedURLException e) { ReportException reportException = new ReportException(e); throw reportException; } catch (ServiceException e) { ReportException reportException = new ReportException(e); throw reportException; } }