CapitalBinding_Stub.java
/*
* Copyright © 2011 Nokia Corporation. All rights reserved.
* Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation.
* Oracle and Java are trademarks or registered trademarks of Oracle and/or its
* affiliates. Other product and company names mentioned herein may be trademarks
* or trade names of their respective owners.
* See LICENSE.TXT for license information.
*/
package com.nokia.example.capitals;
import java.util.Hashtable;
import java.util.Enumeration;
import javax.xml.rpc.Stub;
import javax.xml.rpc.JAXRPCException;
import javax.xml.namespace.QName;
import java.rmi.RemoteException;
import javax.microedition.xml.rpc.Operation;
import javax.microedition.xml.rpc.Type;
import javax.microedition.xml.rpc.ComplexType;
import javax.microedition.xml.rpc.Element;
public class CapitalBinding_Stub implements CapitalPortType, javax.xml.rpc.Stub
{
public CapitalBinding_Stub()
{
properties = new Hashtable();
properties.put(ENDPOINT_ADDRESS_PROPERTY,new String("http://194.137.80.38:80/CapitalService/Capitals").trim());
}
/**
* Sets the name and value of a configuration property for this Stub
* instance.
*/
public void _setProperty(String name, Object value)
{
properties.put(name,value);
}
/**
* Gets the value of a specific configuration property.
*/
public Object _getProperty(String value)
{
if (ENDPOINT_ADDRESS_PROPERTY.equals(value) ||
USERNAME_PROPERTY.equals(value) ||
PASSWORD_PROPERTY.equals(value))
{
return null;
}
if (SESSION_MAINTAIN_PROPERTY.equals(value))
{
return new Boolean(false);
}
if (properties.containsKey(value))
{
return properties.get(value);
}
throw new JAXRPCException("Unknown property: "+value);
}
protected void prepareOperation(Operation oper)
{
Enumeration names = properties.keys();
Object key, val = null;
if (names == null) return;
while(names.hasMoreElements())
{
key = names.nextElement();
val = properties.get(key);
if (key instanceof String && val != null)
{
oper.setProperty((String)key,val.toString());
}
}
}
// Implement methods from generated interface
public String getCapital(String aNation) throws java.rmi.RemoteException
{
Object inputObject = aNation;
Operation oper = Operation.newInstance(wsdl_name_getCapital,oper_Request,oper_Response);
prepareOperation(oper);
oper.setProperty(Operation.SOAPACTION_URI_PROPERTY, "");
Object outputObject = null;
try
{
outputObject = oper.invoke(inputObject);
}
catch(JAXRPCException ex)
{
// Get the linked cause
Throwable cause = ex.getLinkedCause();
if (cause instanceof RemoteException)
{
throw (RemoteException)cause;
}
throw ex;
}
return (String)outputObject;
}
/** Hashtable containing stubs properties */
private Hashtable properties;
protected static final QName qname_Request = new QName("urn:nokia:example:capitals:2005-01","request");
protected static final QName qname_Response = new QName("urn:nokia:example:capitals:2005-01","response");
protected static final QName wsdl_name_getCapital = new QName("urn:nokia:example:capitals:2005-01","getCapital");
protected static final Element oper_Request;
protected static final Element oper_Response;
static
{
oper_Request = new Element(qname_Request,Type.STRING);
oper_Response = new Element(qname_Response,Type.STRING);
}
}