You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by am...@apache.org on 2006/12/08 11:16:38 UTC
svn commit: r483904 - in /webservices/axis2/branches/java/WSDL_2_0/modules:
codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
kernel/src/org/apache/axis2/client/Stub.java
Author: amilas
Date: Fri Dec 8 02:16:37 2006
New Revision: 483904
URL: http://svn.apache.org/viewvc?view=rev&rev=483904
Log:
change the way http:location handles. Store the old address first and then set it
after operation excecuted.
Modified:
webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/client/Stub.java
Modified: webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?view=diff&rev=483904&r1=483903&r2=483904
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl Fri Dec 8 02:16:37 2006
@@ -262,6 +262,11 @@
<xsl:for-each select="fault/param[@type!='']">
,<xsl:value-of select="@name"/>
</xsl:for-each>{
+
+ <xsl:if test="string-length(normalize-space(@http_location)) > 0">
+ // keep the old address to add later
+ String oldAdress = null;
+ </xsl:if>
try{
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[<xsl:value-of select="position()-1"/>].getName());
_operationClient.getOptions().setAction("<xsl:value-of select="$soapAction"/>");
@@ -269,7 +274,7 @@
<!-- change the EPR if http location available -->
<xsl:if test="string-length(normalize-space(@http_location)) > 0">
- setAppendAddressToEPR(_operationClient,"<xsl:value-of select="@http_location"/>");
+ oldAdress = setAppendAddressToEPR(_operationClient,"<xsl:value-of select="@http_location"/>");
</xsl:if>
<!-- add the other parameter options to operational client -->
@@ -384,6 +389,11 @@
//execute the operation client
_operationClient.execute(true);
+ <xsl:if test="string-length(normalize-space(@http_location)) > 0">
+ // set the old address again
+ setServiceClientEPR(oldAdress);
+ </xsl:if>
+
<xsl:choose>
<xsl:when test="$outputtype=''">
return;
@@ -417,6 +427,10 @@
</xsl:otherwise>
</xsl:choose>
}catch(org.apache.axis2.AxisFault f){
+ <xsl:if test="string-length(normalize-space(@http_location)) > 0">
+ // set the old address again
+ setServiceClientEPR(oldAdress);
+ </xsl:if>
org.apache.axiom.om.OMElement faultElt = f.getDetail();
if (faultElt!=null){
if (faultExeptionNameMap.containsKey(faultElt.getQName())){
@@ -507,13 +521,18 @@
throws java.rmi.RemoteException{
+ <xsl:if test="string-length(normalize-space(@http_location)) > 0">
+ // keep the old address to add later
+ String oldAdress = null;
+ </xsl:if>
+
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[<xsl:value-of select="position()-1"/>].getName());
_operationClient.getOptions().setAction("<xsl:value-of select="$soapAction"/>");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
<!-- change the EPR if http location available -->
<xsl:if test="string-length(normalize-space(@http_location)) > 0">
- setAppendAddressToEPR(_operationClient,"<xsl:value-of select="@http_location"/>");
+ oldAdress = setAppendAddressToEPR(_operationClient,"<xsl:value-of select="@http_location"/>");
</xsl:if>
<!-- add the other parameter options to operational client -->
@@ -640,6 +659,10 @@
//execute the operation client
_operationClient.execute(false);
+ <xsl:if test="string-length(normalize-space(@http_location)) > 0">
+ // set the old address again
+ setServiceClientEPR(oldAdress);
+ </xsl:if>
}
</xsl:if>
@@ -687,6 +710,11 @@
</xsl:if>
{
+ <xsl:if test="string-length(normalize-space(@http_location)) > 0">
+ // keep the old address to add later
+ String oldAdress = null;
+ </xsl:if>
+
<xsl:if test="$mep='11'">try {</xsl:if>
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[<xsl:value-of select="position()-1"/>].getName());
_operationClient.getOptions().setAction("<xsl:value-of select="$soapAction"/>");
@@ -694,7 +722,7 @@
<!-- change the EPR if http location available -->
<xsl:if test="string-length(normalize-space(@http_location)) > 0">
- setAppendAddressToEPR(_operationClient,"<xsl:value-of select="@http_location"/>");
+ oldAdress = setAppendAddressToEPR(_operationClient,"<xsl:value-of select="@http_location"/>");
</xsl:if>
<!-- add the other parameter options to operational client -->
@@ -791,8 +819,17 @@
_operationClient.addMessageContext(_messageContext);
_operationClient.execute(true);
+
+ <xsl:if test="string-length(normalize-space(@http_location)) > 0">
+ // set the old address again
+ setServiceClientEPR(oldAdress);
+ </xsl:if>
<xsl:if test="$mep='11'">
}catch(org.apache.axis2.AxisFault f){
+ <xsl:if test="string-length(normalize-space(@http_location)) > 0">
+ // set the old address again
+ setServiceClientEPR(oldAdress);
+ </xsl:if>
org.apache.axiom.om.OMElement faultElt = f.getDetail();
if (faultElt!=null){
if (faultExeptionNameMap.containsKey(faultElt.getQName())){
Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/client/Stub.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/client/Stub.java?view=diff&rev=483904&r1=483903&r2=483904
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/client/Stub.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/client/Stub.java Fri Dec 8 02:16:37 2006
@@ -145,15 +145,16 @@
*
* @param _operationClient
* @param addressFromBinding
+ * return existing address
*/
- protected void setAppendAddressToEPR(OperationClient _operationClient,
+ protected String setAppendAddressToEPR(OperationClient _operationClient,
String addressFromBinding) {
EndpointReference toEPRFromServiceClient = _serviceClient.getOptions().getTo();
- EndpointReference endpointReference = toEPRFromServiceClient.cloneEPR();
- String address = endpointReference.getAddress();
+ String oldAddress = toEPRFromServiceClient.getAddress();
+ String address = toEPRFromServiceClient.getAddress();
// here we assume either addressFromBinding have a '?' infront or not
if (addressFromBinding.charAt(0) != '?') {
@@ -166,8 +167,19 @@
address += addressFromBinding;
}
- endpointReference.setAddress(address);
- _operationClient.getOptions().setTo(endpointReference);
+ toEPRFromServiceClient.setAddress(address);
+ _operationClient.getOptions().setTo(toEPRFromServiceClient);
+ return oldAddress;
+ }
+
+ /**
+ * sets the epr of the service client to given value
+ * @param address
+ */
+
+ protected void setServiceClientEPR(String address) {
+ EndpointReference toEPRFromServiceClient = _serviceClient.getOptions().getTo();
+ toEPRFromServiceClient.setAddress(address);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org