antelder 2002/12/02 05:26:38
Modified: java/src/org/apache/wsif/providers/soap/apacheaxis
WSIFOperation_ApacheAxis.java
Log:
Phase 2 of tidying up the AXIS provider
Revision Changes Path
1.38 +539 -88
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.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- WSIFOperation_ApacheAxis.java 28 Nov 2002 14:26:57 -0000 1.37
+++ WSIFOperation_ApacheAxis.java 2 Dec 2002 13:26:38 -0000 1.38
@@ -73,13 +73,25 @@
import javax.mail.MessagingException;
import javax.mail.internet.MimeMultipart;
import javax.swing.ImageIcon;
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
import javax.wsdl.Definition;
import javax.wsdl.Input;
import javax.wsdl.Operation;
import javax.wsdl.Output;
import javax.wsdl.Part;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMimeXml;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPOperation;
import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
import javax.xml.soap.AttachmentPart;
import javax.xml.soap.SOAPException;
import javax.xml.transform.Source;
@@ -94,8 +106,12 @@
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.client.Transport;
+import org.apache.axis.encoding.DeserializerFactory;
+import org.apache.axis.encoding.SerializerFactory;
import org.apache.axis.encoding.TypeMapping;
import org.apache.axis.encoding.TypeMappingRegistry;
+import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
+import org.apache.axis.encoding.ser.ArraySerializerFactory;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;
import org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory;
@@ -118,8 +134,12 @@
import org.apache.wsif.providers.WSIFDynamicTypeMapping;
import org.apache.wsif.util.WSIFUtils;
import org.apache.wsif.util.jms.WSIFJMSDestination;
+import org.apache.wsif.wsdl.extensions.jms.JMSProperty;
+import org.apache.wsif.wsdl.extensions.jms.JMSPropertyValue;
import org.w3c.dom.Element;
+import com.ibm.wsdl.extensions.mime.MIMEConstants;
+
/**
* @author Mark Whitlock <[EMAIL PROTECTED]>
* @author Ant Elder <[EMAIL PROTECTED]>
@@ -128,14 +148,14 @@
private static final long serialVersionUID = 1L;
- transient protected WSIFPort_ApacheAxis portInstance;
- transient protected Operation operation;
- transient protected Definition definition;
+ transient protected WSIFPort_ApacheAxis wsifPort;
+ transient protected Operation portTypeOperation;
+ transient protected SOAPOperation soapOperation;
transient protected List soapPartNames;
transient protected List mimePartNames;
transient protected String inputEncodingStyle;
transient protected String inputNamespace;
- transient protected String actionUri;
+ transient protected String soapActionURI;
transient protected HashMap outParams;
// for async operation
@@ -144,10 +164,10 @@
// everything other than what is needed to process async response should be
transient
protected WSIFResponseHandler responseHandler;
- protected String returnName = null;
+ protected String returnName;
protected String outputEncodingStyle;
protected WSIFDynamicTypeMap typeMap;
- protected String style;
+ protected String operationStyle;
transient protected String[] inputPartNames;
transient protected QName[] inputPartQNs;
@@ -159,24 +179,404 @@
protected Class[] outputPartTypes;
protected QName[] outputPartTypeQNs;
protected int returnPartIndex;
-
+
public WSIFOperation_ApacheAxis(
- WSIFPort_ApacheAxis wsifport_apacheaxis,
- Operation operation1,
+ WSIFPort_ApacheAxis wsifPort,
+ Operation portTypeOperation,
WSIFDynamicTypeMap wsifdynamictypemap)
throws WSIFException {
- Trc.entry(this, wsifport_apacheaxis, operation1, wsifdynamictypemap);
+ Trc.entry(this, wsifPort, portTypeOperation, wsifdynamictypemap);
+
+ this.wsifPort = wsifPort;
+ this.portTypeOperation = portTypeOperation;
+ this.typeMap = wsifdynamictypemap;
+
+ BindingOperation bindingOperation =
+ getBindingOperation(portTypeOperation);
+
+ initialiseSoapOperation(bindingOperation);
+ initialiseBindingInput(bindingOperation);
+ initialiseBindingOutput(bindingOperation);
+
+ this.inputEncodingStyle = WSIFAXISConstants.DEFAULT_SOAP_ENCODING_URI;
+ this.outputEncodingStyle = WSIFAXISConstants.DEFAULT_SOAP_ENCODING_URI;
+
+//TODO???
+// QName bindingQN = wsifPort.getBindingName();
+// if (bindingQN != null) {
+// this.inputNamespace = bindingQN.getNamespaceURI();
+// }
+
+ addInputJmsPropertyValues(
+ wsifPort.getJmsAddressPropVals());
- inputEncodingStyle = "http://schemas.xmlsoap.org/soap/encoding/";
- outputEncodingStyle = "http://schemas.xmlsoap.org/soap/encoding/";
- typeMap = wsifdynamictypemap;
- setDynamicWSIFPort(wsifport_apacheaxis);
- setOperation(operation1);
- setDefinition(wsifport_apacheaxis.getDefinition());
if (Trc.ON)
Trc.exit(deep());
}
+ /**
+ * Initialises instance variables relating to the WSDL soapOperation element
+ * The WSDL has the form:
+ * <soap:operation soapAction="uri"? style="rpc|document"?>?
+ */
+ private void initialiseSoapOperation(BindingOperation bindingOperation) throws
WSIFException {
+
+ this.soapOperation =
+ wsifPort.getSOAPOperation(bindingOperation);
+ this.soapActionURI = soapOperation.getSoapActionURI();
+ this.operationStyle = soapOperation.getStyle();
+
+ if (operationStyle == null || operationStyle.length() < 1 ) {
+ operationStyle = wsifPort.getBindingStyle();
+ } else if (!WSIFAXISConstants.VALID_STYLES.contains(operationStyle)) {
+ throw new WSIFException(
+ "unsupported style " + operationStyle + " for operation "
+ portTypeOperation.getName());
+ }
+
+ if (operationStyle == null || operationStyle.length() < 1 ) {
+ throw new WSIFException(
+ "no style specified on either soap:binding or
soap:operation" );
+ }
+ }
+
+ private void initialiseBindingInput(BindingOperation bindingoperation) throws
WSIFException {
+ BindingInput bindinginput = bindingoperation.getBindingInput();
+ List inExtElems = bindinginput.getExtensibilityElements();
+ SOAPBody inSoapBody =
+ (SOAPBody) wsifPort.getExtElem(bindinginput,
+ javax.wsdl.extensions.soap.SOAPBody.class,
+ inExtElems);
+ if (inSoapBody != null) {
+ List list2 =
+ parseSoapBody(
+ soapOperation,
+ inSoapBody,
+ true);
+ setSoapPartNames(list2);
+ }
+
+ MIMEMultipartRelated inMimeMultipart =
+ (MIMEMultipartRelated)
wsifPort.getExtElem(bindinginput,
+ MIMEMultipartRelated.class,
+ inExtElems);
+ if (inSoapBody != null && inMimeMultipart != null)
+ throw new WSIFException(
+ "In a binding operation that contains a
mime:multipartRelated, "
+ + "a soap:body was found that was not
in a mime:part. "
+ + "OperationName="
+ + getOperationName());
+ if (inMimeMultipart != null)
+ parseMimeMultipart(
+ inMimeMultipart,
+ bindingoperation,
+ soapOperation,
+ true,
+ getOperationName());
+
+ MIMEMimeXml inMimeMimeXml =
+ (MIMEMimeXml) wsifPort.getExtElem(bindinginput,
+ MIMEMimeXml.class,
+ inExtElems);
+ if (inMimeMimeXml != null)
+ throw new WSIFException(
+ "WSIF does not support mime:mimeXml.
Operation=" + getOperationName());
+
+ SOAPHeader soapheader =
+ (SOAPHeader) wsifPort.getExtElem(bindinginput,
+ javax.wsdl.extensions.soap.SOAPHeader.class,
+ bindinginput.getExtensibilityElements());
+ if (soapheader != null)
+ throw new WSIFException(
+ "not supported input soap:header " +
soapheader);
+
+ List inJmsProps =
+ wsifPort.getExtElems(
+ bindinginput,
+ JMSProperty.class,
+ bindinginput.getExtensibilityElements());
+ if (inJmsProps != null && inJmsProps.size() > 0) {
+ if (wsifPort.isTransportJMS())
+ setInputJmsProperties(inJmsProps);
+ else
+ throw new WSIFException("jms:properties found
in non-jms binding");
+ }
+
+ List inJmsPropVals =
+ wsifPort.getExtElems(
+ bindinginput,
+ JMSPropertyValue.class,
+ bindinginput.getExtensibilityElements());
+ if (inJmsPropVals != null && inJmsPropVals.size() > 0) {
+ if (wsifPort.isTransportJMS())
+ addInputJmsPropertyValues(
+ inJmsPropVals);
+ else
+ throw new WSIFException("jms:propertyValue
found in non-jms binding");
+ }
+ }
+
+ private void initialiseBindingOutput(BindingOperation bindingoperation) throws
WSIFException {
+ BindingOutput bindingoutput =
bindingoperation.getBindingOutput();
+ if (bindingoutput != null) {
+ List outExtElems =
bindingoutput.getExtensibilityElements();
+ SOAPBody outSoapBody =
+ (SOAPBody) wsifPort.getExtElem(bindingoutput,
+
javax.wsdl.extensions.soap.SOAPBody.class,
+ outExtElems);
+ if (outSoapBody != null) {
+ List list3 =
+ parseSoapBody(
+ soapOperation,
+ outSoapBody,
+ false);
+ if (list3 != null && list3.size() > 0)
+ setReturnName(
+ (String) list3.get(0));
+ }
+
+ MIMEMultipartRelated outMimeMultipart =
+ (MIMEMultipartRelated)
wsifPort.getExtElem(bindingoutput,
+ MIMEMultipartRelated.class,
+ outExtElems);
+ if (outSoapBody != null && outMimeMultipart != null)
+ throw new WSIFException(
+ "In a binding operation that contains
a mime:multipartRelated, "
+ + "a soap:body was found that
was not in a mime:part. "
+ + "OperationName="
+ + getOperationName());
+ if (outMimeMultipart != null)
+ parseMimeMultipart(
+ outMimeMultipart,
+ bindingoperation,
+ soapOperation,
+ false,
+ getOperationName());
+
+ MIMEMimeXml outMimeMimeXml =
+ (MIMEMimeXml)
wsifPort.getExtElem(bindingoutput,
+ MIMEMimeXml.class,
+ outExtElems);
+ if (outMimeMimeXml != null)
+ throw new WSIFException(
+ "WSIF does not support mime:mimeXml.
Operation="
+ + getOperationName());
+
+ SOAPHeader soapheader =
+ (SOAPHeader) wsifPort.getExtElem(bindingoutput,
+
javax.wsdl.extensions.soap.SOAPHeader.class,
+ outExtElems);
+ if (soapheader != null)
+ throw new WSIFException(
+ "not supported output soap:header " +
soapheader);
+ for (Iterator iterator1 =
+
bindingoperation.getBindingFaults().values().iterator();
+ iterator1.hasNext();
+ ) {
+ BindingFault bindingfault = (BindingFault)
iterator1.next();
+ SOAPFault soapfault =
+ (SOAPFault)
wsifPort.getExtElem(bindingfault,
+
javax.wsdl.extensions.soap.SOAPFault.class,
+
bindingfault.getExtensibilityElements());
+ }
+ List outJmsProps =
+ wsifPort.getExtElems(bindingoutput,
JMSProperty.class, outExtElems);
+ if (outJmsProps != null && outJmsProps.size() > 0) {
+ if (wsifPort.isTransportJMS())
+ setOutputJmsProperties(
+ outJmsProps);
+ else
+ throw new
WSIFException("jms:properties found in non-jms binding");
+ }
+ }
+ }
+
+ private List parseSoapBody(
+ SOAPOperation soapoperation,
+ SOAPBody soapbody,
+ boolean isInput)
+ throws WSIFException {
+
+ Trc.entry(this, soapoperation, soapbody, new Boolean(isInput));
+
+ if (isInput) {
+ String ns = soapbody.getNamespaceURI();
+ if (ns != null) {
+ setInputNamespace(soapbody.getNamespaceURI());
+ }
+ }
+
+ String use = soapbody.getUse();
+ if (!WSIFAXISConstants.VALID_USES.contains(use)) {
+ throw new WSIFException(
+ "unsupported use " + use + " in " + soapoperation);
+ }
+
+ if (isInput) {
+ List list1 = soapbody.getEncodingStyles();
+ if (list1 != null && list1.size() > 0)
+ setInputEncodingStyle((String) list1.get(0));
+ }
+
+ List list2 = soapbody.getParts();
+ Trc.exit(list2);
+ return list2;
+ }
+
+ private void parseMimeMultipart(
+ MIMEMultipartRelated mimeMultipart,
+ BindingOperation bindingoperation,
+ SOAPOperation soapoperation,
+ boolean isInput,
+ String operationName)
+ throws WSIFException {
+
+ Trc.entry(
+ this,
+ mimeMultipart,
+ bindingoperation,
+ soapoperation);
+
+ Vector mimePartNames = new Vector();
+ boolean soapBodyFound = false;
+ Operation op = bindingoperation.getOperation();
+ Map mapInParts = op.getInput().getMessage().getParts();
+ Map mapOutParts =
+ op.getOutput() == null
+ ? new HashMap()
+ : op.getOutput().getMessage().getParts();
+
+ List mimeParts = mimeMultipart.getMIMEParts();
+ Iterator mimePartIt = mimeParts.iterator();
+ while (mimePartIt.hasNext()) {
+ Object nextMimePart = mimePartIt.next();
+ if (nextMimePart instanceof MIMEPart) {
+ MIMEPart mimePart = (MIMEPart) nextMimePart;
+ if (!MIMEConstants
+ .NS_URI_MIME
+
.equals(mimePart.getElementType().getNamespaceURI()))
+ throw new WSIFException(
+ "A MIME part in binding operation "
+ + bindingoperation.getName()
+ + " did not have the correct
namespace URI of "
+ + MIMEConstants.NS_URI_MIME
+ + ".");
+
+ boolean containsSoapBody = false;
+ boolean containsMimeContent = false;
+ List mimePartChildren =
mimePart.getExtensibilityElements();
+ Iterator mimePartChildrenIt =
mimePartChildren.iterator();
+ while (mimePartChildrenIt.hasNext()) {
+ Object nextChild = mimePartChildrenIt.next();
+ if (nextChild instanceof MIMEContent) {
+ MIMEContent mimeContent =
(MIMEContent) nextChild;
+ if (!MIMEConstants
+ .NS_URI_MIME
+ .equals(
+
mimePart.getElementType().getNamespaceURI()))
+ throw new WSIFException(
+ "A MIME part in
binding operation "
+ +
bindingoperation.getName()
+ + " did not
have the correct namespace URI of "
+ +
MIMEConstants.NS_URI_MIME
+ + ".");
+ containsMimeContent = true;
+ if (containsSoapBody)
+ throw new WSIFException(
+ "A mime:part that
contains a mime:content also "
+ + "contains a
soap:body. Operation="
+ +
operationName);
+
+ String partName =
mimeContent.getPart();
+ if (partName == null ||
partName.length() == 0)
+ throw new WSIFException(
+ "No part name for a
mime:content. Operation="
+ +
operationName);
+
+ if ((isInput &&
mapInParts.get(partName) == null)
+ || (!isInput &&
mapOutParts.get(partName) == null))
+ throw new WSIFException(
+ "The part specified in
a mime:content does "
+ + "not exist
in the operation. Operation="
+ + operationName
+ + " Part="
+ + partName);
+
+ mimePartNames.addElement(partName);
+
+ } else if (nextChild instanceof SOAPBody) {
+ if (soapBodyFound)
+ throw new WSIFException(
+ "Multiple soap:body
tags found in a "
+ +
"mime:multipartRelated. Operation="
+ +
operationName);
+ soapBodyFound = true;
+ containsSoapBody = true;
+ if (containsMimeContent)
+ throw new WSIFException(
+ "A mime:part that
contains a mime:content also "
+ + "contains a
soap:body. Operation="
+ +
operationName);
+
+ List soapPartNameList =
+ parseSoapBody(
+ soapoperation,
+ (SOAPBody) nextChild,
+ isInput);
+
+ if (isInput)
+
setSoapPartNames(soapPartNameList);
+ else if (
+ soapPartNameList != null
+ &&
soapPartNameList.size() > 0)
+ setReturnName(
+ (String)
soapPartNameList.get(0));
+ } else if (nextChild instanceof
MIMEMultipartRelated) {
+ throw new WSIFException(
+ "WSIF does not support nesting
mime:multipartRelated "
+ + "inside a mime:part.
Operation="
+ + operationName);
+ } else if (nextChild instanceof MIMEMimeXml) {
+ throw new WSIFException(
+ "WSIF does not support
mime:mimeXml. Operation="
+ + operationName);
+ }
+ }
+ }
+ }
+
+ if (!soapBodyFound)
+ throw new WSIFException(
+ "No soap:body found in a mime:multipartRelated.
Operation="
+ + operationName);
+
+ if (mimePartNames != null && !mimePartNames.isEmpty()) {
+ List oldMimePartNames = getMimePartNames();
+ if (oldMimePartNames == null || oldMimePartNames.isEmpty())
+ setMimePartNames(mimePartNames);
+ else
+ oldMimePartNames.addAll(mimePartNames);
+ }
+
+ Trc.exit();
+ }
+
+ public String getOperationName() {
+ return portTypeOperation.getName();
+ }
+
+ private BindingOperation getBindingOperation(Operation operation) throws
WSIFException {
+ Binding binding = wsifPort.getPort().getBinding();
+ BindingOperation bindingOp =
+ WSIFUtils.getBindingOperation(binding, operation);
+ if (bindingOp == null) {
+ throw new WSIFException(
+ "cannot find binding operation for port operation:" +
+ operation.getName());
+ }
+ return bindingOp;
+
+ }
+
/**
* Create a new copy of this object. This is not a clone, since
* it does not copy the referenced objects as well.
@@ -187,7 +587,7 @@
Trc.entry(this);
WSIFOperation_ApacheAxis op =
- new WSIFOperation_ApacheAxis(portInstance, operation, typeMap);
+ new WSIFOperation_ApacheAxis(wsifPort, portTypeOperation,
typeMap);
op.setSoapActionURI(getSoapActionURI());
op.setInputNamespace(getInputNamespace());
@@ -210,14 +610,15 @@
public Definition getDefinition() {
Trc.entry(this);
- Trc.exit(definition);
- return definition;
+ Definition d = wsifPort.getDefinition();
+ Trc.exit(d);
+ return d;
}
public WSIFPort_ApacheAxis getDynamicWSIFPort() {
Trc.entry(this);
- Trc.exit(portInstance);
- return portInstance;
+ Trc.exit(wsifPort);
+ return wsifPort;
}
public String getInputEncodingStyle() {
@@ -232,17 +633,36 @@
return inputNamespace;
}
+ /**
+ * Gets the name of the portType wsdl:operation element
+ * being used by this WSIFOperation
+ * @return String the operation name
+ */
public String getName() {
Trc.entry(this);
- String s = operation.getName();
+ String s = portTypeOperation.getName();
Trc.exit(s);
return s;
}
+ /**
+ * @deprecated use getPortTypeOperation
+ */
public Operation getOperation() {
Trc.entry(this);
- Trc.exit(operation);
- return operation;
+ Operation o = getPortTypeOperation();
+ Trc.exit(o);
+ return o;
+ }
+
+ /**
+ * Gets the portType wsdl:operation element used by this WSIFOperation
+ * @return Operation the WSDL4J portType Operation object
+ */
+ public Operation getPortTypeOperation() {
+ Trc.entry(this);
+ Trc.exit(portTypeOperation);
+ return portTypeOperation;
}
public String getOutputEncodingStyle() {
@@ -271,13 +691,13 @@
public String getSoapActionURI() {
Trc.entry(this);
- Trc.exit(actionUri);
- return actionUri;
+ Trc.exit(soapActionURI);
+ return soapActionURI;
}
- public Transport getTransport() {
+ public Transport getTransport() throws WSIFException {
Trc.entry(this);
- Transport t = portInstance.getAxisTransport();
+ Transport t = wsifPort.getTransport();
Trc.exit(t);
return t;
}
@@ -297,7 +717,7 @@
* @return String
*/
public String getStyle() {
- return style;
+ return operationStyle;
}
/**
@@ -396,11 +816,11 @@
setAsyncOperation(false);
boolean succ;
- if ("document".equals(style)) {
+ if (WSIFAXISConstants.STYLE_RPC.equals(operationStyle)) {
+ succ = invokeRequestResponseOperation(inMsg, outMsg, faultMsg);
+ } else {
succ =
invokeRequestResponseOperationDocument(inMsg, outMsg,
faultMsg);
- } else {
- succ = invokeRequestResponseOperation(inMsg, outMsg, faultMsg);
}
Trc.exit(succ);
@@ -444,10 +864,12 @@
Trc.entry(this, input, handler);
close();
- if (!portInstance.supportsAsync()) {
+ if (!wsifPort.supportsAsync()) {
throw new WSIFException("asynchronous operations not
available");
}
- if ("document".equals(style)) {
+
+ //TODO why not, no reason they shouldn't work???
+ if (WSIFAXISConstants.STYLE_DOCUMENT.equals(operationStyle)) {
throw new WSIFException("docstyle asynchronous operations not
implemented yet");
}
@@ -802,7 +1224,7 @@
throws WSIFException {
Trc.entry(this, wsifmessage, wsifmessage1, wsifmessage2);
- Call call = portInstance.getCall();
+ Call call = wsifPort.getCall();
Transport axistransport = getTransport();
WSIFJMSDestination dest = null;
@@ -868,7 +1290,7 @@
Object response;
boolean respOK = true;
try {
- String name = operation.getName();
+ String name = portTypeOperation.getName();
Object[] objs = objects.toArray();
Trc.event(
this,
@@ -920,23 +1342,29 @@
Trc.entry(this, inMsg, outMsg, faultMsg);
boolean workedOK = false;
- Call call = portInstance.getCall();
+ Call call = wsifPort.getCall();
call.setSOAPActionURI(getSoapActionURI());
- call.setTargetEndpointAddress(portInstance.getEndPoint());
+ call.setTargetEndpointAddress(wsifPort.getEndPoint());
call.setEncodingStyle(null);
inputEncodingStyle = "";
outputEncodingStyle = "";
- Input inputMsg = operation.getInput();
+ //TODO need to sort out the namespace
+ QName bindingQN = wsifPort.getBindingName();
+ if (bindingQN != null) {
+ setInputNamespace(bindingQN.getNamespaceURI());
+ }
+
+ Input inputMsg = portTypeOperation.getInput();
if (inputMsg != null) {
List parts = inputMsg.getMessage().getOrderedParts(null);
- if (WSIFUtils.isWrappedDocLiteral(parts, operation.getName())) {
- style = "wrapped";
+ if (WSIFUtils.isWrappedDocLiteral(parts,
portTypeOperation.getName())) {
+ operationStyle = WSIFAXISConstants.AXIS_STYLE_WRAPPED;
}
}
if (isMessaging(inMsg)) {
- style = "message";
+ operationStyle = WSIFAXISConstants.AXIS_STYLE_MESSAGE;
}
if (inputPartNames == null) {
@@ -966,7 +1394,7 @@
setDestinationContext(dest);
setCallContext(call);
- if ("message".equals(style)) {
+ if (WSIFAXISConstants.AXIS_STYLE_MESSAGE.equals(operationStyle)) {
workedOK = doAXISMessaging(call, inMsg, outMsg, faultMsg);
} else {
workedOK = doAXISDocStyle(call, inMsg, outMsg, faultMsg);
@@ -1003,10 +1431,10 @@
boolean respOK = false;
// setup the call object
- call.setOperationName(new QName(getInputNamespace(),
operation.getName()));
+ call.setOperationName(new QName(getInputNamespace(),
portTypeOperation.getName()));
call.setScopedProperty(Call.SEND_TYPE_ATTR, Boolean.FALSE);
call.setScopedProperty(AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
- call.setOperationStyle(style);
+ call.setOperationStyle(operationStyle);
// setup the input values
for (int i = 0; i < inputPartNames.length; i++) {
@@ -1077,7 +1505,7 @@
}
}
- call.setOperationStyle("message");
+ call.setOperationStyle(WSIFAXISConstants.AXIS_STYLE_MESSAGE);
Trc.event(this, "Invoking AXIS call", call, axisInputs);
Object axisResponse;
@@ -1140,12 +1568,25 @@
for (Iterator iterator = typeMap.iterator(); iterator.hasNext();) {
wsifdynamictypemapping = (WSIFDynamicTypeMapping)
iterator.next();
objClass = wsifdynamictypemapping.getJavaType();
+ QName xmlType = wsifdynamictypemapping.getXmlType();
- // don't overwrite existing mappings
- if (tm.getTypeQName(objClass) != null) {
- continue;
+ SerializerFactory sf = null;
+ DeserializerFactory df = null;
+ if (tm.getSerializer(objClass, xmlType) == null) {
+ if (objClass.isArray()) {
+ sf = new ArraySerializerFactory();
+ } else {
+ sf = new BeanSerializerFactory(objClass,
xmlType);
+ }
}
-
+ if (tm.getDeserializer(objClass, xmlType) == null) {
+ if (objClass.isArray()) {
+ df = new ArrayDeserializerFactory();
+ } else {
+ df = new BeanDeserializerFactory(objClass,
xmlType);
+ }
+ }
+
namespaceURI =
wsifdynamictypemapping.getXmlType().getNamespaceURI();
@@ -1170,20 +1611,16 @@
// Attachments that are Images, Strings are unsupported at
present.
// Attachments can only be DataHandlers.
Image.class.equals(objClass)
- || String.class.equals(objClass)
- || Source.class.equals(objClass)
- || MimeMultipart.class.equals(objClass)) {
- call.registerTypeMapping(
- objClass,
- qn,
- JAFDataHandlerSerializerFactory.class,
- JAFDataHandlerDeserializerFactory.class);
- } else {
- BeanSerializerFactory bsf =
- new BeanSerializerFactory(objClass,
qn);
- BeanDeserializerFactory bdf =
- new BeanDeserializerFactory(objClass,
qn);
- call.registerTypeMapping(objClass, qn, bsf,
bdf);
+// || String.class.equals(objClass)
+ || Source.class.equals(objClass)
+ || MimeMultipart.class.equals(objClass)) {
+ call.registerTypeMapping(
+ objClass,
+ qn,
+ JAFDataHandlerSerializerFactory.class,
+ JAFDataHandlerDeserializerFactory.class);
+ } else if (sf != null || df != null) {
+ call.registerTypeMapping(objClass, qn, sf, df);
}
}
}
@@ -1260,7 +1697,7 @@
*/
private List getInputParts() throws WSIFException {
List parts = new ArrayList();
- Input inputMsg = operation.getInput();
+ Input inputMsg = portTypeOperation.getInput();
if (inputMsg != null) {
if (soapPartNames == null) {
parts = inputMsg.getMessage().getOrderedParts(null);
@@ -1279,7 +1716,7 @@
}
}
}
- unWrapIfWrappedDocLit(parts, operation.getName());
+ unWrapIfWrappedDocLit(parts, portTypeOperation.getName());
return parts;
}
@@ -1289,13 +1726,13 @@
*/
private List getOutputParts() throws WSIFException {
List parts;
- Output outputMsg = operation.getOutput();
+ Output outputMsg = portTypeOperation.getOutput();
if (outputMsg == null) {
parts = new ArrayList();
} else {
parts = outputMsg.getMessage().getOrderedParts(null);
}
- unWrapIfWrappedDocLit(parts, operation.getName() + "Response");
+ unWrapIfWrappedDocLit(parts, portTypeOperation.getName() + "Response");
return parts;
}
@@ -1304,10 +1741,10 @@
*/
private void unWrapIfWrappedDocLit(List parts, String operationName)
throws WSIFException {
- if (!"message".equals(style)) {
+ if (!"message".equals(operationStyle)) {
Part p = WSIFUtils.getWrappedDocLiteralPart(parts, operationName);
if (p != null) {
- List unWrappedParts = WSIFUtils.unWrapPart(p, definition);
+ List unWrappedParts = WSIFUtils.unWrapPart(p,
getDefinition());
parts.remove(p);
parts.addAll(unWrappedParts);
}
@@ -1382,7 +1819,7 @@
+ p
+ " must have type name or element
declared");
}
- if ("message".equals(style)) {
+ if
(WSIFAXISConstants.AXIS_STYLE_MESSAGE.equals(operationStyle)) {
types[i] = Element.class;
} else {
types[i] = tm.getClassForQName(partQN);
@@ -1423,8 +1860,9 @@
//TODO shouldn't there be in + out mimePartNames
if (mimePartNames != null) {
for (int i = 0; i < partNames.length; i++) {
- if (partTypes[i] == null // no user explicit mapping
- && mimePartNames.contains(partNames[i])) {
+// if (partTypes[i] == null // no user explicit mapping
+// && mimePartNames.contains(partNames[i])) {
+ if (mimePartNames.contains(partNames[i])) {
partTypes[i] = DataHandler.class;
call.registerTypeMapping(
DataHandler.class,
@@ -1455,15 +1893,17 @@
return responseHandler;
}
+ /**
+ * @deprecated
+ */
public void setDefinition(Definition definition1) {
Trc.entry(this, definition1);
- definition = definition1;
- Trc.exit();
+ throw new RuntimeException("nolonger supported");
}
public void setDynamicWSIFPort(WSIFPort_ApacheAxis wsifport_apacheaxis) {
Trc.entry(this, wsifport_apacheaxis);
- portInstance = wsifport_apacheaxis;
+ wsifPort = wsifport_apacheaxis;
Trc.exit();
}
@@ -1479,9 +1919,14 @@
Trc.exit();
}
+// public void setOperation(Operation operation1) {
+// Trc.entry(this, operation1);
+// operation = operation1;
+// Trc.exit();
+// }
public void setOperation(Operation operation1) {
Trc.entry(this, operation1);
- operation = operation1;
+ portTypeOperation = operation1;
Trc.exit();
}
@@ -1518,7 +1963,7 @@
public void setSoapActionURI(String s) {
Trc.entry(this, s);
- actionUri = s;
+ soapActionURI = s;
Trc.exit();
}
@@ -1666,7 +2111,7 @@
private void checkForTimeoutProperties(
HashMap inJmsPropVals,
- WSIFJMSDestination dest) {
+ WSIFJMSDestination dest) throws WSIFException {
for (Iterator i = inJmsPropVals.keySet().iterator(); i.hasNext();) {
String name = (String) i.next();
Object value = inJmsPropVals.get(name);
@@ -1679,7 +2124,7 @@
private boolean timeoutProperty(
WSIFJMSDestination dest,
String propertyName,
- Object value) {
+ Object value) throws WSIFException {
boolean isTimeoutProperty = false;
try {
if (WSIFConstants.WSIF_PROP_SYNC_TIMEOUT.equals(propertyName))
{
@@ -1736,11 +2181,18 @@
}
/**
- * Sets the style.
- * @param style The style to set
+ * @deprecated use setOperationStyle
*/
public void setStyle(String style) {
- this.style = style;
+ this.operationStyle = style;
+ }
+
+ /**
+ * Sets the style of the operation
+ * @param style The style to set
+ */
+ public void setOperationStyle(String style) {
+ this.operationStyle = style;
}
/**
@@ -1820,14 +2272,13 @@
try {
buff = new String(super.toString() + ":\n");
- buff += "portInstance:" + portInstance;
- buff += " operation:" + Trc.brief(operation);
- buff += " definition:" + Trc.brief(definition);
+ buff += "portInstance:" + wsifPort;
+ buff += " operation:" + Trc.brief(portTypeOperation);
buff += " soapPartNames:" + soapPartNames;
buff += " mimePartNames:" + mimePartNames;
buff += " inputEncodingStyle:" + inputEncodingStyle;
buff += " inputNamespace:" + inputNamespace;
- buff += " actionUri:" + actionUri;
+ buff += " actionUri:" + soapActionURI;
buff += " inJmsProps:" + inJmsProps;
buff += " outJmsProps:" + outJmsProps;
buff += " inJmsPropVals:" + inJmsPropVals;