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 ru...@apache.org on 2006/01/04 12:16:43 UTC
svn commit: r365894 - in /webservices/axis2/trunk/java:
modules/core/src/org/apache/axis2/client/ modules/saaj/
modules/saaj/src/org/apache/axis2/saaj/
modules/saaj/src/org/apache/axis2/saaj/util/
modules/saaj/test-resources/META-INF/ modules/saaj/test...
Author: ruchithf
Date: Wed Jan 4 03:14:14 2006
New Revision: 365894
URL: http://svn.apache.org/viewcvs?rev=365894&view=rev
Log:
Applying Azeez's patch
Removed the iframes from security-module.html
Added:
webservices/axis2/trunk/java/modules/saaj/test-resources/META-INF/
webservices/axis2/trunk/java/modules/saaj/test-resources/META-INF/services.xml
webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/
webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/EchoService.java
webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java
webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java
webservices/axis2/trunk/java/xdocs/sec-conf/in-sample.png (with props)
webservices/axis2/trunk/java/xdocs/sec-conf/out-sample.png (with props)
webservices/axis2/trunk/java/xdocs/sec-conf/out-sample2.png (with props)
Removed:
webservices/axis2/trunk/java/xdocs/sec-conf/in-sample.xml
webservices/axis2/trunk/java/xdocs/sec-conf/out-sample.xml
webservices/axis2/trunk/java/xdocs/sec-conf/out-sample2.xml
Modified:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java
webservices/axis2/trunk/java/modules/saaj/project.xml
webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java
webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java
webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java
webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java
webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java
webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java
webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/EnvelopeTest.java
webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java
webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java
webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultsTest.java
webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMAbstractFactory.java
webservices/axis2/trunk/java/xdocs/security-module.html
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java Wed Jan 4 03:14:14 2006
@@ -91,7 +91,7 @@
*/
public void addSOAPHeader(QName soapHeaderQName, String soapHeaderText) {
OMElement omElement = OMAbstractFactory.getOMFactory().createOMElement(soapHeaderQName,
- null);
+ null);
omElement.setText(soapHeaderText);
@@ -104,7 +104,7 @@
protected void addUserAddedSOAPHeaders(MessageContext msgCtx, Options options) {
if ((soapHeaderList != null) && (soapHeaderList.size() > 0)
- && (msgCtx.getEnvelope() != null)) {
+ && (msgCtx.getEnvelope() != null)) {
SOAPFactory soapFactory;
SOAPHeader header = msgCtx.getEnvelope().getHeader();
@@ -145,7 +145,7 @@
configurationContext.getAxisConfiguration().addService(axisService);
serviceContext = new ServiceGroupContext(configurationContext,
- axisService.getParent()).getServiceContext(axisService);
+ axisService.getParent()).getServiceContext(axisService);
}
/**
@@ -170,22 +170,23 @@
if (clientOptions == null) {
throw new AxisFault(
"Can not proceed without options being set for invocation. Set the"
- + "properties for this invocation via MEPClient.setOptions(Options) first.");
+ + "properties for this invocation via MEPClient.setOptions(Options) first.");
}
String soapVersionURI = clientOptions.getSoapVersionURI();
- String soapFactory = clientOptions.getSoapFactory();
+ String soapFactory =
+ (String) clientOptions.getProperty(OMAbstractFactory.SOAP_FACTORY_NAME_PROPERTY);
if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
String factory = (String) clientOptions.getProperty(OMAbstractFactory.SOAP12_FACTORY_NAME_PROPERTY);
- if(factory != null) {
+ if (factory != null) {
return OMAbstractFactory.getSOAPFactory(soapFactory).getDefaultEnvelope();
} else {
return OMAbstractFactory.getSOAP12Factory().getDefaultEnvelope();
}
} else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
String factory = (String) clientOptions.getProperty(OMAbstractFactory.SOAP11_FACTORY_NAME_PROPERTY);
- if(factory != null) {
+ if (factory != null) {
return OMAbstractFactory.getSOAPFactory(soapFactory).getDefaultEnvelope();
} else {
return OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
@@ -263,10 +264,10 @@
// we have a deprecated method for user to set the transport
// protocol directly. Lets support that also
- String senderTransportProtocol = clientOptions.getSenderTransportProtocol();
+ String senderTrasportProtocol = clientOptions.getSenderTransportProtocol();
if (axisConfig != null) {
- if ((senderTransportProtocol == null) || "".equals(senderTransportProtocol)) {
+ if ((senderTrasportProtocol == null) || "".equals(senderTrasportProtocol)) {
// by this time we have passed all the information we
// collected via Options to the message context
@@ -276,13 +277,13 @@
// if he has not set the transport information, we gonna
// infer that from the to EPR
clientOptions.setSenderTransport(
- axisConfig.getTransportOut(new QName(senderTransportProtocol)));
+ axisConfig.getTransportOut(new QName(senderTrasportProtocol)));
}
}
if (this.clientOptions.getSenderTransport() == null) {
throw new AxisFault(Messages.getMessage("unknownTransport",
- senderTransportProtocol));
+ senderTrasportProtocol));
}
}
}
@@ -299,10 +300,10 @@
// I should check that is
// available either from the message context or from the options.
if (((msgCtx == null) || (msgCtx.getTo() == null))
- && ((clientOptions == null) || (clientOptions.getTo() == null))) {
+ && ((clientOptions == null) || (clientOptions.getTo() == null))) {
throw new AxisFault(
"Can not proceed without options being set for invocation. Set the"
- + "properties for this invocation via MEPClient.setOptions(Options) first.");
+ + "properties for this invocation via MEPClient.setOptions(Options) first.");
}
if (axisop == null) {
@@ -312,7 +313,7 @@
// make sure operation is type right MEP
if (mep.equals(axisop.getMessageExchangePattern())) {
throw new AxisFault(Messages.getMessage("mepClientSupportOnly", mep,
- axisop.getMessageExchangePattern()));
+ axisop.getMessageExchangePattern()));
}
// if operation not alrady added, add it
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=365894&r1=365893&r2=365894&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 Wed Jan 4 03:14:14 2006
@@ -236,14 +236,6 @@
: soapVersionURI;
}
- public String getSoapFactory() {
- if (soapFactory == null && parent != null) {
- soapFactory = parent.getSoapFactory();
- }
-
- return soapFactory == null ? "" : soapFactory;
- }
-
/**
* Gets the wait time after which a client times out in a blocking scenario.
* The default is Options#DEFAULT_TIMEOUT_MILLISECONDS
Modified: webservices/axis2/trunk/java/modules/saaj/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/project.xml?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/project.xml (original)
+++ webservices/axis2/trunk/java/modules/saaj/project.xml Wed Jan 4 03:14:14 2006
@@ -44,10 +44,6 @@
<includes>
<include>**/*Test.java</include>
</includes>
- <excludes>
- <exclude>**/PrefixesTest.java</exclude>
- <exclude>**/SOAPFaultsTest.java</exclude>
- </excludes>
<resources>
<resource>
Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java Wed Jan 4 03:14:14 2006
@@ -15,10 +15,10 @@
*/
package org.apache.axis2.saaj;
-import org.apache.axis2.om.OMText;
import org.apache.axis2.om.DOOMAbstractFactory;
-import org.apache.axis2.om.impl.dom.TextImpl;
+import org.apache.axis2.om.OMText;
import org.apache.axis2.om.impl.dom.DocumentImpl;
+import org.apache.axis2.om.impl.dom.TextImpl;
import org.apache.axis2.transport.http.HTTPConstants;
import javax.activation.DataHandler;
Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java Wed Jan 4 03:14:14 2006
@@ -47,7 +47,6 @@
*/
public SOAPFault addFault() throws SOAPException {
SOAP11FaultImpl fault = new SOAP11FaultImpl(omSOAPBody);
- omSOAPBody.addFault(fault);
return new SOAPFaultImpl(fault);
}
Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java Wed Jan 4 03:14:14 2006
@@ -18,8 +18,9 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Call;
import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.MessageContext;
import org.apache.axis2.om.DOOMAbstractFactory;
import org.apache.axis2.om.OMAttribute;
import org.apache.axis2.om.OMElement;
@@ -29,6 +30,7 @@
import org.apache.axis2.om.impl.dom.ElementImpl;
import org.apache.axis2.saaj.util.SAAJUtil;
import org.apache.axis2.saaj.util.SessionUtils2;
+import org.apache.axis2.soap.SOAP11Constants;
import javax.activation.DataHandler;
import javax.xml.namespace.QName;
@@ -42,7 +44,7 @@
import java.util.Iterator;
/**
- *
+ *
*/
public class SOAPConnectionImpl extends SOAPConnection {
/**
@@ -71,67 +73,99 @@
throw new SOAPException(e);
}
- // initialize the Call
- Call call;
+ if (request.countAttachments() != 0) { // SOAPMessage with attachments
+ return handleSOAPMessageWithAttachments(request, url);
+ } else { // simple SOAPMessage
+ return handleBasicSOAPMessage(request, url);
+ }
+ }
+
+ /**
+ * Closes this <CODE>SOAPConnection</CODE> object.
+ *
+ * @throws javax.xml.soap.SOAPException if there is a SOAP error
+ */
+ public void close() throws SOAPException {
+ //TODO: Method implementation
+
+ }
+
+ private SOAPMessage handleSOAPMessageWithAttachments(SOAPMessage request,
+ URL url) throws SOAPException {
+ SOAPMessage response = null;
+
+ // initialize the Sender
+ ServiceClient sender;
try {
- call = new Call();
+ sender = new ServiceClient(null, null); //TODO: create the config context properly
} catch (AxisFault e) {
throw new SOAPException(e);
}
// initialize and set Options
Options options = new Options();
+ options.setProperty(MessageContext.CHARACTER_SET_ENCODING, "UTF-16");
+ options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setTo(new EndpointReference(url.toString()));
- call.setClientOptions(options);
+ sender.setOptions(options);
- String axisOp = request.getSOAPBody().getFirstChild().getNodeName();
+ // process the attachments
+ final Iterator attachmentIter = request.getAttachments();
+ while (attachmentIter.hasNext()) {
+ System.err.println("########### Att=" + attachmentIter.next());
+ //TODO: process it
+ }
try {
- final SOAPEnvelope saajEnvelope = request.getSOAPPart().getEnvelope();
- /* final org.apache.axis2.soap.SOAPEnvelope omEnvelope =
- ((SOAPEnvelopeImpl) saajEnvelope).getOMEnvelope();*/
-
- final Iterator attachmentIter = request.getAttachments();
- while (attachmentIter.hasNext()) {
- System.err.println("########### Att=" + attachmentIter.next());
- }
-
-// final OMElement omEnvelope = ((SOAPEnvelopeImpl) saajEnvelope).getOMEnvelope();
-
- //parse the omEnvelope element and stuff it with the attachment
- //specific omText nodes
-// insertAttachmentNodes(omEnvelope, request);
-
- //-------------- Send the Request -----------------------
-
- //Convert to Default OM Implementation(LLOM at the moment) before calling Call.invokeBlocking
OMElement result =
- call.invokeBlocking(axisOp,
- SAAJUtil.toOMSOAPEnvelope(request.getSOAPPart().getDocumentElement()));
+ sender.sendReceive(SAAJUtil.toOMSOAPEnvelope(request.getSOAPPart().getDocumentElement()));
//-------------- Handle the response --------------------
SOAPEnvelopeImpl responseEnv =
new SOAPEnvelopeImpl(SAAJUtil.toDOOMSOAPEnvelope((org.apache.axis2.soap.SOAPEnvelope) result));
- SOAPMessageImpl sMsg = new SOAPMessageImpl(responseEnv);
-// extractAttachmentNodes(result, sMsg);
- return sMsg;
- }
- catch (AxisFault af) {
- throw new SOAPException(af);
+ response = new SOAPMessageImpl(responseEnv);
+
+ //TODO: process the attachments in result and add in those as attachments of response
+ } catch (AxisFault e) {
+ throw new SOAPException(e);
}
+
+ return response;
}
- /**
- * Closes this <CODE>SOAPConnection</CODE> object.
- *
- * @throws javax.xml.soap.SOAPException if there is a SOAP error
- */
- public void close() throws SOAPException {
- //TODO: Method implementation
+ private SOAPMessage handleBasicSOAPMessage(SOAPMessage request, URL url) throws SOAPException {
+ SOAPMessage response = null;
+ // initialize the Sender
+ ServiceClient sender;
+ try {
+ sender = new ServiceClient();
+ } catch (AxisFault e) {
+ throw new SOAPException(e);
+ }
+
+ // initialize and set Options
+ Options options = new Options();
+ options.setProperty(MessageContext.CHARACTER_SET_ENCODING, "UTF-8");
+ options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+ options.setTo(new EndpointReference(url.toString()));
+ sender.setOptions(options);
+
+ try {
+ OMElement result =
+ sender.sendReceive(SAAJUtil.toOMSOAPEnvelope(request.getSOAPPart().getDocumentElement()));
+ SOAPEnvelopeImpl responseEnv =
+ new SOAPEnvelopeImpl(SAAJUtil.toDOOMSOAPEnvelope((org.apache.axis2.soap.SOAPEnvelope) result));
+
+ response = new SOAPMessageImpl(responseEnv);
+ } catch (AxisFault e) {
+ throw new SOAPException(e);
+ }
+ return response;
}
/**
@@ -159,7 +193,7 @@
soapMsg,
(DocumentImpl) ((ElementImpl) child).getOwnerDocument());
-// child.removeAttribute(hrefAttr); //y did SAAJ1 implementors remove the attribute???
+ child.removeAttribute(hrefAttr); //y did SAAJ1 implementors remove the attribute???
child.addChild(omText);
} else { //possibly there can be references in the children of this omEnvelope
//so recurse through.
Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java Wed Jan 4 03:14:14 2006
@@ -9,15 +9,13 @@
import org.apache.axis2.soap.SOAPFaultValue;
import org.apache.axis2.soap.impl.dom.soap11.SOAP11FaultDetailImpl;
import org.apache.axis2.soap.impl.dom.soap11.SOAP11FaultReasonImpl;
-import org.apache.axis2.soap.impl.dom.soap11.SOAP11FaultRoleImpl;
import org.apache.axis2.soap.impl.dom.soap11.SOAP11FaultTextImpl;
+import org.apache.axis2.soap.impl.dom.soap11.SOAP11FaultRoleImpl;
import javax.xml.soap.Detail;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFault;
-import javax.xml.stream.XMLStreamException;
-import java.io.ByteArrayOutputStream;
import java.util.Locale;
public class SOAPFaultImpl extends SOAPBodyElementImpl implements SOAPFault {
@@ -48,12 +46,6 @@
* @see #getFaultCode() getFaultCode()
*/
public void setFaultCode(String faultCode) throws SOAPException {
- /*SOAPFaultCode code = new SOAP11FaultCodeImpl(fault);
- SOAP11FaultValueImpl faultValueImpl = new SOAP11FaultValueImpl(code);
- faultValueImpl.setText(faultCode);
- code.setValue(faultValueImpl);
- this.fault.setCode(code);*/
-
org.apache.axis2.soap.SOAPFactory soapFactory = DOOMAbstractFactory.getSOAP11Factory();
SOAPFaultCode fCode = soapFactory.createSOAPFaultCode(fault);
SOAPFaultValue fValue = soapFactory.createSOAPFaultValue(fCode);
@@ -61,25 +53,6 @@
fValue.setText(faultCode);
this.fault.setCode(fCode);
-
- /*try {
- {
- System.err.println("########################## Fault Code #########");
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- fCode.serialize(baos);
- String xml2 = new String(baos.toByteArray());
- System.out.println(xml2);
- System.err.println("##########################");
- }
- System.err.println("########################## Fault -------");
- ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
- fault.serialize(baos2);
- String xml3 = new String(baos2.toByteArray());
- System.out.println(xml3);
- System.err.println("##########################-----------");
- } catch (XMLStreamException e) {
- e.printStackTrace();
- }*/
}
/**
@@ -101,6 +74,11 @@
SOAP11FaultRoleImpl faultRoleImpl = new SOAP11FaultRoleImpl(this.fault);
faultRoleImpl.setRoleValue(faultActor);
this.fault.setRole(faultRoleImpl);
+
+ /* SOAPFactory soapFactory = DOOMAbstractFactory.getSOAP11Factory();
+ SOAPFaultNode fNode = soapFactory.createSOAPFaultNode(fault);
+ fNode.setNodeValue(faultActor);*/
+
} else {
SOAPFaultRole role = this.fault.getRole();
role.setRoleValue(faultActor);
@@ -115,6 +93,8 @@
return this.fault.getRole().getRoleValue();
}
return null;
+
+// return fault.getNode().getNodeValue();
}
/**
@@ -139,38 +119,11 @@
reason.setSOAPText(text);
}
} else {
- /*SOAPFaultReason fReason = new SOAP11FaultReasonImpl(this.fault);
- SOAPFaultText fText = new SOAP11FaultTextImpl(fReason);
- fText.setText(faultString);
- fReason.setSOAPText(fText);
- this.fault.setReason(fReason);*/
-
org.apache.axis2.soap.SOAPFactory soapFactory = DOOMAbstractFactory.getSOAP11Factory();
SOAPFaultReason fReason = soapFactory.createSOAPFaultReason(fault);
SOAPFaultText fText = soapFactory.createSOAPFaultText(fReason);
fText.setText(faultString);
fReason.setSOAPText(fText);
-
- this.fault.setReason(fReason);
-
- try {
- /* System.err.println("########################## Fault String ######");
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- fReason.serialize(baos);
- String xml2 = new String(baos.toByteArray());
- System.out.println(xml2);
- System.err.println("##########################");*/
-
- System.err.println("########################## Fault -------");
- ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
- fault.serialize(baos2);
- String xml3 = new String(baos2.toByteArray());
- System.out.println(xml3);
- System.err.println("##########################-----------");
-
- } catch (XMLStreamException e) {
- e.printStackTrace();
- }
}
}
@@ -199,7 +152,6 @@
*/
public Detail addDetail() throws SOAPException {
SOAP11FaultDetailImpl omDetail = new SOAP11FaultDetailImpl(this.fault);
- this.fault.setDetail(omDetail);
return new DetailImpl(omDetail);
}
Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java Wed Jan 4 03:14:14 2006
@@ -18,7 +18,7 @@
import org.apache.axis2.om.DOOMAbstractFactory;
import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.impl.dom.DocumentImpl;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
import org.apache.axis2.soap.SOAP11Constants;
import org.apache.axis2.soap.SOAP12Constants;
import org.apache.axis2.soap.SOAPEnvelope;
@@ -27,6 +27,13 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
/**
* Utility class for the Axis2-WSS4J Module
*/
@@ -60,14 +67,14 @@
return envElem.getOwnerDocument();
}
- /**
+ /**
* Create a DOM Document using the org.apache.axis2.soap.SOAPEnvelope
*
* @param env An org.apache.axis2.soap.SOAPEnvelope instance
* @return the org.apache.axis2.soap.impl.dom.SOAPEnvelopeImpl of the given SOAP Envelope
*/
public static org.apache.axis2.soap.impl.dom.SOAPEnvelopeImpl
- toDOOMSOAPEnvelope(org.apache.axis2.soap.SOAPEnvelope env) {
+ toDOOMSOAPEnvelope(org.apache.axis2.soap.SOAPEnvelope env) {
env.build();
//Check the namespace and find SOAP version and factory
@@ -89,16 +96,39 @@
return (org.apache.axis2.soap.impl.dom.SOAPEnvelopeImpl) envelope;
}
- public static SOAPEnvelope getSOAPEnvelopeFromDOOMDocument(DocumentImpl doc) {
+ public static org.apache.axis2.soap.SOAPEnvelope
+ getSOAPEnvelopeFromDOOMDocument(org.w3c.dom.Document doc) {
+
OMElement docElem = (OMElement) doc.getDocumentElement();
- StAXSOAPModelBuilder stAXSOAPModelBuilder = new StAXSOAPModelBuilder(docElem.getXMLStreamReader(), null);
+ StAXSOAPModelBuilder stAXSOAPModelBuilder =
+ new StAXSOAPModelBuilder(docElem.getXMLStreamReader(), null);
return stAXSOAPModelBuilder.getSOAPEnvelope();
}
- public static SOAPEnvelope toOMSOAPEnvelope(Element elem) {
+
+ public static org.apache.axis2.soap.SOAPEnvelope
+ toOMSOAPEnvelope(org.w3c.dom.Element elem) {
+
OMElement docElem = (OMElement) elem;
StAXSOAPModelBuilder stAXSOAPModelBuilder =
new StAXSOAPModelBuilder(docElem.getXMLStreamReader(), null);
return stAXSOAPModelBuilder.getSOAPEnvelope();
+ }
+
+ /**
+ * Convert a given OMElement to a DOM Element
+ *
+ * @param element
+ * @return DOM Element
+ */
+ public static org.w3c.dom.Element toDOM(OMElement element) throws Exception {
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ element.serialize(baos);
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ return factory.newDocumentBuilder().parse(bais).getDocumentElement();
}
}
Added: webservices/axis2/trunk/java/modules/saaj/test-resources/META-INF/services.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test-resources/META-INF/services.xml?rev=365894&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test-resources/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/saaj/test-resources/META-INF/services.xml Wed Jan 4 03:14:14 2006
@@ -0,0 +1,9 @@
+<service name="EchoService">
+ <description>
+ This is a sample Web Service with one operation,echo.
+ </description>
+ <parameter name="ServiceClass" locked="false">org.apache.axis2.saaj.integration.EchoService</parameter>
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ </operation>
+</service>
\ No newline at end of file
Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java Wed Jan 4 03:14:14 2006
@@ -4,20 +4,29 @@
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
-import javax.xml.soap.*;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MessageFactory;
import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;
-import java.io.FileInputStream;
import java.util.Iterator;
-import org.w3c.dom.Document;
-import org.apache.axis2.om.impl.dom.DocumentImpl;
-
public class AttachmentSerializationTest extends TestCase {
+ public static final String MIME_MULTIPART_RELATED = "multipart/related";
+ public static final String MIME_APPLICATION_DIME = "application/dime";
+ public static final String NS_PREFIX = "jaxmtst";
+ public static final String NS_URI = "http://www.jcommerce.net/soap/jaxm/TestJaxm";
+
public AttachmentSerializationTest(String name) {
super(name);
}
@@ -33,17 +42,11 @@
int count = saveMsgWithAttachments(bais);
assertEquals(count, 2);
} catch (Exception e) {
-// throw new Exception("Fault returned from test: " + e);
e.printStackTrace();
fail("Unexpected Exception : " + e);
}
}
- public static final String MIME_MULTIPART_RELATED = "multipart/related";
- public static final String MIME_APPLICATION_DIME = "application/dime";
- public static final String NS_PREFIX = "jaxmtst";
- public static final String NS_URI = "http://www.jcommerce.net/soap/jaxm/TestJaxm";
-
public int saveMsgWithAttachments(OutputStream os) throws Exception {
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage msg = mf.createMessage();
@@ -86,11 +89,13 @@
assertTrue(contentType != null);
for (Iterator iter = msg.getAttachments(); iter.hasNext();) {
- AttachmentPart attachmentPart = (AttachmentPart) iter.next();
+ AttachmentPart attachmentPart = (AttachmentPart) iter.next();
final Object content = attachmentPart.getDataHandler().getContent();
- if(content instanceof String){
+ if (content instanceof String) {
assertEquals(testText, (String) content);
- } else if(content instanceof FileInputStream){
+ } else if (content instanceof FileInputStream) {
+
+ // try to write to a File and check whether it is ok
final FileInputStream fis = (FileInputStream) content;
/*File file = new File("output-file.jpg");
file.createNewFile();
@@ -110,9 +115,11 @@
headers.setHeader("Content-Type", MIME_MULTIPART_RELATED);
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage msg = mf.createMessage(headers, is);
+
SOAPPart sp = msg.getSOAPPart();
- SOAPEnvelope envelope = sp.getEnvelope();
assertTrue(sp != null);
+
+ SOAPEnvelope envelope = sp.getEnvelope();
assertTrue(envelope != null);
return msg.countAttachments();
}
Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java Wed Jan 4 03:14:14 2006
@@ -57,8 +57,8 @@
MessageFactory factory = MessageFactory.newInstance();
SOAPMessage msg = factory.createMessage();
- java.net.URL url1 = new java.net.URL("http://slashdot.org/slashdot.xml");
- java.net.URL url2 = new java.net.URL("http://www.apache.org/LICENSE.txt");
+ java.net.URL url1 = new java.net.URL("http://www.apache.org/licenses/LICENSE-2.0.html");
+ java.net.URL url2 = new java.net.URL("http://www.apache.org/licenses/LICENSE-2.0.txt");
AttachmentPart a1 = msg.createAttachmentPart(new javax.activation.DataHandler(url1));
a1.setContentType("text/xml");
Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/EnvelopeTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/EnvelopeTest.java?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/EnvelopeTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/EnvelopeTest.java Wed Jan 4 03:14:14 2006
@@ -7,6 +7,8 @@
import javax.xml.soap.Name;
import javax.xml.soap.Node;
import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPFault;
@@ -15,8 +17,6 @@
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.soap.Text;
-import javax.xml.soap.SOAPConnectionFactory;
-import javax.xml.soap.SOAPConnection;
import java.io.ByteArrayInputStream;
import java.util.Iterator;
@@ -33,10 +33,10 @@
" </shw:Hello>\n" +
" </soapenv:Header>\n" +
" <soapenv:Body>\n" +
- " <shw:Address shw:t='test' xmlns:shw=\"http://www.jcommerce.net/soap/ns/SOAPHelloWorld\">\n" +
- " <shw:City>GENT</shw:City>\n" +
- " </shw:Address>\n" +
- " </soapenv:Body>\n" +
+ "<shw:Address shw:t='test' xmlns:shw=\"http://www.jcommerce.net/soap/ns/SOAPHelloWorld\">\n" +
+ "<shw:City>GENT</shw:City>\n" +
+ "</shw:Address>\n" +
+ "</soapenv:Body>\n" +
"</soapenv:Envelope>";
public EnvelopeTest(String name) {
@@ -51,6 +51,10 @@
SOAPEnvelope se = sp.getEnvelope();
smsg.writeTo(System.out);
assertTrue(se != null);
+
+ // validate the body
+ final SOAPBody body = sp.getEnvelope().getBody();
+ validateBody(body.getChildElements());
}
public void testEnvelope2() throws Exception {
@@ -245,7 +249,7 @@
SOAPHeaderElement resultHeaderEle = (SOAPHeaderElement) iterator.next();
assertEquals(headerEle.getActor(), resultHeaderEle.getActor());
- assertEquals(resultHeaderEle.getMustUnderstand(),headerEle.getMustUnderstand());
+ assertEquals(resultHeaderEle.getMustUnderstand(), headerEle.getMustUnderstand());
}
assertTrue(cnt == 1);
iterator = header.extractHeaderElements("actor-URI");
@@ -438,4 +442,24 @@
return count;
}
+ private void validateBody(Iterator iter) {
+ while (iter.hasNext()) {
+ final Object obj = iter.next();
+ if (obj instanceof Text) {
+ final String data = ((Text) obj).getData();
+ assertTrue("\n".equals(data) || "GENT".equals(data));
+ } else {
+ final SOAPElement soapElement = (SOAPElement) obj;
+ final Iterator attIter = soapElement.getAllAttributes();
+ while (attIter.hasNext()) {
+ final Object o = attIter.next();
+ assertEquals("test", soapElement.getAttributeValue((Name) o));
+ }
+
+ final Iterator childElementIter = soapElement.getChildElements();
+ if (childElementIter == null) return;
+ validateBody(childElementIter);
+ }
+ }
+ }
}
Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java Wed Jan 4 03:14:14 2006
@@ -18,14 +18,17 @@
import junit.framework.TestCase;
import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPElement;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.Name;
import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
-import javax.xml.soap.MimeHeaders;
-import java.io.ByteArrayOutputStream;
+import javax.xml.soap.Text;
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.Iterator;
public class PrefixesTest extends TestCase {
@@ -39,62 +42,65 @@
SOAPPart sp = msg.getSOAPPart();
SOAPEnvelope se = sp.getEnvelope();
SOAPBody sb = se.getBody();
- SOAPElement el1 = sb.addBodyElement(
- se.createName
- ("element1", "prefix1", "http://www.sun.com"));
- SOAPElement el2 = el1.addChildElement(
- se.createName
- ("element2", "prefix2", "http://www.apache.org"));
+ SOAPElement el1 = sb.addBodyElement(se.createName("element1",
+ "prefix1",
+ "http://www.sun.com"));
+ el1.addChildElement(se.createName("element2",
+ "prefix2",
+ "http://www.apache.org"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
msg.writeTo(baos);
String xml = new String(baos.toByteArray());
+
+ System.out.println("########## xml = " + xml);
assertTrue(xml.indexOf("prefix1") != -1);
assertTrue(xml.indexOf("prefix2") != -1);
assertTrue(xml.indexOf("http://www.sun.com") != -1);
assertTrue(xml.indexOf("http://www.apache.org") != -1);
}
- public void testAttribute() throws Exception {
- /* String soappacket = "<SOAP-ENV:Envelope xmlns:SOAP-ENV =\"http://schemas.xmlsoap.org/soap/envelope/\"" +
- "xmlns:xsi =\"http://www.w3.org/1999/XMLSchema-instance\"" +
- "xmlns:xsd =\"http://www.w3.org/1999/XMLSchema\">" +
- "<SOAP-ENV:Body>" +
-// "<t:helloworld t:name=\"tester\" xmlns:t='http://test.org/Test' />" +
- "</SOAP-ENV:Body>" +
- "</SOAP-ENV:Envelope>";*/
-// System.err.println(soappacket);
-
- final String soappacket =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n" +
- " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" +
- " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
- " <soapenv:Header>\n" +
- " <shw:Hello xmlns:shw=\"http://www.jcommerce.net/soap/ns/SOAPHelloWorld\">\n" +
- " <shw:Myname>Tony</shw:Myname>\n" +
- " </shw:Hello>\n" +
- " </soapenv:Header>\n" +
- " <soapenv:Body>\n" +
- " <shw:Address xmlns:shw=\"http://www.jcommerce.net/soap/ns/SOAPHelloWorld\" shw:t='test' >\n" +
- " <shw:City>GENT</shw:City>\n" +
- " </shw:Address>\n" +
- " </soapenv:Body>\n" +
- "</soapenv:Envelope>";
-
- SOAPMessage msg = MessageFactory.newInstance().createMessage(new MimeHeaders(),
- new ByteArrayInputStream(soappacket.getBytes()));
+ public void testAttribute() throws Exception {
+ String soappacket =
+ "<soapenv:Envelope xmlns:soapenv =\"http://schemas.xmlsoap.org/soap/envelope/\"\n" +
+ " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" +
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
+ " <soapenv:Body>\n" +
+ " <t:helloworld t:name=\"test\" xmlns:t='http://test.org/Test' />\n" +
+ " </soapenv:Body>\n" +
+ "</soapenv:Envelope>";
+
+ SOAPMessage msg =
+ MessageFactory.newInstance().createMessage(new MimeHeaders(),
+ new ByteArrayInputStream(soappacket.getBytes()));
SOAPBody body = msg.getSOAPPart().getEnvelope().getBody();
msg.writeTo(System.out);
- SOAPElement ele = (SOAPElement) body.getChildElements().next();
- java.util.Iterator attit = ele.getAllAttributes();
-
- System.out.println(attit.next().getClass());
-
- javax.xml.soap.Name n = (javax.xml.soap.Name) attit.next();
- //assertEquals("Test fail prefix problem",n.getQualifiedName(),"name");
+ validateBody(body.getChildElements());
}
+ private void validateBody(Iterator iter) {
+ while (iter.hasNext()) {
+ final Object obj = iter.next();
+ if (obj instanceof Text) {
+ System.out.println("\n- Text Ignored.");
+ } else {
+ final SOAPElement soapElement = (SOAPElement) obj;
+ final Iterator attIter = soapElement.getAllAttributes();
+ while (attIter.hasNext()) {
+ final Name name = (Name) attIter.next();
+ assertEquals("test", soapElement.getAttributeValue(name));
+ assertEquals("t", name.getPrefix());
+ assertEquals("t:name", name.getQualifiedName());
+ assertEquals("name", name.getLocalName());
+ assertEquals("http://test.org/Test", name.getURI());
+ }
+
+ final Iterator childElementIter = soapElement.getChildElements();
+ if (childElementIter == null) return;
+ validateBody(childElementIter);
+ }
+ }
+ }
}
Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java Wed Jan 4 03:14:14 2006
@@ -57,15 +57,4 @@
}
assertTrue(d != null);
}
-
- /**
- * Main
- */
- public static void main(String[] args)
- throws Exception
- {
- SOAPFaultDetailTest detailTest = new SOAPFaultDetailTest("faultdetails");
- detailTest.testDetails();
- }
-
}
Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultsTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultsTest.java?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultsTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultsTest.java Wed Jan 4 03:14:14 2006
@@ -2,42 +2,62 @@
import junit.framework.TestCase;
-import javax.xml.soap.*;
+import javax.xml.soap.Detail;
+import javax.xml.soap.DetailEntry;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPFault;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
import java.io.ByteArrayOutputStream;
+import java.util.Iterator;
public class SOAPFaultsTest extends TestCase {
-
- public SOAPFaultsTest(String name){
- super(name);
- }
-
- //Create SOAPFault with additional detail elements
- public void testAdditionDetail() throws Exception{
- String xml ="<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:cwmp=\"http://cwmp.com\">\n" +
- " <soapenv:Header>\n" +
- " <cwmp:ID soapenv:mustUnderstand=\"1\">HEADERID-7867678</cwmp:ID>\n" +
- " </soapenv:Header>\n" +
- " <soapenv:Body>\n" +
- " <soapenv:Fault>\n" +
- " <faultcode>soapenv:Client</faultcode>\n" +
- " <faultstring>CWMP fault</faultstring>\n" +
- " <detail>\n" +
- " <cwmp:Fault>\n" +
- " <cwmp:FaultCode>This is the fault code</cwmp:FaultCode>\n" +
- " <cwmp:FaultString>Fault Message</cwmp:FaultString>\n" +
- " </cwmp:Fault>\n" +
- " </detail>\n" +
- " </soapenv:Fault>\n" +
- " </soapenv:Body>\n" +
- "</soapenv:Envelope>";
-
+
+ public SOAPFaultsTest(String name) {
+ super(name);
+ }
+
+ public void testSOAPFaultWithDetails() throws Exception {
+ /* We are trying to generate the following SOAPFault
+
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cwmp="http://cwmp.com">
+ <soapenv:Header>
+ <cwmp:ID soapenv:mustUnderstand="1">HEADERID-7867678</cwmp:ID>
+ </soapenv:Header>
+ <soapenv:Body>
+ <soapenv:Fault>
+ <faultcode>Client</faultcode>
+ <faultstring>CWMP fault</faultstring>
+ <faultactor>http://gizmos.com/order</faultactor>
+ <detail>
+ <cwmp:Fault>
+ <cwmp:FaultCode>This is the fault code</cwmp:FaultCode>
+ <cwmp:FaultString>Fault Message</cwmp:FaultString>
+ <cwmp:Message>This is a test fault</cwmp:FaultString>
+ </cwmp:Fault>
+ </detail>
+ </soapenv:Fault>
+ </soapenv:Body>
+ </soapenv:Envelope>
+
+ */
+
MessageFactory fac = MessageFactory.newInstance();
- SOAPMessage faultMessage = fac.createMessage();
-
+
//Create the response to the message
- faultMessage = fac.createMessage();
- SOAPPart part = faultMessage.getSOAPPart();
- SOAPEnvelope envelope = part.getEnvelope();
+ SOAPMessage soapMessage = fac.createMessage();
+ SOAPPart soapPart = soapMessage.getSOAPPart();
+ SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("cwmp", "http://cwmp.com");
SOAPBody body = envelope.getBody();
SOAPHeader header = envelope.getHeader();
@@ -45,108 +65,138 @@
SOAPHeaderElement id = header.addHeaderElement(idName);
id.setMustUnderstand(true);
id.addTextNode("HEADERID-7867678");
-
+
//Create the SOAPFault object
SOAPFault fault = body.addFault();
fault.setFaultCode("Client");
fault.setFaultString("CWMP fault");
-
+ fault.setFaultActor("http://gizmos.com/order");
+
+ assertEquals("Client", fault.getFaultCode());
+ assertEquals("CWMP fault", fault.getFaultString());
+ assertEquals("http://gizmos.com/order", fault.getFaultActor());
+
//Add Fault Detail information
Detail faultDetail = fault.addDetail();
- Name cwmpFaultName = envelope.createName("Fault", "cwmp",
- "http://cwmp.com");
- DetailEntry cwmpFaultDetail =
- faultDetail.addDetailEntry(cwmpFaultName);
- SOAPElement e = cwmpFaultDetail.addChildElement("FaultCode");
-
+ Name cwmpFaultName = envelope.createName("Fault", "cwmp", "http://cwmp.com");
+ DetailEntry faultDetailEntry = faultDetail.addDetailEntry(cwmpFaultName);
+ SOAPElement e = faultDetailEntry.addChildElement("FaultCode");
+
e.addTextNode("This is the fault code");
- SOAPElement e2 = cwmpFaultDetail.addChildElement(envelope.createName("FaultString", "cwmp", "http://cwmp.com"));
+ SOAPElement e2 = faultDetailEntry.addChildElement(envelope.createName("FaultString",
+ "cwmp",
+ "http://cwmp.com"));
e2.addTextNode("Fault Message");
- faultMessage.saveChanges();
-
+
+ SOAPElement e3 = faultDetailEntry.addChildElement("Message");
+ e3.addTextNode("This is a test fault");
+
+ soapMessage.saveChanges();
+
+ // ------------------- Validate the contents -------------------------------------
+ final Detail detail = fault.getDetail();
+ final Iterator detailEntryIter = detail.getDetailEntries();
+ boolean foundFirst = false;
+ boolean foundSecond = false;
+ boolean foundThird = false;
+ while (detailEntryIter.hasNext()) {
+ final DetailEntry detailEntry = (DetailEntry) detailEntryIter.next();
+ final Iterator childElementsIter = detailEntry.getChildElements();
+ while (childElementsIter.hasNext()) {
+ final SOAPElement soapElement = (SOAPElement) childElementsIter.next();
+ if (soapElement.getTagName().equals("FaultCode") &&
+ soapElement.getValue().equals("This is the fault code")) {
+ foundFirst = true;
+ }
+ if (soapElement.getTagName().equals("FaultString") &&
+ soapElement.getValue().equals("Fault Message")) {
+ foundSecond = true;
+ }
+ if (soapElement.getTagName().equals("Message") &&
+ soapElement.getValue().equals("This is a test fault")) {
+ foundThird = true;
+ }
+ }
+ }
+ assertTrue(foundFirst && foundSecond && foundThird);
+ // ------------------------------------------------------------------------------
+
+ // Test whether the fault is being serialized properly
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- faultMessage.writeTo(baos);
- String xml2 = new String(baos.toByteArray());
- faultMessage.writeTo(System.out);
- //assertXMLEqual(xml,xml2);
- }
-
- public void testQuick() throws Exception {
- MessageFactory msgfactory = MessageFactory.newInstance();
- SOAPFactory factory = SOAPFactory.newInstance();
- SOAPMessage outputmsg = msgfactory.createMessage();
- String valueCode = "faultcode";
- String valueString = "faultString";
- SOAPFault fault = outputmsg.getSOAPPart().getEnvelope().getBody().addFault();
- fault.setFaultCode(valueCode);
- fault.setFaultString(valueString);
- Detail d;
- d = fault.addDetail();
- d.addDetailEntry(factory.createName("Hello"));
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- if (outputmsg != null) {
- if (outputmsg.saveRequired()) {
- outputmsg.saveChanges();
- }
- outputmsg.writeTo(baos);
- }
- String xml = new String(baos.toByteArray());
- assertTrue(xml.indexOf("Hello")!=-1);
- }
-
- public void testSOAPFaultSaveChanges() throws Exception {
- MessageFactory msgFactory =
- MessageFactory.newInstance();
- SOAPMessage msg = msgFactory.createMessage();
- SOAPEnvelope envelope =
- msg.getSOAPPart().getEnvelope();
- SOAPBody body = envelope.getBody();
- SOAPFault fault = body.addFault();
-
- fault.setFaultCode("Client");
- fault.setFaultString(
- "Message does not have necessary info");
- fault.setFaultActor("http://gizmos.com/order");
-
- Detail detail = fault.addDetail();
-
- Name entryName = envelope.createName("order", "PO",
- "http://gizmos.com/orders/");
- DetailEntry entry = detail.addDetailEntry(entryName);
- entry.addTextNode("quantity element does not have a value");
-
- Name entryName2 = envelope.createName("confirmation",
- "PO", "http://gizmos.com/confirm");
- DetailEntry entry2 = detail.addDetailEntry(entryName2);
- entry2.addTextNode("Incomplete address: no zip code");
-
- msg.saveChanges();
-
+ soapMessage.writeTo(baos);
+ String xml = new String(baos.toByteArray());
+
+ System.out.println(xml);
+ assertTrue(xml.indexOf("<faultcode>Client</faultcode>") != -1);
+ assertTrue(xml.indexOf("<faultstring>CWMP fault</faultstring>") != -1);
+ assertTrue(xml.indexOf("<faultactor>http://gizmos.com/order</faultactor>") != -1);
+ }
+
+ public void testQuick() throws Exception {
+ MessageFactory msgfactory = MessageFactory.newInstance();
+ SOAPFactory factory = SOAPFactory.newInstance();
+ SOAPMessage outputmsg = msgfactory.createMessage();
+ String valueCode = "faultcode";
+ String valueString = "faultString";
+ SOAPFault fault = outputmsg.getSOAPPart().getEnvelope().getBody().addFault();
+ fault.setFaultCode(valueCode);
+ fault.setFaultString(valueString);
+ Detail detail = fault.addDetail();
+ detail.addDetailEntry(factory.createName("Hello"));
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ if (outputmsg.saveRequired()) {
+ outputmsg.saveChanges();
+ }
+ outputmsg.writeTo(baos);
+ String xml = new String(baos.toByteArray());
+ assertTrue(xml.indexOf("Hello") != -1);
+ }
+
+ public void testSOAPFaultSaveChanges() throws Exception {
+ MessageFactory msgFactory = MessageFactory.newInstance();
+ SOAPMessage msg = msgFactory.createMessage();
+ SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
+ SOAPBody body = envelope.getBody();
+ SOAPFault fault = body.addFault();
+
+ fault.setFaultCode("Client");
+ fault.setFaultString("Message does not have necessary info");
+ fault.setFaultActor("http://gizmos.com/order");
+
+ Detail detail = fault.addDetail();
+
+ Name entryName = envelope.createName("order", "PO", "http://gizmos.com/orders/");
+ DetailEntry entry = detail.addDetailEntry(entryName);
+ entry.addTextNode("quantity element does not have a value");
+
+ Name entryName2 = envelope.createName("confirmation", "PO", "http://gizmos.com/confirm");
+ DetailEntry entry2 = detail.addDetailEntry(entryName2);
+ entry2.addTextNode("Incomplete address: no zip code");
+
+ msg.saveChanges();
+
// Now retrieve the SOAPFault object and its contents
//after checking to see that there is one
- if (body.hasFault()) {
- fault = body.getFault();
- String code = fault.getFaultCode();
- String string = fault.getFaultString();
- String actor = fault.getFaultActor();
+ assertTrue(body.hasFault());
+ fault = body.getFault();
+ String code = fault.getFaultCode();
+ String string = fault.getFaultString();
+ String actor = fault.getFaultActor();
- detail = fault.getDetail();
- if (detail != null) {
- java.util.Iterator it = detail.getDetailEntries();
- while (it.hasNext()) {
- entry = (DetailEntry) it.next();
- String value = entry.getValue();
- }
+ assertEquals("Client", code);
+ assertEquals("Message does not have necessary info", string);
+ assertEquals("http://gizmos.com/order", actor);
+
+
+ detail = fault.getDetail();
+ if (detail != null) {
+ java.util.Iterator it = detail.getDetailEntries();
+ while (it.hasNext()) {
+ entry = (DetailEntry) it.next();
+ String value = entry.getValue();
}
}
- }
-
- public static void main(String[] args) throws Exception {
- SOAPFaultsTest detailTest = new SOAPFaultsTest("TestSOAPFaults");
- detailTest.testQuick();
- detailTest.testAdditionDetail();
- detailTest.testSOAPFaultSaveChanges();
}
}
Added: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/EchoService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/EchoService.java?rev=365894&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/EchoService.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/EchoService.java Wed Jan 4 03:14:14 2006
@@ -0,0 +1,36 @@
+/*
+ * 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.saaj.integration;
+
+import org.apache.axis2.om.OMElement;
+
+import javax.xml.stream.XMLStreamException;
+
+/**
+ *
+ */
+public class EchoService {
+ public OMElement echo(OMElement element) throws XMLStreamException {
+ //Praparing the OMElement so that it can be attached to another OM Tree.
+ //First the OMElement should be completely build in case it is not fully built and still
+ //some of the xml is in the stream.
+ element.build();
+ //Secondly the OMElement should be detached from the current OMTree so that it can be attached
+ //some other OM Tree. Once detached the OmTree will remove its connections to this OMElement.
+ element.detach();
+ return element;
+ }
+}
Added: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java?rev=365894&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java Wed Jan 4 03:14:14 2006
@@ -0,0 +1,162 @@
+package org.apache.axis2.saaj.integration;
+
+import junit.framework.TestCase;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.util.Utils;
+
+import javax.activation.DataHandler;
+import javax.activation.FileDataSource;
+import javax.xml.namespace.QName;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+
+public class IntegrationTest extends TestCase {
+
+ private AxisService service;
+
+ public static final EndpointReference TARGET_EPR =
+ new EndpointReference("http://127.0.0.1:" +
+ (UtilServer.TESTING_PORT)
+ + "/axis2/services/EchoService/echo");
+
+ public static final QName SERVICE_NAME = new QName("EchoService");
+ public static final QName OPERATION_NAME = new QName("echo");
+
+ public IntegrationTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ /* UtilServer.start(Constants.TESTING_PATH + "saaj-repo");
+ service = Utils.createSimpleService(SERVICE_NAME,
+ EchoService.class.getName(),
+ OPERATION_NAME);
+ UtilServer.deployService(service);*/
+ }
+
+ protected void tearDown() throws Exception {
+ /* UtilServer.unDeployService(SERVICE_NAME);
+ UtilServer.stop();
+ UtilServer.unDeployClientService();*/
+ }
+
+ public void testOK(){
+
+ }
+
+ public void _testSendReceiveSimpleSOAPMessage() {
+ try {
+ MessageFactory mf = MessageFactory.newInstance();
+ SOAPMessage request = mf.createMessage();
+
+ createSimpleSOAPPart(request);
+
+ SOAPConnection sCon = SOAPConnectionFactory.newInstance().createConnection();
+ SOAPMessage response = sCon.call(request, "http://localhost:8081/axis2/services/Echo"); //TODO: change this service
+ assertFalse(response.getAttachments().hasNext());
+ assertEquals(0, response.countAttachments());
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ response.writeTo(baos);
+
+ System.out.println(new String(baos.toByteArray()));
+ } catch (SOAPException e) {
+ fail("Unexpected Exception while running test");
+ } catch (IOException e) {
+ fail("Unexpected Exception while running test");
+ }
+ }
+
+ public void _testSendReceiveMessageWithAttachment() throws Exception {
+ MessageFactory mf = MessageFactory.newInstance();
+ SOAPMessage message = mf.createMessage();
+
+ //create the SOAPPart
+ createSOAPPart(message);
+
+ //Attach a text/plain object with the SOAP message
+ String sampleMessage = "Sample Message: Hello World!";
+ AttachmentPart textAttach = message.createAttachmentPart(sampleMessage, "text/plain");
+ textAttach.addMimeHeader("Content-Transfer-Encoding", "binary");
+ textAttach.setContentId("submitSampleText@apache.org");
+ message.addAttachmentPart(textAttach);
+
+ //Attach a java.awt.Image object to the SOAP message
+ String jpgfilename = "./test-resources/axis.jpg";
+ File myfile = new File(jpgfilename);
+ FileDataSource fds = new FileDataSource(myfile);
+ DataHandler imageDH = new DataHandler(fds);
+ AttachmentPart jpegAttach = message.createAttachmentPart(imageDH);
+ jpegAttach.addMimeHeader("Content-Transfer-Encoding", "binary");
+ jpegAttach.setContentId("submitSampleImage@apache.org");
+ jpegAttach.setContentType("image/jpg");
+ message.addAttachmentPart(jpegAttach);
+
+ SOAPConnection sCon = SOAPConnectionFactory.newInstance().createConnection();
+
+ SOAPMessage sMsg = sCon.call(message, "http://localhost:8081/axis2/services/Echo");
+ int attachmentCount = sMsg.countAttachments();
+ assertTrue(attachmentCount == 2);
+
+// Iterator attachIter = sMsg.getAttachments();
+
+ //Of the two attachments first should be of type text/plain and
+ //second of content-type image/jpeg
+
+ //Underlying MTOM is converting all contentTypes to application/octet-stream
+ //Thats something to be fixed, I guess. Till then commenting out
+ //these two asserts
+ /*
+ AttachmentPart ap1 = (AttachmentPart)attachIter.next();
+ assertTrue(ap1.getContentType().equals("text/plain"));
+ AttachmentPart ap2 = (AttachmentPart)attachIter.next();
+ assertTrue(ap2.getContentType().equals("image/jpeg"));
+ */
+ }
+
+ public void addAttachments() {
+
+ }
+
+ private void createSOAPPart(SOAPMessage message) throws SOAPException {
+ SOAPPart sPart = message.getSOAPPart();
+ SOAPEnvelope env = sPart.getEnvelope();
+ SOAPBody body = env.getBody();
+
+ Name ns = env.createName("echo", "swa", "http://fakeNamespace.org");
+ SOAPBodyElement bodyElement = body.addBodyElement(ns);
+
+ Name ns2 = env.createName("text");
+ SOAPElement textReference = bodyElement.addChildElement(ns2);
+ Name hrefAttr = env.createName("href");
+ textReference.addAttribute(hrefAttr, "cid:submitSampleText@apache.org");
+
+ Name ns3 = env.createName("image");
+ SOAPElement imageReference = bodyElement.addChildElement(ns3);
+ imageReference.addAttribute(hrefAttr, "cid:submitSampleImage@apache.org");
+ }
+
+ private void createSimpleSOAPPart(SOAPMessage message) throws SOAPException {
+ SOAPPart sPart = message.getSOAPPart();
+ SOAPEnvelope env = sPart.getEnvelope();
+ SOAPBody body = env.getBody();
+
+ Name ns = env.createName("echo", "swa", "http://fakeNamespace.org");
+ body.addBodyElement(ns);
+ }
+}
Added: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java?rev=365894&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java Wed Jan 4 03:14:14 2006
@@ -0,0 +1,171 @@
+/*
+ * 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.saaj.integration;
+
+import junit.framework.TestCase;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.deployment.DeploymentEngine;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.ModuleDescription;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+
+import javax.xml.namespace.QName;
+import java.io.File;
+
+/**
+ *
+ */
+public class UtilServer {
+ private static int count = 0;
+
+ private static SimpleHTTPServer receiver;
+
+ public static final int TESTING_PORT = 5555;
+
+ private static final String FAILURE_MESSAGE = "Intentional Failure";
+
+ public static synchronized void deployService(AxisService service) throws AxisFault {
+ receiver.getConfigurationContext().getAxisConfiguration().addService(service);
+ }
+
+ public static synchronized void unDeployService(QName service) throws AxisFault {
+ receiver.getConfigurationContext().getAxisConfiguration().
+ removeService(service.getLocalPart());
+ }
+
+ public static synchronized void unDeployClientService() throws AxisFault {
+ if (receiver.getConfigurationContext().getAxisConfiguration() != null) {
+ receiver.getConfigurationContext().getAxisConfiguration()
+ .removeService("AnonymousService");
+ }
+ }
+
+ public static synchronized void start() throws Exception {
+ start(org.apache.axis2.Constants.TESTING_REPOSITORY);
+ }
+
+ public static synchronized void start(String repository) throws Exception {
+ if (count == 0) {
+ ConfigurationContext er = getNewConfigurationContext(repository);
+
+ receiver = new SimpleHTTPServer(er, TESTING_PORT);
+
+ receiver.start();
+ System.out.print("Server started on port " + TESTING_PORT + ".....");
+
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e1) {
+ throw new AxisFault("Thread interupted", e1);
+ }
+
+ }
+ count++;
+ }
+
+ public static ConfigurationContext getNewConfigurationContext(String repository)
+ throws Exception {
+ ConfigurationContextFactory erfac = new ConfigurationContextFactory();
+ File file = new File(repository);
+ if (!file.exists()) {
+ throw new Exception("repository directory "
+ + file.getAbsolutePath() + " does not exists");
+ }
+ return erfac.buildConfigurationContext(file.getAbsolutePath());
+ }
+
+ public static synchronized void stop() {
+ if (count == 1) {
+ receiver.stop();
+ while (receiver.isRunning()) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ }
+ }
+ count = 0;
+ // tp.doStop();
+ System.out.print("Server stopped .....");
+ } else {
+ count--;
+ }
+ }
+
+ public static ConfigurationContext getConfigurationContext() {
+ return receiver.getConfigurationContext();
+ }
+
+ public static ServiceContext createAdressedEnabledClientSide(
+ AxisService service) throws AxisFault {
+ DeploymentEngine deploymentEngine = new DeploymentEngine();
+ File file = new File(org.apache.axis2.Constants.TESTING_REPOSITORY
+ + "/modules/addressing.mar");
+ TestCase.assertTrue(file.exists());
+
+ ConfigurationContextFactory efac = new ConfigurationContextFactory();
+ ConfigurationContext configContext = efac
+ .buildConfigurationContext("target/test-resources/integrationRepo");
+ ModuleDescription moduleDesc = deploymentEngine.buildModule(file,
+ configContext.getAxisConfiguration());
+ configContext.getAxisConfiguration().addModule(moduleDesc);
+
+ configContext.getAxisConfiguration().addService(service);
+
+ return new ServiceGroupContext(configContext, service.getParent())
+ .getServiceContext(service);
+ }
+
+ public static ConfigurationContext createClientConfigurationContext() throws AxisFault {
+ File file = new File(org.apache.axis2.Constants.TESTING_REPOSITORY
+ + "/modules/addressing.mar");
+ TestCase.assertTrue(file.exists());
+ DeploymentEngine deploymentEngine = new DeploymentEngine();
+
+ ConfigurationContextFactory efac = new ConfigurationContextFactory();
+ ConfigurationContext configContext = efac .buildConfigurationContext("target/test-resources/integrationRepo");
+ ModuleDescription moduleDesc = deploymentEngine.buildModule(file,
+ configContext.getAxisConfiguration());
+ configContext.getAxisConfiguration().addModule(moduleDesc);
+ configContext.getAxisConfiguration().engageModule(new QName("addressing"));
+ return configContext;
+ }
+
+ public static ServiceContext createAdressedEnabledClientSide(
+ AxisService service, String clientHome) throws AxisFault {
+ DeploymentEngine deploymentEngine = new DeploymentEngine();
+ File file = new File(org.apache.axis2.Constants.TESTING_REPOSITORY
+ + "/modules/addressing.mar");
+ TestCase.assertTrue(file.exists());
+
+ ConfigurationContextFactory efac = new ConfigurationContextFactory();
+ ConfigurationContext configContext = efac
+ .buildConfigurationContext(clientHome);
+ ModuleDescription moduleDesc = deploymentEngine.buildModule(file,
+ configContext.getAxisConfiguration());
+
+ configContext.getAxisConfiguration().addModule(moduleDesc);
+ // sysContext.getAxisConfiguration().engageModule(moduleDesc.getName());
+
+ configContext.getAxisConfiguration().addService(service);
+
+ return new ServiceGroupContext(configContext, service.getParent())
+ .getServiceContext(service);
+ }
+}
Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMAbstractFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMAbstractFactory.java?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMAbstractFactory.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMAbstractFactory.java Wed Jan 4 03:14:14 2006
@@ -23,6 +23,7 @@
public static final String OM_FACTORY_NAME_PROPERTY = "om.factory";
public static final String SOAP11_FACTORY_NAME_PROPERTY = "soap11.factory";
public static final String SOAP12_FACTORY_NAME_PROPERTY = "soap12.factory";
+ public static final String SOAP_FACTORY_NAME_PROPERTY = "soap.factory";
/**
* Eran Chinthaka (chinthaka@apache.org)
*/
Added: webservices/axis2/trunk/java/xdocs/sec-conf/in-sample.png
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/sec-conf/in-sample.png?rev=365894&view=auto
==============================================================================
Binary file - no diff available.
Propchange: webservices/axis2/trunk/java/xdocs/sec-conf/in-sample.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: webservices/axis2/trunk/java/xdocs/sec-conf/out-sample.png
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/sec-conf/out-sample.png?rev=365894&view=auto
==============================================================================
Binary file - no diff available.
Propchange: webservices/axis2/trunk/java/xdocs/sec-conf/out-sample.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: webservices/axis2/trunk/java/xdocs/sec-conf/out-sample2.png
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/sec-conf/out-sample2.png?rev=365894&view=auto
==============================================================================
Binary file - no diff available.
Propchange: webservices/axis2/trunk/java/xdocs/sec-conf/out-sample2.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: webservices/axis2/trunk/java/xdocs/security-module.html
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/security-module.html?rev=365894&r1=365893&r2=365894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/xdocs/security-module.html (original)
+++ webservices/axis2/trunk/java/xdocs/security-module.html Wed Jan 4 03:14:14 2006
@@ -157,22 +157,13 @@
<p><b>Examples</b></p>
<p id="ex1">Example 1: An outflow configuration to add a timestamp, sing and encrypt
the message once</p>
-<p><iframe frameborder="0"
-src ="sec-conf/out-sample.xml"
-width="800" height="400">
-</iframe>
+<p><img src="sec-conf/out-sample.png"/>
</p>
<p id="ex2">Example 2: An outflow configuration to sign the message twice and add a timestamp</p>
-<p><iframe frameborder="0"
-src ="sec-conf/out-sample2.xml"
-width="800" height="400">
-</iframe>
+<p><img src="sec-conf/out-sample2.png"/>
</p>
<p id="ex3">Example 3: An inflow configuration to decrypt, verify signature and validate timestamp</p>
-<p><iframe frameborder="0"
-src ="sec-conf/in-sample.xml"
-width="800" height="400">
-</iframe>
+<p><img src="sec-conf/in-sample.png"/>
</p>
</body></html>