aspose file tools*
The moose likes Web Services and the fly likes parameters of web services operation - Java.lang.object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "parameters of web services operation - Java.lang.object" Watch "parameters of web services operation - Java.lang.object" New topic
Author

parameters of web services operation - Java.lang.object

sushant likhar
Greenhorn

Joined: May 18, 2009
Posts: 1
Hi All ,
I new to java .
I am trying to consume web services in java agent( java class file) . Now I have created a stub files using axis and i have included them in my agent .

I want to pass XML file and a string values to this method.

midasActionAPI= stub.midasActionAPI(Parmeter 1 , parameter2 , Parameter3);
The parameter are of - java.lang.Object ( type)
How do i pass a xml file ? so that it is of the type java.lang.Object
How do i pass a string -as the type of object is java.lang.Object
-----------------------------------------------
java.lang.Object apiNames, java.lang.Object zone, java.lang.Object xml, java.lang.Object returnFormat

------------------------------------------
Here is the code .


import lotus.domino.*;
import java.net.URL;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.net.ssl.*;
import java.security.*;




import com.midasactionapisoaphandler.www.definitions.MidasActionAPISoapHandlerRemoteInterface.*;
import wsdl.*;

import java.io.*;


public class JavaAgent extends AgentBase {

public void NotesMain() {

try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();

//String MYURL = "https://10.4.90.128:9500/frwksoapapi/servlet/rpcrouter";
//URL myurl = new URL(MYURL);

//java.lang.Object APINAME = new java.lang.Object();

String action = "WRITE!MIDAS.CUST";

String inPath = "c:\\CUSD_INSERT_IT2.xml";

// Get the input file
Stream inStream = session.createStream();
if (inStream.open(inPath, "ASCII")) {
inStream.readText();

}

URL endpoint = new URL("https://10.4.90.128:9500/frwksoapapi/servlet/rpcrouter");

Service service1 = new Service();

MidasActionAPISoapHandlerBindingStub stub = new MidasActionAPISoapHandlerBindingStub(endpoint,service1);
stub._setProperty(lotus.domino.axis.client.Call.USERNAME_PROPERTY, "qsecofr");
stub._setProperty( lotus.domino.axis.client.Call.PASSWORD_PROPERTY, "yorktown");


String midasActionAPI= stub.midasActionAPI(action,action,action, action);
//pw.println(greeting);

// String greeting2=service.getGreeting("Lotus");
// pw.println(greeting2);


} catch(Exception e) {
e.printStackTrace();
}
}
}

