You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2005/12/02 04:23:13 UTC
svn commit: r351562 - in /webservices/axis2/trunk/java/modules:
codegen/src/org/apache/axis2/wsdl/template/java/
core/src/org/apache/axis2/client/ security/interop/org/apache/axis2/security/
Author: chinthaka
Date: Thu Dec 1 19:22:56 2005
New Revision: 351562
URL: http://svn.apache.org/viewcvs?rev=351562&view=rev
Log:
Fixing http://marc.theaimsgroup.com/?l=axis-dev&m=113346751312605&w=2
Modified:
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java
webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=351562&r1=351561&r2=351562&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl Thu Dec 1 19:22:56 2005
@@ -53,10 +53,11 @@
_configurationContext = new org.apache.axis2.context.ConfigurationContextFactory().buildClientConfigurationContext(axis2Home);
_configurationContext.getAxisConfiguration().addService(_service);
_serviceContext =_service.getParent().getServiceGroupContext(_configurationContext).getServiceContext(_service.getName().getLocalPart());
+ _clientOptions = new org.apache.axis2.client.Options();
<!-- Set the soap version depending on the binding. Default is 1.1 so don't set anything for that case-->
<xsl:if test="$soapVersion='1.2'">
//Set the soap version
- setSOAPVersion(SOAP_12);
+ _clientOptions.setSoapVersionURI(org.apache.axis2.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
</xsl:if>
@@ -82,7 +83,7 @@
</xsl:if>
</xsl:for-each>
-
+ _clientOptions = new org.apache.axis2.client.Options();
}
@@ -113,21 +114,18 @@
</xsl:for-each>) throws java.rmi.RemoteException{
org.apache.axis2.client.Call _call = new org.apache.axis2.client.Call(_serviceContext);
- org.apache.axis2.client.Options _options = new org.apache.axis2.client.Options();
- _call.setClientOptions(_options);
- _options.setTransportInfo(this.senderTransport,this.listenerTransport,this.useSeparateListener);
+ _call.setClientOptions(_clientOptions);
+ _clientOptions.setListenerTransportProtocol(this.listenerTransport);
+ _clientOptions.setUseSeparateListener(this.useSeparateListener);
org.apache.axis2.context.MessageContext _messageContext = getMessageContext();
- _options.setTo(this.toEPR);
- _options.setSoapAction("<xsl:value-of select="$soapAction"/>");
+ _clientOptions.setTo(this.toEPR);
+ _clientOptions.setSoapAction("<xsl:value-of select="$soapAction"/>");
- if(wsaAction != null) {
- _call.getClientOptions().setAction(wsaAction);
- } else {
- <xsl:for-each select="input/param[@Action!='']">_call.getClientOptions().setAction("<xsl:value-of select="@Action"/>");</xsl:for-each>
+ if(_clientOptions.getAction() == null) {
+ <xsl:for-each select="input/param[@Action!='']">_clientOptions.setAction("<xsl:value-of select="@Action"/>");</xsl:for-each>
}
//set the properties
- populateProperties(_call);
populateModules(_call);
org.apache.axis2.soap.SOAPEnvelope env = null;
@@ -213,17 +211,15 @@
<xsl:if test="$paramCount>0">,</xsl:if>final <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/> callback) throws java.rmi.RemoteException{
org.apache.axis2.client.Call _call = new org.apache.axis2.client.Call(_serviceContext);
- org.apache.axis2.client.Options _options = new org.apache.axis2.client.Options();
- _call.setClientOptions(_options);
- _options.setTransportInfo(this.senderTransport,this.listenerTransport,this.useSeparateListener);
+ _call.setClientOptions(_clientOptions);
+ _clientOptions.setListenerTransportProtocol(this.listenerTransport);
+ _clientOptions.setUseSeparateListener(this.useSeparateListener);
org.apache.axis2.context.MessageContext _messageContext = getMessageContext();
- _options.setTo(this.toEPR);
- _options.setSoapAction("<xsl:value-of select="$soapAction"/>");
+ _clientOptions.setTo(this.toEPR);
+ _clientOptions.setSoapAction("<xsl:value-of select="$soapAction"/>");
- if(wsaAction != null) {
- _call.getClientOptions().setAction(wsaAction);
- } else {
- <xsl:for-each select="input/param[@Action!='']">_call.getClientOptions().setAction("<xsl:value-of select="@Action"/>");</xsl:for-each>
+ if(_clientOptions.getAction() == null) {
+ <xsl:for-each select="input/param[@Action!='']">_lientOptions.setAction("<xsl:value-of select="@Action"/>");</xsl:for-each>
}
org.apache.axis2.soap.SOAPEnvelope env = createEnvelope();
<xsl:choose>
@@ -305,12 +301,11 @@
org.apache.axis2.client.MessageSender _msgSender = new org.apache.axis2.client.MessageSender(_serviceContext);
org.apache.axis2.context.MessageContext _messageContext = getMessageContext();
- _msgSender.setTo(this.toEPR);
- _msgSender.setSoapAction("<xsl:value-of select="$soapAction"/>");
- if(wsaAction != null) {
- _call.getClientOptions().setAction(wsaAction);
- } else {
- <xsl:for-each select="input/param[@Action!='']">_call.getClientOptions().setAction("<xsl:value-of select="@Action"/>");</xsl:for-each>
+ _msgSender.setClientOptions(_clientOptions);
+ _clientOptions.setTo(this.toEPR);
+ _clientOptions.setSoapAction("<xsl:value-of select="$soapAction"/>");
+ if(_clientOptions.getAction() == null) {
+ <xsl:for-each select="input/param[@Action!='']">_clientOptions.setAction("<xsl:value-of select="@Action"/>");</xsl:for-each>
}
org.apache.axis2.soap.SOAPEnvelope env = null;
env = createEnvelope();
@@ -356,7 +351,6 @@
</xsl:choose>
//set the properties
- populateProperties(_msgSender);
populateModules(_msgSender);
_messageContext.setEnvelope(env);
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java?rev=351562&r1=351561&r2=351562&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java Thu Dec 1 19:22:56 2005
@@ -102,7 +102,7 @@
String messageID = String.valueOf("uuid:" + UUIDGenerator.getUUID());
msgctx.setMessageID(messageID);
//
- if (clientOptions.isUseSeperateListener()) {
+ if (clientOptions.isUseSeparateListener()) {
//This mean doing a Request-Response invocation using two channel. If the
//transport is two way transport (e.g. http) Only one channel is used (e.g. in http cases
@@ -204,7 +204,7 @@
String messageID = String.valueOf("uuid:" + UUIDGenerator.getUUID());
msgctx.setMessageID(messageID);
////
- if (clientOptions.isUseSeperateListener()) {
+ if (clientOptions.isUseSeparateListener()) {
//the invocation happen via a separate Channel, so we should set up the
//information need to correlated the response message and invoke the call back
@@ -268,7 +268,7 @@
inferTransportOutDescription(msgCtx);
}
- if (clientOptions.isUseSeperateListener()) {
+ if (clientOptions.isUseSeparateListener()) {
//if separate transport is used, start the required listeners
if (!serviceContext
.getConfigurationContext()
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java?rev=351562&r1=351561&r2=351562&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java Thu Dec 1 19:22:56 2005
@@ -59,7 +59,7 @@
*/
protected TransportOutDescription senderTransport;
private TransportInDescription listenerTransport;
- private boolean useSeperateListener = false;
+ private boolean useSeparateListener = false;
private String listenerTransportProtocol;
private String senderTrasportProtocol;
@@ -215,8 +215,8 @@
this.listenerTransport = listenerTransport;
}
- public boolean isUseSeperateListener() {
- return useSeperateListener;
+ public boolean isUseSeparateListener() {
+ return useSeparateListener;
}
/**
@@ -225,10 +225,10 @@
* For e.g., if the transports are different this is true by default.
* HTTP transport supports both cases while SMTP transport supports only two channel case.
*
- * @param useSeperateListener
+ * @param useSeparateListener
*/
- public void setUseSeperateListener(boolean useSeperateListener) {
- this.useSeperateListener = useSeperateListener;
+ public void setUseSeparateListener(boolean useSeparateListener) {
+ this.useSeparateListener = useSeparateListener;
}
public String getAction() {
@@ -303,7 +303,7 @@
/**
* Sets transport information to the call. The senarios supported are as follows:
* <blockquote><pre>
- * [senderTransport, listenerTransport, useSeperateListener]
+ * [senderTransport, listenerTransport, useSeparateListener]
* http, http, true
* http, http, false
* http,smtp,true
@@ -335,7 +335,7 @@
throw new AxisFault(Messages.getMessage("useSeparateListenerLimited"));
}
} else {
- setUseSeperateListener(useSeperateListener);
+ setUseSeparateListener(useSeperateListener);
}
setListenerTransportProtocol(listenerTransport);
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java?rev=351562&r1=351561&r2=351562&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java Thu Dec 1 19:22:56 2005
@@ -27,6 +27,8 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.soap.SOAP12Constants;
import org.apache.axis2.soap.SOAPBody;
import org.apache.axis2.soap.SOAPEnvelope;
import org.apache.axis2.soap.SOAPFactory;
@@ -37,70 +39,26 @@
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
public abstract class Stub {
- public static final int SOAP_11 =0;
- public static final int SOAP_12 =1;
-
-
protected ConfigurationContext _configurationContext;
protected static AxisService _service;
protected ServiceContext _serviceContext;
protected EndpointReference toEPR;
- protected boolean doRest=false;
-
- protected String senderTransport = Constants.TRANSPORT_HTTP;
- protected String listenerTransport =Constants.TRANSPORT_HTTP ;
- protected boolean useSeparateListener;
-
//Default SOAP version is 11
- protected int soapVersion = SOAP_11;
- protected HashMap propertyMap = new HashMap();
protected ArrayList modules = new ArrayList();
- protected String wsaAction;
-
- /**
- *
- * @param senderTransport
- * @param listenerTransport
- * @param useSeparateListener
- * @throws AxisFault
- */
- public void setTransportInfo(String senderTransport,String listenerTransport,boolean useSeparateListener)throws AxisFault{
- this.senderTransport = senderTransport;
- this.listenerTransport=listenerTransport;
- this.useSeparateListener=useSeparateListener;
- }
-
- /**
- *
- * @param key
- * @param value
- */
- public void _put(String key,Object value){
- this.propertyMap.put(key,value);
- }
-
+ protected Options _clientOptions;
+ protected boolean useSeparateListener;
+ protected String listenerTransport =Constants.TRANSPORT_HTTP ;
- /**
- *
- * @param key
- * @return the object
- */
- public Object _get(String key){
- return this.propertyMap.get(key);
- }
-
public void engageModule(String moduleName) {
- this.modules.add(moduleName);
+ this.modules.add(moduleName);
}
-
+
/**
* If _maintainSession is set to true, all the calls can use the same
* ServiceContext. The user can share information through this
@@ -113,13 +71,13 @@
protected Stub() {
}
- /**
- * Sets the soap version.
- * @param soapVersion
- */
- public void setSOAPVersion(int soapVersion){
- this.soapVersion = soapVersion;
- }
+// /**
+// * Sets the soap version.
+// * @param soapVersion
+// */
+// public void setSOAPVersion(int soapVersion){
+// this.soapVersion = soapVersion;
+// }
public void _setSessionInfo(String key, Object value) throws java.lang.Exception {
@@ -166,7 +124,7 @@
protected SOAPEnvelope createEnvelope() throws SOAPProcessingException {
- return getFactory(this.soapVersion).getDefaultEnvelope();
+ return getFactory(this._clientOptions.getSoapVersionURI()).getDefaultEnvelope();
}
protected OMElement getElementFromReader(XMLStreamReader reader) {
@@ -176,16 +134,16 @@
}
protected void setValueDoc(SOAPEnvelope env, OMElement value) {
- setValueDoc(env,value,false);
+ setValueDoc(env, value, false);
}
- protected void setValueDoc(SOAPEnvelope env, OMElement value,boolean isHeader) {
+ protected void setValueDoc(SOAPEnvelope env, OMElement value, boolean isHeader) {
if (value != null) {
- if (isHeader){
+ if (isHeader) {
SOAPHeader header = env.getHeader();
header.addChild(value);
- }else{
+ } else {
SOAPBody body = env.getBody();
body.addChild(value);
}
@@ -196,6 +154,7 @@
/**
* A util method that extracts the correct element.
+ *
* @param env
* @param type
* @return the relevant element to be databound
@@ -222,44 +181,36 @@
}
- protected SOAPFactory getFactory(int soapVersion) {
- if (soapVersion==SOAP_11){
+ protected SOAPFactory getFactory(String soapNamespaceURI) {
+ String soapVersionURI = _clientOptions.getSoapVersionURI();
+ if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
return OMAbstractFactory.getSOAP11Factory();
- }else if (soapVersion==SOAP_12){
+ } else if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
return OMAbstractFactory.getSOAP12Factory();
- }else{
+ } else {
throw new RuntimeException("Unknown SOAP version");
}
}
- protected void populateProperties(MEPClient client){
- Iterator keys = this.propertyMap.keySet().iterator();
- String key;
- Options clientOptions = client.getClientOptions();
- while (keys.hasNext()) {
- key = keys.next().toString();
- clientOptions.setProperty(key,propertyMap.get(key));
+ protected void populateModules(Call call) throws AxisFault {
+ for (int i = 0; i < modules.size(); i++) {
+ call.engageModule(new QName((String) this.modules.get(i)));
}
}
- protected void populateModules(Call call) throws AxisFault {
- for(int i = 0; i < modules.size(); i++) {
- call.engageModule(new QName((String)this.modules.get(i)));
- }
- }
-
protected void populateModules(MessageSender sender) throws AxisFault {
- for(int i = 0; i < modules.size(); i++) {
- sender.engageModule(new QName((String)this.modules.get(i)));
- }
+ for (int i = 0; i < modules.size(); i++) {
+ sender.engageModule(new QName((String) this.modules.get(i)));
+ }
+ }
+
+ public Options _getClientOptions() {
+ return _clientOptions;
+ }
+
+ public void _setClientOptions(Options _clientOptions) {
+ this._clientOptions = _clientOptions;
}
- public String getWsaAction() {
- return wsaAction;
- }
-
- public void setWsaAction(String wsaAction) {
- this.wsaAction = wsaAction;
- }
}
Modified: webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java?rev=351562&r1=351561&r2=351562&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java (original)
+++ webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java Thu Dec 1 19:22:56 2005
@@ -18,7 +18,11 @@
import org.apache.axis2.Constants;
import org.apache.axis2.oasis.ping.PingPortStub;
-import org.apache.axis2.oasis.ping.databinding.org.xmlsoap.*;
+import org.apache.axis2.oasis.ping.databinding.org.xmlsoap.Ping;
+import org.apache.axis2.oasis.ping.databinding.org.xmlsoap.PingDocument;
+import org.apache.axis2.oasis.ping.databinding.org.xmlsoap.PingResponse;
+import org.apache.axis2.oasis.ping.databinding.org.xmlsoap.PingResponseDocument;
+import org.apache.axis2.oasis.ping.databinding.org.xmlsoap.TicketType;
import org.apache.axis2.security.handler.WSSHandlerConstants;
import org.apache.axis2.security.handler.config.InflowConfiguration;
import org.apache.axis2.security.handler.config.OutflowConfiguration;
@@ -46,7 +50,7 @@
//Enable MTOM to those scenarios where they are configured using:
//<optimizeParts>xpathExpression</optimizeParts>
- stub._put(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+ stub._getClientOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
PingResponseDocument pingResDoc = stub.Ping(pingDoc);
@@ -70,16 +74,16 @@
//Enable MTOM to those scenarios where they are configured using:
//<optimizeParts>xpathExpression</optimizeParts>
- stub._put(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+ stub._getClientOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
//Engage the security module
stub.engageModule("security");
if(outflowConfig !=null){
- stub._put(WSSHandlerConstants.OUTFLOW_SECURITY, outflowConfig.getProperty());
+ stub._getClientOptions().setProperty(WSSHandlerConstants.OUTFLOW_SECURITY, outflowConfig.getProperty());
}
if(inflowConfig != null) {
- stub._put(WSSHandlerConstants.INFLOW_SECURITY, inflowConfig.getProperty());
+ stub._getClientOptions().setProperty(WSSHandlerConstants.INFLOW_SECURITY, inflowConfig.getProperty());
}
PingResponseDocument pingResDoc = stub.Ping(pingDoc);