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 de...@apache.org on 2005/08/11 14:38:04 UTC
svn commit: r231434 - in /webservices/axis/trunk/java/modules:
core/src/org/apache/axis2/ core/src/org/apache/axis2/clientapi/
core/src/org/apache/axis2/engine/ core/src/org/apache/axis2/transport/http/
samples/src/sample/axisversion/ xml/src/org/apach...
Author: deepal
Date: Thu Aug 11 05:36:57 2005
New Revision: 231434
URL: http://svn.apache.org/viewcvs?rev=231434&view=rev
Log:
Fixed AXIS2-136 , fixed the bug but not in the correct way
the correct way should be when an error get at the client side it is required to call engine.recieveFault() rather than throwing exception. I will fix that latter in next release
Modified:
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/Constants.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPOutputStream.java
webservices/axis/trunk/java/modules/samples/src/sample/axisversion/Version.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11FaultImpl.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap12/SOAP12FaultImpl.java
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/Constants.java?rev=231434&r1=231433&r2=231434&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/Constants.java Thu Aug 11 05:36:57 2005
@@ -189,7 +189,7 @@
public static final String TESTING_PATH = "target/test-resources/";
- //public static final String TESTING_PATH = "modules/integration/target/test-resources/";
+// public static final String TESTING_PATH = "modules/integration/target/test-resources/";
public static final String TESTING_REPOSITORY = TESTING_PATH + "samples";
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java?rev=231434&r1=231433&r2=231434&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java Thu Aug 11 05:36:57 2005
@@ -183,6 +183,8 @@
if (isExceptionToBeThrownOnSOAPFault) {
//does the SOAPFault has a detail element for Excpetion
if (ex != null) {
+// AxisEngine engine = new AxisEngine(sysContext);
+// engine.receiveFault(response);
throw new AxisFault(ex);
} else {
//if detail element not present let us throw the exception with Reason
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java?rev=231434&r1=231433&r2=231434&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java Thu Aug 11 05:36:57 2005
@@ -101,6 +101,7 @@
* @see Handler
*/
public void receive(MessageContext msgContext) throws AxisFault {
+
ConfigurationContext sysCtx = msgContext.getSystemContext();
OperationDescription operationDescription = null;
ArrayList preCalculatedPhases =
@@ -250,6 +251,9 @@
faultContext.setProcessingFault(true);
faultContext.setServerSide(true);
SOAPEnvelope envelope = null;
+
+ faultContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
+ processingContext.getProperty(HTTPConstants.HTTPOutTransportInfo));
if (processingContext.isSOAP11()) {
envelope =
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java?rev=231434&r1=231433&r2=231434&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java Thu Aug 11 05:36:57 2005
@@ -154,6 +154,7 @@
protected void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
MessageContext msgContext = null;
+ OutputStream out = null;
try {
Object sessionContext =
req.getSession().getAttribute(Constants.SESSION_CONTEXT_PROPERTY);
@@ -171,10 +172,10 @@
new ServletBasedOutTransportInfo(res));
msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, getTransportHeaders(req));
-
+ out = res.getOutputStream();
HTTPTransportUtils.processHTTPPostRequest(msgContext,
req.getInputStream(),
- res.getOutputStream(),
+ out,
req.getContentType(),
req.getHeader(HTTPConstants.HEADER_SOAP_ACTION),
req.getRequestURL().toString(),
@@ -194,8 +195,9 @@
}
} catch (AxisFault e) {
if (msgContext != null) {
+ res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
msgContext.setProperty(MessageContext.TRANSPORT_OUT,
- res.getOutputStream());
+ out);
AxisEngine engine = new AxisEngine(configContext);
MessageContext faultContext =
engine.createFaultMessageContext(msgContext, e);
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=231434&r1=231433&r2=231434&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Thu Aug 11 05:36:57 2005
@@ -1,23 +1,25 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
package org.apache.axis2.transport.http;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
+import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.soap.SOAP12Constants;
import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.context.ConfigurationContext;
@@ -47,8 +49,8 @@
import java.net.URL;
public class CommonsHTTPTransportSender
- extends AbstractHandler
- implements TransportSender {
+ extends AbstractHandler
+ implements TransportSender {
private boolean chuncked = false;
private String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
@@ -67,17 +69,17 @@
public void invoke(MessageContext msgContext) throws AxisFault {
try {
String charSetEnc =
- (String) msgContext.getProperty(
- MessageContext.CHARACTER_SET_ENCODING);
+ (String) msgContext.getProperty(
+ MessageContext.CHARACTER_SET_ENCODING);
if (charSetEnc != null) {
omOutput.setCharSetEncoding(charSetEnc);
} else {
- OperationContext opctx = msgContext.getOperationContext();
- if(opctx != null) {
- charSetEnc = (String)opctx.getProperty(MessageContext.CHARACTER_SET_ENCODING);
- } else {
- charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
- }
+ OperationContext opctx = msgContext.getOperationContext();
+ if(opctx != null) {
+ charSetEnc = (String)opctx.getProperty(MessageContext.CHARACTER_SET_ENCODING);
+ } else {
+ charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
+ }
}
msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
omOutput.setSoap11(msgContext.isSOAP11());
@@ -88,10 +90,10 @@
// server.xml/client.xml file
EndpointReference epr = null;
if (msgContext.getTo() != null
- && !AddressingConstants.Submission.WSA_ANONYMOUS_URL.equals(
- msgContext.getTo().getAddress())
- && !AddressingConstants.Final.WSA_ANONYMOUS_URL.equals(
- msgContext.getTo().getAddress())) {
+ && !AddressingConstants.Submission.WSA_ANONYMOUS_URL.equals(
+ msgContext.getTo().getAddress())
+ && !AddressingConstants.Final.WSA_ANONYMOUS_URL.equals(
+ msgContext.getTo().getAddress())) {
epr = msgContext.getTo();
}
@@ -107,12 +109,12 @@
writeMessageWithCommons(msgContext, epr, dataOut);
} else {
OutputStream out =
- (OutputStream) msgContext.getProperty(
- MessageContext.TRANSPORT_OUT);
+ (OutputStream) msgContext.getProperty(
+ MessageContext.TRANSPORT_OUT);
if (msgContext.isServerSide()) {
HTTPOutTransportInfo transportInfo =
- (HTTPOutTransportInfo) msgContext.getProperty(
- HTTPConstants.HTTPOutTransportInfo);
+ (HTTPOutTransportInfo) msgContext.getProperty(
+ HTTPConstants.HTTPOutTransportInfo);
if (transportInfo != null) {
omOutput.setSoap11(msgContext.isSOAP11());
transportInfo.setContentType(omOutput.getContentType());
@@ -126,8 +128,8 @@
}
if(msgContext.getOperationContext() != null){
msgContext.getOperationContext().setProperty(
- Constants.RESPONSE_WRITTEN,
- Constants.VALUE_TRUE);
+ Constants.RESPONSE_WRITTEN,
+ Constants.VALUE_TRUE);
}
} catch (XMLStreamException e) {
throw new AxisFault(e);
@@ -139,16 +141,16 @@
}
public void writeMessageWithToOutPutStream(
- MessageContext msgContext,
- OutputStream out) {
+ MessageContext msgContext,
+ OutputStream out) {
}
public void writeMessageWithCommons(
- MessageContext msgContext,
- EndpointReference toURL,
- OMElement dataout)
- throws AxisFault {
+ MessageContext msgContext,
+ EndpointReference toURL,
+ OMElement dataout)
+ throws AxisFault {
try {
URL url = new URL(toURL.getAddress());
@@ -163,18 +165,18 @@
if (!msgContext.isDoingREST()) {
this.transportConfigurationPOST(
- msgContext,
- dataout,
- url,
- soapActionString);
- }
- if (msgContext.isDoingREST()) {
- if (msgContext.isRestThroughPOST()) {
- this.transportConfigurationPOST(
msgContext,
dataout,
url,
soapActionString);
+ }
+ if (msgContext.isDoingREST()) {
+ if (msgContext.isRestThroughPOST()) {
+ this.transportConfigurationPOST(
+ msgContext,
+ dataout,
+ url,
+ soapActionString);
} else {
this.transportConfigurationGET(msgContext, url);
}
@@ -189,13 +191,13 @@
}
protected HostConfiguration getHostConfiguration(
- MessageContext context,
- URL targetURL) {
+ MessageContext context,
+ URL targetURL) {
//TODO cheaking wheather the host is a proxy
HostConfiguration config = new HostConfiguration();
config.setHost(
- targetURL.getHost(),
- targetURL.getPort() == -1 ? 80 : targetURL.getPort());
+ targetURL.getHost(),
+ targetURL.getPort() == -1 ? 80 : targetURL.getPort());
return config;
}
@@ -213,10 +215,10 @@
private boolean doingMTOM = false;
public AxisRequestEntity(
- OMElement element,
- boolean chuncked,
- boolean doingMTOM,
- String charSetEncoding) {
+ OMElement element,
+ boolean chuncked,
+ boolean doingMTOM,
+ String charSetEncoding) {
this.element = element;
this.chuncked = chuncked;
this.doingMTOM = doingMTOM;
@@ -231,9 +233,9 @@
try {
ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
XMLStreamWriter outputWriter =
- XMLOutputFactory.newInstance().createXMLStreamWriter(
- bytesOut,
- charSetEnc);
+ XMLOutputFactory.newInstance().createXMLStreamWriter(
+ bytesOut,
+ charSetEnc);
element.serialize(outputWriter);
outputWriter.flush();
return bytesOut.toByteArray();
@@ -250,7 +252,7 @@
omOutput.setOutputStream(out, doingMTOM);
element.serialize(omOutput);
omOutput.flush();
-
+
} else {
if (bytes == null) {
bytes = writeBytes();
@@ -288,13 +290,13 @@
}
/*
- * (non-Javadoc)
- *
- * @see org.apache.axis2.transport.TransportSender#cleanUp(org.apache.axis2.context.MessageContext)
- */
+ * (non-Javadoc)
+ *
+ * @see org.apache.axis2.transport.TransportSender#cleanUp(org.apache.axis2.context.MessageContext)
+ */
public void cleanUp(MessageContext msgContext) throws AxisFault {
HttpMethod httpMethod =
- (HttpMethod) msgContext.getProperty(HTTP_METHOD);
+ (HttpMethod) msgContext.getProperty(HTTP_METHOD);
if (httpMethod != null) {
httpMethod.releaseConnection();
}
@@ -302,31 +304,31 @@
}
public void init(
- ConfigurationContext confContext,
- TransportOutDescription transportOut)
- throws AxisFault {
+ ConfigurationContext confContext,
+ TransportOutDescription transportOut)
+ throws AxisFault {
//<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.0</parameter> or
//<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.1</parameter> is
// checked
Parameter version =
- transportOut.getParameter(HTTPConstants.PROTOCOL_VERSION);
+ transportOut.getParameter(HTTPConstants.PROTOCOL_VERSION);
if (version != null) {
if (HTTPConstants.HEADER_PROTOCOL_11.equals(version.getValue())) {
this.httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
Parameter transferEncoding =
- transportOut.getParameter(
- HTTPConstants.HEADER_TRANSFER_ENCODING);
+ transportOut.getParameter(
+ HTTPConstants.HEADER_TRANSFER_ENCODING);
if (transferEncoding != null
- && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(
- transferEncoding.getValue())) {
+ && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(
+ transferEncoding.getValue())) {
this.chuncked = true;
}
} else if (
- HTTPConstants.HEADER_PROTOCOL_10.equals(version.getValue())) {
+ HTTPConstants.HEADER_PROTOCOL_10.equals(version.getValue())) {
this.httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
} else {
throw new AxisFault(
- "Parameter "
+ "Parameter "
+ HTTPConstants.PROTOCOL_VERSION
+ " Can have values only HTTP/1.0 or HTTP/1.1");
}
@@ -335,11 +337,11 @@
}
private void transportConfigurationPOST(
- MessageContext msgContext,
- OMElement dataout,
- URL url,
- String soapActionString)
- throws MalformedURLException, AxisFault, IOException {
+ MessageContext msgContext,
+ OMElement dataout,
+ URL url,
+ String soapActionString)
+ throws MalformedURLException, AxisFault, IOException {
//execuite the HtttpMethodBase - a connection manager can be given for handle multiple
httpClient = new HttpClient();
@@ -348,34 +350,34 @@
PostMethod postMethod = new PostMethod();
postMethod.setPath(url.getFile());
-
+
msgContext.setProperty(HTTP_METHOD, postMethod);
String charEncoding =
- (String) msgContext.getProperty(
- MessageContext.CHARACTER_SET_ENCODING);
+ (String) msgContext.getProperty(
+ MessageContext.CHARACTER_SET_ENCODING);
if(charEncoding == null){
charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
- }
+ }
postMethod.setRequestEntity(
- new AxisRequestEntity(
- dataout,
- chuncked,
- msgContext.isDoingMTOM(),
- charEncoding));
+ new AxisRequestEntity(
+ dataout,
+ chuncked,
+ msgContext.isDoingMTOM(),
+ charEncoding));
if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)
- && chuncked) {
+ && chuncked) {
postMethod.setContentChunked(true);
}
postMethod.setRequestHeader(
- HTTPConstants.HEADER_USER_AGENT,
- "Axis/2.0");
+ HTTPConstants.HEADER_USER_AGENT,
+ "Axis/2.0");
if (!msgContext.isDoingREST()) {
postMethod.setRequestHeader(
- HTTPConstants.HEADER_SOAP_ACTION,
- soapActionString);
+ HTTPConstants.HEADER_SOAP_ACTION,
+ soapActionString);
}
postMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url.getHost());
if (httpVersion != null) {
@@ -383,86 +385,117 @@
//postMethod.setHttp11(false); todo method to findout the transport version...
//allowing keep-alive for 1.0
postMethod.setRequestHeader(
- HTTPConstants.HEADER_CONNECTION,
- HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
+ HTTPConstants.HEADER_CONNECTION,
+ HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
} else {
// allowing keep-alive for 1.1
postMethod.setRequestHeader(
- HTTPConstants.HEADER_CONNECTION,
- HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
+ HTTPConstants.HEADER_CONNECTION,
+ HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
postMethod.setRequestHeader(
- HTTPConstants.HEADER_EXPECT,
- HTTPConstants.HEADER_EXPECT_100_Continue);
+ HTTPConstants.HEADER_EXPECT,
+ HTTPConstants.HEADER_EXPECT_100_Continue);
}
}
this.httpClient.executeMethod(hostConfig, postMethod);
-
+
if (postMethod.getStatusCode() == HttpStatus.SC_OK) {
- obatainHTTPHeaderInformation(postMethod, msgContext);
- InputStream in = postMethod.getResponseBodyAsStream();
- if (in == null) {
- throw new AxisFault(
- Messages.getMessage("canNotBeNull", "InputStream"));
- }
- msgContext.getOperationContext().setProperty(
- MessageContext.TRANSPORT_IN,
- in);
+ processResponse(postMethod, msgContext);
} else if (postMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
return;
- } else {
+ } else if (postMethod.getStatusCode() == HttpStatus.SC_INTERNAL_SERVER_ERROR){
+
+ Header contenttypeHheader = postMethod.getResponseHeader(
+ HTTPConstants.HEADER_CONTENT_TYPE);
+
+ String value = contenttypeHheader.getValue();
+ if(value != null){
+ if(value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE)>=0||
+ value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >=0){
+ processResponse(postMethod, msgContext);
+ }
+ }
+ }else{
throw new AxisFault(
- Messages.getMessage(
- "transportError",
- String.valueOf(postMethod.getStatusCode()),
- postMethod.getResponseBodyAsString()));
+ Messages.getMessage(
+ "transportError",
+ String.valueOf(postMethod.getStatusCode()),
+ postMethod.getResponseBodyAsString()));
}
}
+
+ private void processResponse(HttpMethodBase httpMethod, MessageContext msgContext) throws IOException {
+ obatainHTTPHeaderInformation(httpMethod, msgContext);
+ InputStream in = httpMethod.getResponseBodyAsStream();
+ if (in == null) {
+ throw new AxisFault(
+ Messages.getMessage("canNotBeNull", "InputStream"));
+ }
+ msgContext.getOperationContext().setProperty(
+ MessageContext.TRANSPORT_IN,
+ in);
+ }
+
private void transportConfigurationGET(MessageContext msgContext, URL url)
- throws MalformedURLException, AxisFault, IOException {
+ throws MalformedURLException, AxisFault, IOException {
GetMethod getMethod = new GetMethod();
getMethod.setPath(url.getFile());
String charEncoding =
- (String) msgContext.getProperty(
- MessageContext.CHARACTER_SET_ENCODING);
+ (String) msgContext.getProperty(
+ MessageContext.CHARACTER_SET_ENCODING);
if (charEncoding == null) //Default encoding scheme
getMethod.setRequestHeader(
- HTTPConstants.HEADER_CONTENT_TYPE,
- "text/xml; charset="
+ HTTPConstants.HEADER_CONTENT_TYPE,
+ "text/xml; charset="
+ MessageContext.DEFAULT_CHAR_SET_ENCODING);
else
getMethod.setRequestHeader(
- HTTPConstants.HEADER_CONTENT_TYPE,
- "text/xml; charset=" + charEncoding);
+ HTTPConstants.HEADER_CONTENT_TYPE,
+ "text/xml; charset=" + charEncoding);
this.httpClient = new HttpClient();
HostConfiguration hostConfig =
- this.getHostConfiguration(msgContext, url);
+ this.getHostConfiguration(msgContext, url);
this.httpClient.executeMethod(hostConfig, getMethod);
-
+
if (getMethod.getStatusCode() == HttpStatus.SC_OK) {
-
- obatainHTTPHeaderInformation(getMethod, msgContext);
-
- InputStream in = getMethod.getResponseBodyAsStream();
- if (in == null) {
- throw new AxisFault(
- Messages.getMessage("canNotBeNull", "InputStream"));
- }
- msgContext.getOperationContext().setProperty(
- MessageContext.TRANSPORT_IN,
- in);
+ processResponse(getMethod, msgContext);
+
+// obatainHTTPHeaderInformation(getMethod, msgContext);
+//
+// InputStream in = getMethod.getResponseBodyAsStream();
+// if (in == null) {
+// throw new AxisFault(
+// Messages.getMessage("canNotBeNull", "InputStream"));
+// }
+// msgContext.getOperationContext().setProperty(
+// MessageContext.TRANSPORT_IN,
+// in);
} else if (getMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
return;
- } else {
+ }else if (getMethod.getStatusCode() == HttpStatus.SC_INTERNAL_SERVER_ERROR){
+
+ Header contenttypeHheader = getMethod.getResponseHeader(
+ HTTPConstants.HEADER_CONTENT_TYPE);
+
+ String value = contenttypeHheader.getValue();
+ if(value != null){
+ if(value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE)>=0||
+ value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >=0){
+ processResponse(getMethod, msgContext);
+ }
+
+ }
+ }else{
throw new AxisFault(
- Messages.getMessage(
- "transportError",
- String.valueOf(getMethod.getStatusCode()),
- getMethod.getResponseBodyAsString()));
+ Messages.getMessage(
+ "transportError",
+ String.valueOf(getMethod.getStatusCode()),
+ getMethod.getResponseBodyAsString()));
}
}
@@ -473,33 +506,33 @@
*/
private void obatainHTTPHeaderInformation(HttpMethodBase method,MessageContext msgContext) {
Header header =
- method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+ method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
if (header != null) {
HeaderElement[] headers = header.getElements();
for (int i = 0; i < headers.length; i++) {
NameValuePair charsetEnc = headers[i]
- .getParameterByName(HTTPConstants.CHAR_SET_ENCODING);
- if (headers[i]
- .getName()
- .equals(
- HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED)) {
+ .getParameterByName(HTTPConstants.CHAR_SET_ENCODING);
+ if (headers[i]
+ .getName()
+ .equals(
+ HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED)) {
OperationContext opContext =
- msgContext.getOperationContext();
+ msgContext.getOperationContext();
if (opContext != null) {
opContext.setProperty(
- HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,
- header.getValue());
- }
- } else if (charsetEnc != null) {
-
- msgContext
- .setProperty(
- MessageContext.CHARACTER_SET_ENCODING,
- charsetEnc);
- }
- }
+ HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,
+ header.getValue());
+ }
+ } else if (charsetEnc != null) {
+
+ msgContext
+ .setProperty(
+ MessageContext.CHARACTER_SET_ENCODING,
+ charsetEnc);
+ }
+ }
}
-
+
}
-
+
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java?rev=231434&r1=231433&r2=231434&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java Thu Aug 11 05:36:57 2005
@@ -140,6 +140,7 @@
if (msgContext != null) {
msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
MessageContext faultContext = engine.createFaultMessageContext(msgContext, e);
+ out.setFault(true);
engine.sendFault(faultContext);
} else {
log.error(e,e);
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPOutputStream.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPOutputStream.java?rev=231434&r1=231433&r2=231434&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPOutputStream.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPOutputStream.java Thu Aug 11 05:36:57 2005
@@ -1,23 +1,24 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Runtime state of the engine
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Runtime state of the engine
+*/
package org.apache.axis2.transport.http;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
import java.io.FilterOutputStream;
import java.io.IOException;
@@ -28,9 +29,10 @@
private boolean chuncked = false;
private String contentType = null;
private String httpVersion;
+ private boolean isFault = false;
public SimpleHTTPOutputStream(OutputStream out, boolean chuncked,String httpVersion)
- throws AxisFault {
+ throws AxisFault {
super(out);
this.chuncked = chuncked;
this.httpVersion = httpVersion;
@@ -69,13 +71,20 @@
public void writeHeader() throws IOException {
StringBuffer buf = new StringBuffer();
+ String httpStatus = "";
+ if(isFault){
+ httpStatus = new String(HTTPConstants.ISE);
+ } else {
+ httpStatus = new String(HTTPConstants.OK);
+ }
+
if (chuncked) {
buf.append(httpVersion).append(
- " ");
- buf.append(new String(HTTPConstants.OK)).append("\n");
+ " ");
+ buf.append(httpStatus).append("\n");
buf.append(HTTPConstants.HEADER_TRANSFER_ENCODING).append(": ");
buf.append(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED).append(
- "\n");
+ "\n");
if (contentType != null) {
buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ");
buf.append(contentType).append("\n");
@@ -83,7 +92,7 @@
buf.append("\n");
} else {
buf.append(new String(HTTPConstants.HTTP));
- buf.append(new String(HTTPConstants.OK)).append("\n");
+ buf.append(httpStatus).append("\n");
if (contentType != null) {
buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ");
buf.append(contentType).append("\n");
@@ -103,7 +112,7 @@
if (!written) {
StringBuffer buf = new StringBuffer();
buf.append(httpVersion).append(
- " ");
+ " ");
buf.append(new String(HTTPConstants.NOCONTENT));
out.write(buf.toString().getBytes());
written = true;
@@ -121,8 +130,8 @@
}
/* (non-Javadoc)
- * @see java.io.OutputStream#close()
- */
+ * @see java.io.OutputStream#close()
+ */
public void close() throws IOException {
if (!written) {
finalize();
@@ -137,4 +146,7 @@
contentType = string;
}
+ public void setFault(boolean fault) {
+ isFault = fault;
+ }
}
Modified: webservices/axis/trunk/java/modules/samples/src/sample/axisversion/Version.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/sample/axisversion/Version.java?rev=231434&r1=231433&r2=231434&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/sample/axisversion/Version.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/sample/axisversion/Version.java Thu Aug 11 05:36:57 2005
@@ -36,7 +36,7 @@
OMElement version = fac.createOMElement("Version", omNs);
version.addChild(
fac.createText(version,
- "Hello I am Axis2 versionning service , My version is Axis2 M2 !! "));
+ "Hello I am Axis2 versionning service , My version is Axis2 0.91 !! "));
return version;
}
}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java?rev=231434&r1=231433&r2=231434&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java Thu Aug 11 05:36:57 2005
@@ -199,10 +199,7 @@
faultReason.serializeWithCache(omOutput);
}
- SOAPFaultNode faultNode = getNode();
- if (faultNode != null) {
- faultNode.serializeWithCache(omOutput);
- }
+ serialiseFaultNode(omOutput);
SOAPFaultRole faultRole = getRole();
if (faultRole != null) {
@@ -216,5 +213,8 @@
OMSerializerUtil.serializeEndpart(omOutput);
}
+
+ protected abstract void serialiseFaultNode(org.apache.axis2.om.impl.OMOutputImpl omOutput) throws XMLStreamException;
+
}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11FaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11FaultImpl.java?rev=231434&r1=231433&r2=231434&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11FaultImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11FaultImpl.java Thu Aug 11 05:36:57 2005
@@ -123,4 +123,8 @@
super.setDetail(detail);
}
+ protected void serialiseFaultNode(org.apache.axis2.om.impl.OMOutputImpl omOutput) throws XMLStreamException {
+
+ }
+
}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap12/SOAP12FaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap12/SOAP12FaultImpl.java?rev=231434&r1=231433&r2=231434&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap12/SOAP12FaultImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap12/SOAP12FaultImpl.java Thu Aug 11 05:36:57 2005
@@ -6,6 +6,8 @@
import org.apache.axis2.soap.impl.llom.SOAPFaultImpl;
import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
+import javax.xml.stream.XMLStreamException;
+
/**
* Copyright 2001-2004 The Apache Software Foundation.
@@ -96,6 +98,13 @@
if (!(parent instanceof SOAP12BodyImpl)) {
throw new SOAPProcessingException(
"Expecting SOAP 1.2 implementation of SOAP Body as the parent. But received some other implementation");
+ }
+ }
+
+ protected void serialiseFaultNode(org.apache.axis2.om.impl.OMOutputImpl omOutput) throws XMLStreamException {
+ SOAPFaultNode faultNode = getNode();
+ if (faultNode != null) {
+ faultNode.serializeWithCache(omOutput);
}
}
}