|
From: <cy...@us...> - 2003-06-10 02:38:46
|
Update of /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/message/packaging
In directory sc8-pr-cvs1:/tmp/cvs-serv2624
Modified Files:
BodyElement.java ExtensionElementImpl.java
HeaderContainer.java HeaderElement.java Manifest.java
PayloadContainer.java Reference.java
Log Message:
Significant commit: change the implementation of how SOAPHeaderElement and
SOAPBodyElement are added to SOAPMessage. Now, the packaging codes should
work for both JAXM and Axis (except digital signature).
Index: BodyElement.java
===================================================================
RCS file: /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/message/packaging/BodyElement.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** BodyElement.java 9 Apr 2003 07:48:18 -0000 1.5
--- BodyElement.java 10 Jun 2003 02:22:48 -0000 1.6
***************
*** 90,94 ****
BodyElement(SOAPEnvelope soapEnvelope, String localName)
throws SOAPException {
! super(soapEnvelope, localName);
addAttribute(ATTRIBUTE_VERSION, VERSION);
}
--- 90,94 ----
BodyElement(SOAPEnvelope soapEnvelope, String localName)
throws SOAPException {
! super(soapEnvelope, localName, false);
addAttribute(ATTRIBUTE_VERSION, VERSION);
}
Index: ExtensionElementImpl.java
===================================================================
RCS file: /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/message/packaging/ExtensionElementImpl.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ExtensionElementImpl.java 9 Apr 2003 07:48:21 -0000 1.7
--- ExtensionElementImpl.java 10 Jun 2003 02:22:48 -0000 1.8
***************
*** 120,126 ****
Specification
*/
! ExtensionElementImpl(SOAPEnvelope soapEnvelope, String localName)
throws SOAPException {
! this(soapEnvelope, localName, NAMESPACE_PREFIX_EB, NAMESPACE_URI_EB);
}
--- 120,128 ----
Specification
*/
! ExtensionElementImpl(SOAPEnvelope soapEnvelope, String localName,
! boolean isHeaderElement)
throws SOAPException {
! this(soapEnvelope, localName, NAMESPACE_PREFIX_EB, NAMESPACE_URI_EB,
! isHeaderElement);
}
***************
*** 132,140 ****
*/
ExtensionElementImpl(SOAPEnvelope soapEnvelope, String localName,
! String prefix, String uri)
throws SOAPException {
soapElement = SOAPFactory.newInstance().
createElement(localName, prefix, uri);
this.soapEnvelope = soapEnvelope;
namespacePrefix = prefix;
namespaceUri = uri;
--- 134,156 ----
*/
ExtensionElementImpl(SOAPEnvelope soapEnvelope, String localName,
! String prefix, String uri, boolean isHeaderElement)
throws SOAPException {
+ /*
soapElement = SOAPFactory.newInstance().
createElement(localName, prefix, uri);
+ */
this.soapEnvelope = soapEnvelope;
+ Name name = soapEnvelope.createName(localName, prefix, uri);
+ if (isHeaderElement) {
+ soapElement = soapEnvelope.getHeader().addHeaderElement(name);
+ if (uri.equals(NAMESPACE_URI_EB)) {
+ ((SOAPHeaderElement) soapElement).
+ setMustUnderstand(HeaderElement.MUST_UNDERSTAND);
+ ((SOAPHeaderElement) soapElement).setActor(null);
+ }
+ }
+ else {
+ soapElement = soapEnvelope.getBody().addBodyElement(name);
+ }
namespacePrefix = prefix;
namespaceUri = uri;
***************
*** 275,278 ****
--- 291,302 ----
name.getPrefix().equals(soapElement.getElementName().getPrefix())
== false) {
+ for (Iterator i=soapEnvelope.getNamespacePrefixes() ;
+ i.hasNext() ; ) {
+ String prefix = (String) i.next();
+ String uri = soapEnvelope.getNamespaceURI(prefix);
+ if (uri.equals(name.getURI())) {
+ soapEnvelope.removeNamespaceDeclaration(prefix);
+ }
+ }
soapEnvelope.addNamespaceDeclaration(name.getPrefix(),
name.getURI());
***************
*** 347,351 ****
final Name childName = child.getElementName();
if (childName.getLocalName().equals(name.getLocalName()) &&
- childName.getPrefix().equals(name.getPrefix()) &&
childName.getURI().equals(name.getURI())) {
childElements.add(child);
--- 371,374 ----
Index: HeaderContainer.java
===================================================================
RCS file: /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/message/packaging/HeaderContainer.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** HeaderContainer.java 15 Apr 2003 02:05:43 -0000 1.9
--- HeaderContainer.java 10 Jun 2003 02:22:48 -0000 1.10
***************
*** 126,129 ****
--- 126,140 ----
messageHeader = null;
+ for (Iterator i=soapEnvelope.getNamespacePrefixes() ;
+ i.hasNext() ; ) {
+ String prefix = (String) i.next();
+ String uri = soapEnvelope.getNamespaceURI(prefix);
+ if (uri.equals(ExtensionElement.NAMESPACE_URI_SOAP_ENVELOPE)) {
+ soapEnvelope.removeNamespaceDeclaration(prefix);
+ }
+ }
+ soapEnvelope.addNamespaceDeclaration
+ (ExtensionElement.NAMESPACE_PREFIX_SOAP_ENVELOPE,
+ ExtensionElement.NAMESPACE_URI_SOAP_ENVELOPE);
// Add soap envelope schema location
soapEnvelope.addNamespaceDeclaration(
***************
*** 296,306 ****
--- 307,320 ----
throws SOAPException {
if (extensionElement instanceof HeaderElement) {
+ /*
final SOAPHeader soapHeader;
soapHeader = soapEnvelope.getHeader();
soapHeader.addChildElement(extensionElement.getSOAPElement());
extensionElement.synchronizeWithParent(soapHeader, 0);
+ */
if (extensionElement instanceof MessageHeader) {
if (messageHeader == null) {
messageHeader = (MessageHeader) extensionElement;
+ /*
final SOAPElement parent =
messageHeader.getSOAPElement();
***************
*** 311,314 ****
--- 325,329 ----
synchronizeWithParent(parent, 0);
}
+ */
}
else {
***************
*** 325,328 ****
--- 340,344 ----
Signature signature = (Signature) extensionElement;
signatures.add(signature);
+ /*
SOAPElement parent = signature.getSOAPElement();
int count = 0;
***************
*** 332,335 ****
--- 348,352 ----
count++;
}
+ */
}
else if (extensionElement instanceof AckRequested) {
***************
*** 412,421 ****
--- 429,441 ----
}
else if (extensionElement instanceof BodyElement) {
+ /*
final SOAPBody soapBody = soapEnvelope.getBody();
soapBody.addChildElement(extensionElement.getSOAPElement());
extensionElement.synchronizeWithParent(soapBody, 0);
+ */
if (extensionElement instanceof Manifest) {
if (manifest == null) {
manifest = (Manifest) extensionElement;
+ /*
final SOAPElement parent = manifest.getSOAPElement();
int count = 0;
***************
*** 425,428 ****
--- 445,449 ----
count++;
}
+ */
}
else {
Index: HeaderElement.java
===================================================================
RCS file: /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/message/packaging/HeaderElement.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** HeaderElement.java 9 Apr 2003 07:48:24 -0000 1.4
--- HeaderElement.java 10 Jun 2003 02:22:48 -0000 1.5
***************
*** 93,97 ****
"http://schemas.xmlsoap.org/soap/actor/next";
! private static final String MUST_UNDERSTAND = "1";
private String actor = null;
--- 93,97 ----
"http://schemas.xmlsoap.org/soap/actor/next";
! static final boolean MUST_UNDERSTAND = true;
private String actor = null;
***************
*** 106,118 ****
HeaderElement(SOAPEnvelope soapEnvelope, String localName)
throws SOAPException {
! super(soapEnvelope, localName);
addAttribute(ATTRIBUTE_VERSION, VERSION);
addAttribute(ATTRIBUTE_MUST_UNDERSTAND, NAMESPACE_PREFIX_SOAP_ENVELOPE,
NAMESPACE_URI_SOAP_ENVELOPE, MUST_UNDERSTAND);
}
HeaderElement(SOAPEnvelope soapEnvelope, String localName, String prefix,
String uri) throws SOAPException {
! super(soapEnvelope, localName, prefix, uri);
}
--- 106,120 ----
HeaderElement(SOAPEnvelope soapEnvelope, String localName)
throws SOAPException {
! super(soapEnvelope, localName, true);
addAttribute(ATTRIBUTE_VERSION, VERSION);
+ /*
addAttribute(ATTRIBUTE_MUST_UNDERSTAND, NAMESPACE_PREFIX_SOAP_ENVELOPE,
NAMESPACE_URI_SOAP_ENVELOPE, MUST_UNDERSTAND);
+ */
}
HeaderElement(SOAPEnvelope soapEnvelope, String localName, String prefix,
String uri) throws SOAPException {
! super(soapEnvelope, localName, prefix, uri, true);
}
Index: Manifest.java
===================================================================
RCS file: /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/message/packaging/Manifest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Manifest.java 9 Apr 2003 07:48:24 -0000 1.6
--- Manifest.java 10 Jun 2003 02:22:49 -0000 1.7
***************
*** 109,116 ****
public Reference addReference(String id, String href)
throws SOAPException {
! final Element child = addChildElement
! (new Reference(soapEnvelope, id, href));
! final Reference reference = new Reference
! (soapEnvelope, child.getSOAPElement());
references.add(reference);
return reference;
--- 109,116 ----
public Reference addReference(String id, String href)
throws SOAPException {
! final Reference reference = new Reference(soapEnvelope,
! addChildElement(Reference.REFERENCE).getSOAPElement());
! reference.setId(id);
! reference.setHref(href);
references.add(reference);
return reference;
Index: PayloadContainer.java
===================================================================
RCS file: /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/message/packaging/PayloadContainer.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** PayloadContainer.java 9 Apr 2003 07:48:27 -0000 1.7
--- PayloadContainer.java 10 Jun 2003 02:22:49 -0000 1.8
***************
*** 146,149 ****
--- 146,152 ----
* Return the <code>AttachmentPart</code> that this
* <code>PayloadContainer</code> encapsulates.
+ *
+ * @deprecated use other methods such as getDataHandler(), etc. to
+ * get information of this <code>PayloadContainer</code>.
*/
public AttachmentPart getAttachmentPart() {
Index: Reference.java
===================================================================
RCS file: /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/message/packaging/Reference.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Reference.java 9 Apr 2003 07:48:27 -0000 1.8
--- Reference.java 10 Jun 2003 02:22:49 -0000 1.9
***************
*** 180,189 ****
* id attribute of <code>Reference</code> element.
*/
! private final String id;
/**
* href attribute of <code>Reference</code> element.
*/
! private final String href;
/**
--- 180,189 ----
* id attribute of <code>Reference</code> element.
*/
! private String id;
/**
* href attribute of <code>Reference</code> element.
*/
! private String href;
/**
***************
*** 257,263 ****
* @throws SOAPException
*/
Reference(SOAPEnvelope soapEnvelope, String id, String href)
throws SOAPException {
! super(soapEnvelope, REFERENCE);
this.id = id;
this.href = href;
--- 257,264 ----
* @throws SOAPException
*/
+ /*
Reference(SOAPEnvelope soapEnvelope, String id, String href)
throws SOAPException {
! super(soapEnvelope, REFERENCE, false);
this.id = id;
this.href = href;
***************
*** 271,274 ****
--- 272,276 ----
descriptions = new ArrayList();
}
+ */
/**
***************
*** 336,339 ****
--- 338,354 ----
}
+ void setId(String id) throws SOAPException {
+ if (this.id != null) {
+ throw new SOAPValidationException(SOAPValidationException.
+ SOAP_FAULT_CLIENT, "<" + NAMESPACE_PREFIX_XLINK + ":" +
+ ATTRIBUTE_ID + "> has already been set in <" +
+ NAMESPACE_PREFIX_EB + ":" + REFERENCE + ">!");
+ }
+ this.id = id;
+ addAttribute(ATTRIBUTE_ID, id);
+ addAttribute(ATTRIBUTE_TYPE, NAMESPACE_PREFIX_XLINK,
+ NAMESPACE_URI_XLINK, XLINK_TYPE);
+ }
+
/**
* Get href attribute of the <code>Reference</code> element.
***************
*** 345,348 ****
--- 360,381 ----
}
+ void setHref(String href) throws SOAPException {
+ if (this.href != null) {
+ throw new SOAPValidationException(SOAPValidationException.
+ SOAP_FAULT_CLIENT, "<" + NAMESPACE_PREFIX_XLINK + ":" +
+ ATTRIBUTE_HREF + "> has already been set in <" +
+ NAMESPACE_PREFIX_EB + ":" + REFERENCE + ">!");
+ }
+ if (this.id == null) {
+ throw new SOAPValidationException(SOAPValidationException.
+ SOAP_FAULT_CLIENT, "<" + NAMESPACE_PREFIX_XLINK + ":" +
+ ATTRIBUTE_ID + "> has not been set in <" +
+ NAMESPACE_PREFIX_EB + ":" + REFERENCE + ">!");
+ }
+ this.href = href;
+ addAttribute(ATTRIBUTE_HREF, NAMESPACE_PREFIX_XLINK,
+ NAMESPACE_URI_XLINK, href);
+ }
+
public String getRole() {
return role;
***************
*** 353,357 ****
throw new SOAPValidationException(SOAPValidationException.
SOAP_FAULT_CLIENT, "<" + NAMESPACE_PREFIX_XLINK + ":" +
! ATTRIBUTE_ROLE + "> has already been " + "set in <" +
NAMESPACE_PREFIX_EB + ":" + REFERENCE + ">!");
}
--- 386,390 ----
throw new SOAPValidationException(SOAPValidationException.
SOAP_FAULT_CLIENT, "<" + NAMESPACE_PREFIX_XLINK + ":" +
! ATTRIBUTE_ROLE + "> has already been set in <" +
NAMESPACE_PREFIX_EB + ":" + REFERENCE + ">!");
}
|