antelder 2003/01/20 05:53:55
Modified: java/src/org/apache/wsif/providers/soap/apacheaxis
WSIFOperation_ApacheAxis.java
java/src/org/apache/wsif WSIFConstants.java
Log:
Fix bugzilla bug 16199 - support setting response SOAP headers in the Context
message
This is part 1 of the fix. Part 2 is to do the same thing in the Apache SOAP
provider.
Revision Changes Path
1.65 +57 -3
xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java
Index: WSIFOperation_ApacheAxis.java
===================================================================
RCS file:
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- WSIFOperation_ApacheAxis.java 20 Jan 2003 13:13:40 -0000 1.64
+++ WSIFOperation_ApacheAxis.java 20 Jan 2003 13:53:55 -0000 1.65
@@ -1412,6 +1412,8 @@
} else {
workedOK = invokeAXISDocStyle(call, inMsg, outMsg, faultMsg);
}
+
+ setResponseContext(call);
Trc.exit(workedOK);
return workedOK;
@@ -1486,8 +1488,7 @@
new QName(getInputNamespace(), portTypeOperation.getName()));
setCallParameterNames(call);
- setDestinationContext(dest);
- setCallContext(call);
+
Object[] inputValues = getInputMessageValues(inMsg, dest);
Object response = null;
@@ -2424,7 +2425,7 @@
}
try {
- name = WSIFConstants.CONTEXT_SOAP_HEADERS;
+ name = WSIFConstants.CONTEXT_REQUEST_SOAP_HEADERS;
o = context.getObjectPart(name);
if (o instanceof List) {
addSOAPHeader(call, name, (List) o);
@@ -2434,6 +2435,29 @@
}
}
+ private void setResponseContext(Call call) throws WSIFException {
+ org.apache.axis.Message m = call.getResponseMessage();
+ if (m != null) {
+ javax.xml.soap.SOAPEnvelope env;
+ try {
+ env = m.getSOAPEnvelope();
+ } catch (AxisFault e) {
+ throw new WSIFException(
+ "AxisFault getting response SOAP envelope", e);
+ }
+ if (env != null) {
+ javax.xml.soap.SOAPHeader soapHeader;
+ try {
+ soapHeader = env.getHeader();
+ } catch (SOAPException e) {
+ throw new WSIFException(
+ "SOAPException getting response headers from SOAP
envelope", e);
+ }
+ addContextResponseSOAPHeaders(soapHeader);
+ }
+ }
+ }
+
/**
* Sets any SOAP headers from the context message.
*/
@@ -2445,6 +2469,36 @@
}
}
}
+
+ private void addContextResponseSOAPHeaders(
+ javax.xml.soap.SOAPHeader soapHeader) throws WSIFException {
+
+ if( soapHeader != null ) {
+ ArrayList headers = new ArrayList();
+ for(Iterator i = soapHeader.getChildElements(); i.hasNext(); ) {
+ Object o = i.next();
+ if (o instanceof SOAPHeaderElement) {
+ SOAPHeaderElement she = (SOAPHeaderElement) o;
+ try {
+ headers.add(she.getAsDOM());
+ } catch (Exception e) {
+ throw new WSIFException(
+ "exception getting response SOAP header",
+ e);
+ }
+ } else {
+ Trc.event("unexpected response SOAP header type: ", o);
+ }
+ }
+ if (headers.size() > 0) {
+ WSIFMessage context = getContext();
+ context.setObjectPart(
+ WSIFConstants.CONTEXT_RESPONSE_SOAP_HEADERS,
+ headers);
+ setContext(context);
+ }
+ }
+ }
/**
* Sets the HTTP header value in the message context.
1.16 +14 -1 xml-axis-wsif/java/src/org/apache/wsif/WSIFConstants.java
Index: WSIFConstants.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/WSIFConstants.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- WSIFConstants.java 14 Jan 2003 14:59:57 -0000 1.15
+++ WSIFConstants.java 20 Jan 2003 13:53:55 -0000 1.16
@@ -125,10 +125,23 @@
"org.apache.wsif.http.Password";
/**
- * WSIF context part name for SOAP headers
+ * WSIF context part name for SOAP headers
+ * @deprecated use CONTEXT_REQUEST_SOAP_HEADERS
*/
public static final String CONTEXT_SOAP_HEADERS =
"org.apache.wsif.soap.RequestHeaders";
+
+ /**
+ * WSIF context part name for SOAP headers
+ */
+ public static final String CONTEXT_REQUEST_SOAP_HEADERS =
+ "org.apache.wsif.soap.RequestHeaders";
+
+ /**
+ * WSIF context part name for SOAP headers
+ */
+ public static final String CONTEXT_RESPONSE_SOAP_HEADERS =
+ "org.apache.wsif.soap.ResponseHeaders";
/**
* WSIF context part name prefix for JMSProperties