/**
* MidasActionAPISoapHandlerBindingStub.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/

package com.midasactionapisoaphandler.www.definitions.MidasActionAPISoapHandlerRemoteInterface;

public class MidasActionAPISoapHandlerBindingStub extends org.apache.axis.client.Stub implements com.midasactionapisoaphandler.www.definitions.MidasActionAPISoapHandlerRemoteInterface.MidasActionAPISoapHandlerJavaPortType {
private java.util.Vector cachedSerClasses = new java.util.Vector();
private java.util.Vector cachedSerQNames = new java.util.Vector();
private java.util.Vector cachedSerFactories = new java.util.Vector();
private java.util.Vector cachedDeserFactories = new java.util.Vector();

static org.apache.axis.description.OperationDesc [] _operations;

static {
_operations = new org.apache.axis.description.OperationDesc[1];
org.apache.axis.description.OperationDesc oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("midasActionAPI");
oper.addParameter(new javax.xml.namespace.QName("", "apiNames"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "anyType"), java.lang.Object.class, org.apache.axis.description.ParameterDesc.IN, false, false);
oper.addParameter(new javax.xml.namespace.QName("", "zone"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "anyType"), java.lang.Object.class, org.apache.axis.description.ParameterDesc.IN, false, false);
oper.addParameter(new javax.xml.namespace.QName("", "xml"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "anyType"), java.lang.Object.class, org.apache.axis.description.ParameterDesc.IN, false, false);
oper.addParameter(new javax.xml.namespace.QName("", "returnFormat"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "anyType"), java.lang.Object.class, org.apache.axis.description.ParameterDesc.IN, false, false);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("", "result"));
oper.setStyle(org.apache.axis.enum.Style.RPC);
oper.setUse(org.apache.axis.enum.Use.ENCODED);
_operations[0] = oper;

}

public MidasActionAPISoapHandlerBindingStub() throws org.apache.axis.AxisFault {
this(null);
}

public MidasActionAPISoapHandlerBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
this(service);
super.cachedEndpoint = endpointURL;
}

public MidasActionAPISoapHandlerBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
if (service == null) {
super.service = new org.apache.axis.client.Service();
} else {
super.service = service;
}
}

private org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
try {
org.apache.axis.client.Call _call =
(org.apache.axis.client.Call) super.service.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));
}
return _call;
}
catch (java.lang.Throwable t) {
throw new org.apache.axis.AxisFault("Failure trying to get the Call object", t);
}
}

public java.lang.String midasActionAPI(java.lang.Object apiNames, java.lang.Object zone, java.lang.Object xml, java.lang.Object returnFormat) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[0]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://tempuri.org/com.misys.midas.soapapi.MidasActionAPISoapHandler", "midasActionAPI"));

setRequestHeaders(_call);
setAttachments(_call);
java.lang.Object _resp = _call.invoke(new java.lang.Object[] {apiNames, zone, xml, returnFormat});

if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
}

}
/**
* MidasActionAPISoapHandlerJavaPortType.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/

package com.midasactionapisoaphandler.www.definitions.MidasActionAPISoapHandlerRemoteInterface;

public interface MidasActionAPISoapHandlerJavaPortType extends java.rmi.Remote {
public java.lang.String midasActionAPI(java.lang.Object apiNames, java.lang.Object zone, java.lang.Object xml, java.lang.Object returnFormat) throws java.rmi.RemoteException;
}
**
* MidasActionAPISoapHandlerService.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/

package wsdl.MidasActionAPISoapHandler_service;

public interface MidasActionAPISoapHandlerService extends javax.xml.rpc.Service {
public java.lang.String getMidasActionAPISoapHandlerPortAddress();

public com.midasactionapisoaphandler.www.definitions.MidasActionAPISoapHandlerRemoteInterface.MidasActionAPISoapHandlerJavaPortType getMidasActionAPISoapHandlerPort() throws javax.xml.rpc.ServiceException;

public com.midasactionapisoaphandler.www.definitions.MidasActionAPISoapHandlerRemoteInterface.MidasActionAPISoapHandlerJavaPortType getMidasActionAPISoapHandlerPort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
}
/**
* MidasActionAPISoapHandlerServiceLocator.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/

package wsdl.MidasActionAPISoapHandler_service;

public class MidasActionAPISoapHandlerServiceLocator extends org.apache.axis.client.Service implements wsdl.MidasActionAPISoapHandler_service.MidasActionAPISoapHandlerService {

// Use to get a proxy class for MidasActionAPISoapHandlerPort
private final java.lang.String MidasActionAPISoapHandlerPort_address = "https://10.4.90.128:9500/frwksoapapi/servlet/rpcrouter";

public java.lang.String getMidasActionAPISoapHandlerPortAddress() {
return MidasActionAPISoapHandlerPort_address;
}

// The WSDD service name defaults to the port name.
private java.lang.String MidasActionAPISoapHandlerPortWSDDServiceName = "MidasActionAPISoapHandlerPort";

public java.lang.String getMidasActionAPISoapHandlerPortWSDDServiceName() {
return MidasActionAPISoapHandlerPortWSDDServiceName;
}

public void setMidasActionAPISoapHandlerPortWSDDServiceName(java.lang.String name) {
MidasActionAPISoapHandlerPortWSDDServiceName = name;
}

public com.midasactionapisoaphandler.www.definitions.MidasActionAPISoapHandlerRemoteInterface.MidasActionAPISoapHandlerJavaPortType getMidasActionAPISoapHandlerPort() throws javax.xml.rpc.ServiceException {
java.net.URL endpoint;
try {
endpoint = new java.net.URL(MidasActionAPISoapHandlerPort_address);
}
catch (java.net.MalformedURLException e) {
throw new javax.xml.rpc.ServiceException(e);
}
return getMidasActionAPISoapHandlerPort(endpoint);
}

public com.midasactionapisoaphandler.www.definitions.MidasActionAPISoapHandlerRemoteInterface.MidasActionAPISoapHandlerJavaPortType getMidasActionAPISoapHandlerPort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
try {
com.midasactionapisoaphandler.www.definitions.MidasActionAPISoapHandlerRemoteInterface.MidasActionAPISoapHandlerBindingStub _stub = new com.midasactionapisoaphandler.www.definitions.MidasActionAPISoapHandlerRemoteInterface.MidasActionAPISoapHandlerBindingStub(portAddress, this);
_stub.setPortName(getMidasActionAPISoapHandlerPortWSDDServiceName());
return _stub;
}
catch (org.apache.axis.AxisFault e) {
return null;
}
}

/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
try {
if (com.midasactionapisoaphandler.www.definitions.MidasActionAPISoapHandlerRemoteInterface.MidasActionAPISoapHandlerJavaPortType.class.isAssignableFrom(serviceEndpointInterface)) {
com.midasactionapisoaphandler.www.definitions.MidasActionAPISoapHandlerRemoteInterface.MidasActionAPISoapHandlerBindingStub _stub = new com.midasactionapisoaphandler.www.definitions.MidasActionAPISoapHandlerRemoteInterface.MidasActionAPISoapHandlerBindingStub(new java.net.URL(MidasActionAPISoapHandlerPort_address), this);
_stub.setPortName(getMidasActionAPISoapHandlerPortWSDDServiceName());
return _stub;
}
}
catch (java.lang.Throwable t) {
throw new javax.xml.rpc.ServiceException(t);
}
throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
}

/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
if (portName == null) {
return getPort(serviceEndpointInterface);
}
String inputPortName = portName.getLocalPart();
if ("MidasActionAPISoapHandlerPort".equals(inputPortName)) {
return getMidasActionAPISoapHandlerPort();
}
else {
java.rmi.Remote _stub = getPort(serviceEndpointInterface);
((org.apache.axis.client.Stub) _stub).setPortName(portName);
return _stub;
}
}

public javax.xml.namespace.QName getServiceName() {
return new javax.xml.namespace.QName("MidasActionAPISoapHandler-service.wsdl", "MidasActionAPISoapHandlerService");
}

private java.util.HashSet ports = null;

public java.util.Iterator getPorts() {
if (ports == null) {
ports = new java.util.HashSet();
ports.add(new javax.xml.namespace.QName("MidasActionAPISoapHandlerPort"));
}
return ports.iterator();
}

}


 
It is sorta covered in the JavaRanch Style Guide.
 
subject: parameters of web services operation - Java.lang.object