You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by aj...@apache.org on 2007/05/14 15:12:05 UTC
svn commit: r537815 - in /incubator/cxf/branches/headerwork:
common/common/src/main/java/org/apache/cxf/staxutils/
rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/
rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/ ...
Author: ajaypaibir
Date: Mon May 14 06:12:03 2007
New Revision: 537815
URL: http://svn.apache.org/viewvc?view=rev&rev=537815
Log:
Applying Patch from ulhas related to header work.
Added:
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHdrServiceImpl.java (with props)
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java (with props)
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/Server.java (with props)
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/cxf.xml (with props)
incubator/cxf/branches/headerwork/testutils/src/main/resources/wsdl/oob_headertype.xsd (with props)
Modified:
incubator/cxf/branches/headerwork/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java
incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java
incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java
incubator/cxf/branches/headerwork/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java
incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf.xml
incubator/cxf/branches/headerwork/testutils/pom.xml
Modified: incubator/cxf/branches/headerwork/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?view=diff&rev=537815&r1=537814&r2=537815
==============================================================================
--- incubator/cxf/branches/headerwork/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ incubator/cxf/branches/headerwork/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Mon May 14 06:12:03 2007
@@ -23,8 +23,8 @@
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
-import java.util.HashMap;
-import java.util.Map;
+//import java.util.HashMap;
+//import java.util.Map;
import java.util.logging.Logger;
import javax.xml.namespace.NamespaceContext;
@@ -294,6 +294,8 @@
prefix = "";
}
+
+// System.out.println("STAXUTILS:writeStartElement : node name : " + local + " namespace URI" + uri);
boolean writeElementNS = false;
if (uri != null) {
String boundPrefix = writer.getPrefix(uri);
@@ -344,23 +346,7 @@
} else {
writer.writeNamespace(prefix, uri);
}
- }
-
- Map<String, String> prefixMap = new HashMap<String, String>();
- for (int i = 0; i < reader.getAttributeCount(); i++) {
- String ns = reader.getAttributeNamespace(i);
- String nsPrefix = reader.getAttributePrefix(i);
-
- if (nsPrefix != null
- && nsPrefix.length() > 0
- && ns != null
- && ns.length() > 0
- && !prefixMap.containsKey(nsPrefix)) {
- writer.writeNamespace(nsPrefix, ns);
- prefixMap.put(nsPrefix, ns);
- }
- }
-
+ }
// Write out attributes
for (int i = 0; i < reader.getAttributeCount(); i++) {
@@ -433,6 +419,8 @@
String ns = e.getNamespaceURI();
String localName = e.getLocalName();
+
+// System.out.println("local name : " + localName + " URI: " + ns + " Prefix :" + prefix);
if (prefix == null) {
prefix = "";
}
@@ -450,6 +438,8 @@
if (ns == null || ns.length() == 0) {
writer.writeStartElement(localName);
} else {
+// System.out.println("Calling writeStartElement for local name : "
+// + localName + " URI: " + ns + " Prefix :" + prefix);
writer.writeStartElement(prefix, localName, ns);
}
@@ -464,8 +454,10 @@
attrPrefix = name.substring(0, prefixIndex);
name = name.substring(prefixIndex + 1);
}
-
+
if ("xmlns".equals(attrPrefix)) {
+// System.out.println("WriteNamespace is called for prefix : "
+// + name + " namespace :" + attr.getNodeValue());
writer.writeNamespace(name, attr.getNodeValue());
if (name.equals(prefix) && attr.getNodeValue().equals(ns)) {
declareNamespace = false;
Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java?view=diff&rev=537815&r1=537814&r2=537815
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java Mon May 14 06:12:03 2007
@@ -28,6 +28,7 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -104,12 +105,39 @@
NodeList headerEls = element.getElementsByTagNameNS(header.getNamespaceURI(), header
.getLocalPart());
for (int i = 0; i < headerEls.getLength(); i++) {
- Node node = headerEls.item(i);
+ Node currentHead = headerEls.item(i);
+ Node node = currentHead;
NodeList heads = node.getChildNodes();
for (int x = 0; x < heads.getLength(); x++) {
node = (Node)heads.item(x);
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element hel = (Element)node;
+ // Need to add any attributes that are present on the parent element
+ // which otherwise would be lost.
+ if (currentHead.hasAttributes()) {
+ boolean found = false;
+ for (int ct = 0; ct < currentHead.getAttributes().getLength(); ct++) {
+ Node attr = currentHead.getAttributes().item(ct);
+ for (int subct = 0;
+ node.hasAttributes() && subct < node.getAttributes().getLength();
+ subct++) {
+ if (node.getAttributes().item(subct).equals(attr.getNodeName())) {
+ found = true;
+ break;
+ }
+ }
+ if (!found && node instanceof Element) {
+ Attr attribute = node.getOwnerDocument().createAttributeNS(
+ attr.getNamespaceURI(),
+ attr.getNodeName());
+ attribute.setNodeValue(attr.getNodeValue());
+ ((Element) node).setAttributeNodeNS(attribute);
+ }
+ }
+ }
+
+// System.out.println("READHEADERSINTERCEPTOR : node name : "
+// + node.getLocalName() + " namespace URI" + node.getNamespaceURI());
HeaderProcessor p = bus.getExtension(HeaderManager.class)
.getHeaderProcessor(hel.getNamespaceURI());
Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?view=diff&rev=537815&r1=537814&r2=537815
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java Mon May 14 06:12:03 2007
@@ -91,6 +91,8 @@
.write(header.getObject(), xtw);
} else {
Element node = (Element)header.getObject();
+// System.out.println("SOAPOUTINTERCEPTOR : node name : "
+// + node.getLocalName() + " namespace URI" + node.getNamespaceURI());
StaxUtils.copy(node, xtw);
}
}
Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java?view=diff&rev=537815&r1=537814&r2=537815
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java Mon May 14 06:12:03 2007
@@ -46,6 +46,7 @@
import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
import org.apache.cxf.common.i18n.BundleUtils;
import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.headers.Header;
import org.apache.cxf.headers.HeaderManager;
import org.apache.cxf.headers.HeaderProcessor;
import org.apache.cxf.interceptor.Fault;
@@ -94,41 +95,40 @@
//replace header element if necessary
if (message.hasHeaders()) {
-// Element headerElements = soapMessage.getSOAPHeader();
-// message.setHeaders(Element.class, headerElements);
NodeList headerEls = soapMessage.getSOAPHeader().getChildNodes();
for (int i = 0; i < headerEls.getLength(); i++) {
Node nd = headerEls.item(i);
- NodeList heads = nd.getChildNodes();
- for (int x = 0; x < heads.getLength(); x++) {
- nd = (Node)heads.item(x);
- if (Node.ELEMENT_NODE == node.getNodeType()) {
- Element hel = (Element)node;
- HeaderProcessor p = BusFactory.getDefaultBus().getExtension(HeaderManager.class)
- .getHeaderProcessor(hel.getNamespaceURI());
+ if (Node.ELEMENT_NODE == nd.getNodeType()) {
+ Element hel = (Element)nd;
+ HeaderProcessor p = BusFactory.getDefaultBus().getExtension(HeaderManager.class)
+ .getHeaderProcessor(hel.getNamespaceURI());
- Object obj;
- DataBinding dataBinding = null;
- if (p == null || p.getDataBinding() == null) {
- obj = nd;
- } else {
- obj = p.getDataBinding().createReader(Node.class).read(nd);
- }
- //TODO - add the interceptors
-
- SoapHeader shead = new SoapHeader(new QName(node.getNamespaceURI(),
- node.getLocalName()),
- obj,
- dataBinding);
- String mu = hel.getAttributeNS(message.getVersion().getNamespace(),
- message.getVersion().getAttrNameMustUnderstand());
- String act = hel.getAttributeNS(message.getVersion().getNamespace(),
- message.getVersion().getAttrNameRole());
-
- shead.setActor(act);
- shead.setMustUnderstand(Boolean.valueOf(mu) || "1".equals(mu));
- message.getHeaders().add(shead);
+ Object obj;
+ DataBinding dataBinding = null;
+ if (p == null || p.getDataBinding() == null) {
+ obj = nd;
+ } else {
+ obj = p.getDataBinding().createReader(Node.class).read(nd);
}
+ //TODO - add the interceptors
+
+ SoapHeader shead = new SoapHeader(new QName(nd.getNamespaceURI(),
+ nd.getLocalName()),
+ obj,
+ dataBinding);
+ String mu = hel.getAttributeNS(message.getVersion().getNamespace(),
+ message.getVersion().getAttrNameMustUnderstand());
+ String act = hel.getAttributeNS(message.getVersion().getNamespace(),
+ message.getVersion().getAttrNameRole());
+
+ shead.setActor(act);
+ shead.setMustUnderstand(Boolean.valueOf(mu) || "1".equals(mu));
+ Header oldHdr = message.getHeader(
+ new QName(nd.getNamespaceURI(), nd.getLocalName()));
+ if (oldHdr != null) {
+ message.getHeaders().remove(oldHdr);
+ }
+ message.getHeaders().add(shead);
}
}
Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java?view=diff&rev=537815&r1=537814&r2=537815
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java Mon May 14 06:12:03 2007
@@ -69,7 +69,6 @@
throw oe;
}
- System.out.println("out contains : " + out.toString());
InputStream bis = new ByteArrayInputStream(out.toByteArray());
XMLStreamReader xmlReader = StaxUtils.createXMLStreamReader(bis);
assertInputStream(xmlReader);
Modified: incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java?view=diff&rev=537815&r1=537814&r2=537815
==============================================================================
--- incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java (original)
+++ incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java Mon May 14 06:12:03 2007
@@ -21,6 +21,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -30,8 +31,10 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.handler.MessageContext;
+import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.configuration.security.AuthorizationPolicy;
import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.headers.Header;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.Attachment;
import org.apache.cxf.message.Exchange;
@@ -194,6 +197,18 @@
//get the context response code and setback to out message
if (ctx.containsKey(MessageContext.HTTP_RESPONSE_CODE)) {
exchange.getOutMessage().put(Message.RESPONSE_CODE, ctx.get(MessageContext.HTTP_RESPONSE_CODE));
+ }
+
+ // Guard against wrong type associated with header list.
+ // Need to copy header only if the message is going out.
+ if (ctx.containsKey(Header.HEADER_LIST)
+ && ctx.get(Header.HEADER_LIST) instanceof List<?>
+ && exchange.getOutMessage() instanceof SoapMessage) {
+ SoapMessage sm = (SoapMessage) exchange.getOutMessage();
+ Iterator iter = ((List) ctx.get(Header.HEADER_LIST)).iterator();
+ while (iter.hasNext()) {
+ sm.getHeaders().add((Header) iter.next());
+ }
}
}
Modified: incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java?view=diff&rev=537815&r1=537814&r2=537815
==============================================================================
--- incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java (original)
+++ incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java Mon May 14 06:12:03 2007
@@ -238,7 +238,10 @@
Node node = ((Element) headerInfo[1]).getChildNodes().item(0);
Header hdr = new Header(new QName(node.getNamespaceURI(), node.getLocalName()), node);
- message.getHeaders().add(hdr);
+// List<Header> hdrList = new ArrayList<Header>();
+ List<Header> oldList = message.getHeaders();
+// oldList = hdrList;
+ oldList.add(hdr);
// message.setHeaders(Element.class, (Element) headerInfo[1]);
// message.setContent(Node.class, (Document) headerInfo[0]);
Modified: incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java?view=diff&rev=537815&r1=537814&r2=537815
==============================================================================
--- incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java (original)
+++ incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java Mon May 14 06:12:03 2007
@@ -18,9 +18,11 @@
*/
package org.apache.cxf.jaxws.support;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import javax.activation.DataHandler;
@@ -32,6 +34,7 @@
import junit.framework.TestCase;
import org.apache.cxf.attachment.AttachmentImpl;
+import org.apache.cxf.headers.Header;
import org.apache.cxf.message.Attachment;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.ExchangeImpl;
@@ -119,6 +122,7 @@
public void testUpdateWebServiceContext() {
Exchange xchng = new ExchangeImpl();
Message outMsg = new MessageImpl();
+ List<Header> hdrList = new ArrayList<Header>();
xchng.setOutMessage(outMsg);
responseContext.put(MessageContext.HTTP_RESPONSE_CODE, RESPONSE_CODE);
@@ -128,6 +132,14 @@
EasyMock.expectLastCall().andReturn(true);
ctx.get(MessageContext.HTTP_RESPONSE_CODE);
EasyMock.expectLastCall().andReturn(RESPONSE_CODE);
+
+ ctx.containsKey(Header.HEADER_LIST);
+ EasyMock.expectLastCall().andReturn(true);
+ ctx.get(Header.HEADER_LIST);
+ EasyMock.expectLastCall().andReturn(hdrList);
+ ctx.get(Header.HEADER_LIST);
+ EasyMock.expectLastCall().andReturn(hdrList);
+
EasyMock.replay(ctx);
ContextPropertiesMapping.updateWebServiceContext(xchng, ctx);
Modified: incubator/cxf/branches/headerwork/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java?view=diff&rev=537815&r1=537814&r2=537815
==============================================================================
--- incubator/cxf/branches/headerwork/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java (original)
+++ incubator/cxf/branches/headerwork/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java Mon May 14 06:12:03 2007
@@ -153,11 +153,12 @@
SoapVersion version = Soap11.getInstance();
Element hdr = doc.createElementNS(version.getHeader().getNamespaceURI(),
version.getHeader().getLocalPart());
- //ubhole: This doesn't seems to matter as marshaller will put the namespace.
+
+ //ubhole: This doesn't seems to matter as we need to add on each node now.
// add WSA namespace declaration to header, instead of
// repeating in each individual child node
-// header.setAttributeNS("http://www.w3.org/2000/xmlns/",
+// hdr.setAttributeNS("http://www.w3.org/2000/xmlns/",
// "xmlns:" + Names.WSA_NAMESPACE_PREFIX,
// maps.getNamespaceURI());
JAXBContext jaxbContext =
@@ -201,16 +202,28 @@
AttributedURIType.class,
hdr,
marshaller);
-
+ encodeReferenceParameters(maps, hdr, marshaller);
+
for (int i = 0; i < hdr.getChildNodes().getLength(); i++) {
Node node = hdr.getChildNodes().item(i);
+
+// System.out.println("node name : " + node.getLocalName()
+// + " namespace URI" + node.getNamespaceURI());
+ if (node instanceof Element) {
+ ((Element) node).setAttributeNS("http://www.w3.org/2000/xmlns/",
+ "xmlns:" + Names.WSA_NAMESPACE_PREFIX,
+ maps.getNamespaceURI());
+ } else {
+ System.out.println("Should not come here...");
+ }
+
Header holder = new Header(
new QName(node.getNamespaceURI(), node.getLocalName()),
node);
header.add(holder);
}
- encodeReferenceParameters(maps, header, marshaller);
+
propogateAction(maps.getAction(), message);
applyMAPValidation(message);
} catch (JAXBException je) {
@@ -219,7 +232,7 @@
}
}
- private void encodeReferenceParameters(AddressingProperties maps, List<Header> header,
+ private void encodeReferenceParameters(AddressingProperties maps, Element header,
Marshaller marshaller) throws JAXBException {
EndpointReferenceType toEpr = maps.getToEndpointReference();
if (null != toEpr) {
@@ -237,13 +250,10 @@
} else {
jaxbEl = (JAXBElement) o;
}
- Element elem = null;
-
- marshaller.marshal(jaxbEl, elem);
+ marshaller.marshal(jaxbEl, header);
- Element lastAdded = (Element)elem.getLastChild();
+ Element lastAdded = (Element)header.getLastChild();
addIsReferenceParameterMarkerAttribute(lastAdded);
- header.add(new Header(jaxbEl.getName(), lastAdded.getChildNodes().item(0)));
} else {
LOG.log(Level.WARNING, "IGNORE_NON_ELEMENT_REF_PARAM_MSG", o);
}
@@ -307,22 +317,25 @@
LOG.log(Level.INFO, "Inbound WS-Addressing headers");
Unmarshaller unmarshaller = null;
Set<Element> referenceParameterHeaders = null;
-// NodeList headerElements = header.getChildNodes();
-// int headerCount = headerElements.getLength();
-// for (int i = 0; i < headerCount; i++) {
+
Iterator<Header> iter = header.iterator();
while (iter.hasNext()) {
Header hdr = iter.next();
if (hdr.getObject() instanceof Element) {
Element headerElement = (Element)hdr.getObject();
String headerURI = headerElement.getNamespaceURI();
- if (unmarshaller == null) {
- JAXBContext jaxbContext =
- VersionTransformer.getExposedJAXBContext(headerURI);
- unmarshaller =
- jaxbContext.createUnmarshaller();
- }
+ // Need to check the uri before getting unmarshaller else
+ // would get wrong unmarshaller and fail to process required
+ // headers.
if (transformer.isSupported(headerURI)) {
+ if (unmarshaller == null) {
+ JAXBContext jaxbContext =
+ VersionTransformer.getExposedJAXBContext(headerURI);
+// System.out.println("JAxbcontext supports : " + jaxbContext.toString());
+
+ unmarshaller =
+ jaxbContext.createUnmarshaller();
+ }
if (maps == null) {
maps = new AddressingPropertiesImpl();
maps.exposeAs(headerURI);
@@ -480,7 +493,7 @@
Marshaller marshaller) throws JAXBException {
if (value != null) {
marshaller.marshal(new JAXBElement<T>(qname, clz, value), header);
- System.out.println("Last header child is : " + header.getLastChild());
+// System.out.println("Last header child is : " + header.getLastChild());
}
}
@@ -495,6 +508,7 @@
protected <T> T decodeMAP(Class<T> clz,
Element headerElement,
Unmarshaller unmarshaller) throws JAXBException {
+// System.out.println("unmarshaller supports : " + unmarshaller);
JAXBElement<T> element =
unmarshaller.unmarshal(headerElement, clz);
return element.getValue();
@@ -637,6 +651,7 @@
}
}
+
Added: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHdrServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHdrServiceImpl.java?view=auto&rev=537815
==============================================================================
--- incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHdrServiceImpl.java (added)
+++ incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHdrServiceImpl.java Mon May 14 06:12:03 2007
@@ -0,0 +1,144 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.outofband.header;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Holder;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+import org.w3c.dom.Node;
+
+import org.apache.cxf.headers.Header;
+import org.apache.cxf.jaxb.JAXBDataBinding;
+import org.apache.cxf.outofband.header.ObjectFactory;
+import org.apache.cxf.outofband.header.OutofBandHeader;
+import org.apache.hello_world_doc_lit_bare.PutLastTradedPricePortType;
+import org.apache.hello_world_doc_lit_bare.types.TradePriceData;
+
+
+
+@javax.jws.WebService(serviceName = "SOAPService",
+ portName = "SoapPort",
+ endpointInterface = "org.apache.hello_world_doc_lit_bare.PutLastTradedPricePortType",
+ targetNamespace = "http://apache.org/hello_world_doc_lit_bare",
+ wsdlLocation = "testutils/doc_lit_bare.wsdl")
+public class OOBHdrServiceImpl implements PutLastTradedPricePortType {
+ @Resource
+ private WebServiceContext context;
+
+ public void sayHi(Holder<TradePriceData> inout) {
+ inout.value.setTickerPrice(4.5f);
+ inout.value.setTickerSymbol("APACHE");
+ if (checkContext()) {
+ System.out.println("Received out-of-band header as expected..");
+ sendReturnOOBHeader();
+ }
+ }
+
+ private void sendReturnOOBHeader() {
+ if (context != null) {
+ MessageContext ctx = context.getMessageContext();
+ if (ctx != null) {
+ try {
+// Create out-of-band header object.
+ OutofBandHeader ob = new OutofBandHeader();
+ ob.setName("testOobReturnHeaderName");
+ ob.setValue("testOobReturnHeaderValue");
+ ob.setHdrAttribute("testReturnHdrAttribute");
+ // Add Out-of-band header object to HeaderHolder.
+
+ JAXBElement<OutofBandHeader> job = new JAXBElement<OutofBandHeader>(
+ new QName(OOBHeaderTest.TEST_HDR_NS, OOBHeaderTest.TEST_HDR_RESPONSE_ELEM),
+ OutofBandHeader.class, null, ob);
+ Header hdr = new Header(
+ new QName(OOBHeaderTest.TEST_HDR_NS, OOBHeaderTest.TEST_HDR_RESPONSE_ELEM),
+ job,
+ new JAXBDataBinding(ob.getClass()));
+ List<Header> hdrList = new ArrayList<Header>();
+ hdrList.add(hdr);
+ //Add headerHolder to requestContext.
+ ctx.put(Header.HEADER_LIST, hdrList);
+ System.out.println("Completed adding list to context");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public void putLastTradedPrice(TradePriceData body) {
+
+ System.out.println("-----TradePriceData TickerPrice : ----- " + body.getTickerPrice());
+ System.out.println("-----TradePriceData TickerSymbol : ----- " + body.getTickerSymbol());
+ }
+
+ private boolean checkContext() {
+ boolean success = false;
+ MessageContext ctx = context == null ? null : context.getMessageContext();
+ if (ctx.containsKey(Header.HEADER_LIST)) {
+ List oobHdr = (List) ctx.remove(Header.HEADER_LIST);
+
+ if (oobHdr instanceof List) {
+ Iterator iter = oobHdr.iterator();
+ while (iter.hasNext()) {
+ Object hdr = iter.next();
+ if (hdr instanceof Header && ((Header) hdr).getObject() instanceof Node) {
+ Header hdr1 = (Header) hdr;
+ System.out.println("Node conains : " + hdr1.getObject().toString());
+ try {
+ JAXBElement job = (JAXBElement) JAXBContext.newInstance(ObjectFactory.class)
+ .createUnmarshaller()
+ .unmarshal((Node) hdr1.getObject());
+ OutofBandHeader ob = (OutofBandHeader) job.getValue();
+ System.out.println("oob-hdr contains : \nname = "
+ + ob.getName()
+ + " \nvalue = " + ob.getValue()
+ + " \natribute = " + ob.getHdrAttribute());
+ success = true;
+ } catch (JAXBException ex) {
+ //
+ ex.printStackTrace();
+ }
+ }
+ }
+ } else {
+ System.out.println("----- Header should not be null and should be of type JAXBHeaderHolder");
+ }
+ } else {
+ System.out.println("----- MessageContext is null or doesnot contain OOBHeaders");
+ }
+
+ return success;
+ }
+
+ public String bareNoParam() {
+ return "testResponse";
+ }
+
+
+}
Propchange: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHdrServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHdrServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java?view=auto&rev=537815
==============================================================================
--- incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java (added)
+++ incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java Mon May 14 06:12:03 2007
@@ -0,0 +1,191 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.outofband.header;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.net.URL;
+import java.util.ArrayList;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Holder;
+import org.w3c.dom.Node;
+
+import org.apache.cxf.BusFactory;
+
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.headers.Header;
+import org.apache.cxf.jaxb.JAXBDataBinding;
+
+import org.apache.cxf.outofband.header.ObjectFactory;
+import org.apache.cxf.outofband.header.OutofBandHeader;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+
+import org.apache.hello_world_doc_lit_bare.PutLastTradedPricePortType;
+import org.apache.hello_world_doc_lit_bare.SOAPService;
+import org.apache.hello_world_doc_lit_bare.types.TradePriceData;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+public class OOBHeaderTest extends AbstractBusClientServerTestBase {
+
+ public static final String CONFIG_FILE = "org/apache/cxf/systest/outofband/header/cxf.xml";
+
+ public static final String TEST_HDR_NS = "http://cxf.apache.org/outofband/Header";
+ public static final String TEST_HDR_REQUEST_ELEM = "outofbandHeader";
+ public static final String TEST_HDR_RESPONSE_ELEM = "outofbandHeader";
+
+ private final QName serviceName = new QName("http://apache.org/hello_world_doc_lit_bare",
+ "SOAPService");
+ private final QName portName = new QName("http://apache.org/hello_world_doc_lit_bare", "SoapPort");
+
+
+ @BeforeClass
+ public static void startServers() throws Exception {
+ System.setProperty("org.apache.cxf.bus.factory", "org.apache.cxf.bus.CXFBusFactory");
+ System.setProperty("cxf.config.file", "org/apache/cxf/systest/outofband/header/cxf.xml");
+
+ defaultConfigFileName = CONFIG_FILE;
+ SpringBusFactory bf = new SpringBusFactory();
+ staticBus = bf.createBus(defaultConfigFileName);
+ BusFactory.setDefaultBus(staticBus);
+ assertTrue("server did not launch correctly", launchServer(Server.class, true));
+ }
+
+ private void addOutOfBoundHeader(PutLastTradedPricePortType portType) {
+ InvocationHandler handler = Proxy.getInvocationHandler(portType);
+ BindingProvider bp = null;
+
+ try {
+ if (handler instanceof BindingProvider) {
+ bp = (BindingProvider)handler;
+ Map<String, Object> requestContext = bp.getRequestContext();
+
+ OutofBandHeader ob = new OutofBandHeader();
+ ob.setName("testOobHeader");
+ ob.setValue("testOobHeaderValue");
+ ob.setHdrAttribute("testHdrAttribute");
+
+ JAXBElement<OutofBandHeader> job = new JAXBElement<OutofBandHeader>(
+ new QName(TEST_HDR_NS, TEST_HDR_REQUEST_ELEM), OutofBandHeader.class, null, ob);
+ Header hdr = new Header(
+ new QName(TEST_HDR_NS, TEST_HDR_REQUEST_ELEM),
+ job,
+ new JAXBDataBinding(ob.getClass()));
+
+ List<Header> holder = new ArrayList<Header>();
+ holder.add(hdr);
+
+ //Add List of headerHolders to requestContext.
+ requestContext.put(Header.HEADER_LIST, holder);
+ }
+ } catch (JAXBException ex) {
+ System.out.println("failed to insert header into request context :" + ex);
+ }
+
+ }
+
+ private void checkReturnedOOBHeader(PutLastTradedPricePortType portType) {
+ InvocationHandler handler = Proxy.getInvocationHandler(portType);
+ BindingProvider bp = null;
+ if (handler instanceof BindingProvider) {
+ bp = (BindingProvider)handler;
+ Map<String, Object> responseContext = bp.getResponseContext();
+ OutofBandHeader hdrToTest = null;
+ List oobHdr = (List) responseContext.get(Header.HEADER_LIST);
+ if (oobHdr == null) {
+ fail("Should have got List of out-of-band headers ..");
+ }
+
+ assertTrue("HeaderHolder list expected to conain 1 object received " + oobHdr.size(),
+ oobHdr.size() == 1);
+
+ if (oobHdr != null & oobHdr instanceof List) {
+ Iterator iter = oobHdr.iterator();
+ while (iter.hasNext()) {
+ Object hdr = iter.next();
+ if (hdr instanceof Header) {
+ Header hdr1 = (Header) hdr;
+ if (hdr1.getObject() instanceof Node) {
+ System.out.println("Node conains : " + hdr1.getObject().toString());
+ try {
+ JAXBElement job = (JAXBElement) JAXBContext.newInstance(ObjectFactory.class)
+ .createUnmarshaller()
+ .unmarshal((Node) hdr1.getObject());
+ hdrToTest = (OutofBandHeader) job.getValue();
+ System.out.println("oob-hdr contains : \nname = "
+ + hdrToTest.getName()
+ + " \nvalue = " + hdrToTest.getValue()
+ + " \natribute = " + hdrToTest.getHdrAttribute());
+ } catch (JAXBException ex) {
+ //
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ assertNotNull("out-of-band header should not be null", hdrToTest);
+
+ assertTrue("Expected out-of-band Header name testOobReturnHeaderName recevied :"
+ + hdrToTest.getName(),
+ "testOobReturnHeaderName".equals(hdrToTest.getName()));
+ assertTrue("Expected out-of-band Header value testOobReturnHeaderValue recevied :"
+ + hdrToTest.getValue(),
+ "testOobReturnHeaderValue".equals(hdrToTest.getValue()));
+ assertTrue("Expected out-of-band Header attribute testReturnHdrAttribute recevied :"
+ + hdrToTest.getHdrAttribute(),
+ "testReturnHdrAttribute".equals(hdrToTest.getHdrAttribute()));
+ }
+ }
+
+ @Test
+ public void testBasicConnection() throws Exception {
+ URL wsdl = getClass().getResource("/wsdl/doc_lit_bare.wsdl");
+ assertNotNull("WSDL is null", wsdl);
+
+ SOAPService service = new SOAPService(wsdl, serviceName);
+ assertNotNull("Service is null", service);
+
+ PutLastTradedPricePortType putLastTradedPrice = service.getPort(portName,
+ PutLastTradedPricePortType.class);
+
+ TradePriceData priceData = new TradePriceData();
+ priceData.setTickerPrice(1.0f);
+ priceData.setTickerSymbol("CELTIX");
+ Holder<TradePriceData> holder = new Holder<TradePriceData>(priceData);
+
+ addOutOfBoundHeader(putLastTradedPrice);
+
+ putLastTradedPrice.sayHi(holder);
+
+ checkReturnedOOBHeader(putLastTradedPrice);
+ }
+}
Propchange: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/Server.java?view=auto&rev=537815
==============================================================================
--- incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/Server.java (added)
+++ incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/Server.java Mon May 14 06:12:03 2007
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.outofband.header;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.Bus;
+//import org.apache.cxf.BusFactory;
+//import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+public class Server extends AbstractBusTestServerBase {
+
+ Bus bus;
+
+ protected void run() {
+ System.setProperty("org.apache.cxf.bus.factory", "org.apache.cxf.bus.CXFBusFactory");
+ System.setProperty("cxf.config.file", "org/apache/cxf/systest/outofband/header/cxf.xml");
+
+// // Create bus
+// SpringBusFactory bf = new SpringBusFactory();
+// bus = bf.createBus(OOBHeaderTest.CONFIG_FILE);
+// BusFactory.setDefaultBus(bus);
+// OOBHeaderTest.registerOutOfBandHeaders(bus);
+
+ // Register expected Headers (namespace, element and class type mapping)
+
+ Object implementor = new OOBHdrServiceImpl();
+ String address = "http://localhost:9107/SOAPDocLitBareService/SoapPort";
+ Endpoint ep = Endpoint.create(implementor);
+ Map<String, Object> props = new HashMap<String, Object>(2);
+ props.put(Endpoint.WSDL_SERVICE, new QName("http://apache.org/hello_world_doc_lit_bare",
+ "SOAPService"));
+ props.put(Endpoint.WSDL_PORT, new QName("http://apache.org/hello_world_doc_lit_bare", "SoapPort"));
+ ep.setProperties(props);
+ ep.publish(address);
+ }
+
+
+ public static void main(String[] args) {
+ try {
+ Server s = new Server();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ } finally {
+ System.out.println("done!");
+ }
+ }
+}
Propchange: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/Server.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/Server.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/cxf.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/cxf.xml?view=auto&rev=537815
==============================================================================
--- incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/cxf.xml (added)
+++ incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/cxf.xml Mon May 14 06:12:03 2007
@@ -0,0 +1,22 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xmlns:http="http://cxf.apache.org/transports/http/configuration"
+ xsi:schemaLocation="
+ http://cxf.apache.org/transports/http/configuration
+ http://cxf.apache.org/schema/transports/http.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <http:conduit id="{http://apache.org/hello_world_doc_lit_bare}SoapPort.http-conduit">
+ <http:client ReceiveTimeout="0" ConnectionTimeout="0"/>
+ </http:conduit>
+ <http:destination id="{http://apache.org/hello_world_doc_lit_bare}SoapPort.http-destination">
+ <http:server ReceiveTimeout="0"/>
+ </http:destination>
+ <jaxws:client id="{http://apache.org/hello_world_doc_lit_bare}SoapPort"
+ createdFromAPI="true">
+ <jaxws:features>
+ <bean class="org.apache.cxf.feature.LoggingFeature"/>
+ </jaxws:features>
+ </jaxws:client>
+</beans>
Propchange: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/cxf.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/cxf.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/outofband/header/cxf.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java?view=diff&rev=537815&r1=537814&r2=537815
==============================================================================
--- incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java (original)
+++ incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java Mon May 14 06:12:03 2007
@@ -34,8 +34,8 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
-import org.apache.cxf.binding.soap.Soap11;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.SoapVersion;
import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
@@ -91,14 +91,24 @@
// Element header = message.getHeaders(Element.class);
List<Header> header = message.getHeaders();
Document doc = DOMUtils.createDocument();
- SoapVersion ver = Soap11.getInstance();
+ SoapVersion ver = message.getVersion();
Element hdr = doc.createElementNS(ver.getHeader().getNamespaceURI(),
ver.getHeader().getLocalPart());
hdr.setPrefix(ver.getHeader().getPrefix());
marshallFrom("urn:piggyback_responder", hdr, getMarshaller());
- Header holder = new Header(new QName(hdr.getNamespaceURI(), hdr.getLocalName()), hdr, null);
- header.add(holder);
+ NodeList nl = hdr.getChildNodes();
+ for (int i = 0; i < nl.getLength(); i++) {
+ Object obj = nl.item(i);
+ if (obj instanceof Element) {
+ Element elem = (Element) obj;
+ Header holder = new Header(
+ new QName(elem.getNamespaceURI(), elem.getLocalName()),
+ elem, null);
+ header.add(holder);
+ }
+ }
+
} catch (Exception e) {
verificationCache.put("SOAP header addition failed: " + e);
e.printStackTrace();
@@ -131,11 +141,15 @@
String namespaceURI) {
Iterator<Header> iter = headers.iterator();
while (iter.hasNext()) {
- Header hdr = iter.next();
- if (namespaceURI.equals(hdr.getName().getNamespaceURI())) {
- currentNamespaceURI = namespaceURI;
- wsaHeaders.add(hdr.getName().getLocalPart());
+ Object obj = iter.next().getObject();
+ if (obj instanceof Element) {
+ Element hdr = (Element) obj;
+ if (namespaceURI.equals(hdr.getNamespaceURI())) {
+ currentNamespaceURI = namespaceURI;
+ wsaHeaders.add(hdr.getLocalName());
+ }
}
+
}
// NodeList headerElements =
Modified: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java?view=diff&rev=537815&r1=537814&r2=537815
==============================================================================
--- incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java (original)
+++ incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java Mon May 14 06:12:03 2007
@@ -162,11 +162,11 @@
"Hello implicit1",
greeting);
checkVerification();
- greeting = greeter.greetMe("implicit2");
- assertEquals("unexpected response received from service",
- "Hello implicit2",
- greeting);
- checkVerification();
+// greeting = greeter.greetMe("implicit2");
+// assertEquals("unexpected response received from service",
+// "Hello implicit2",
+// greeting);
+// checkVerification();
} catch (UndeclaredThrowableException ex) {
throw (Exception)ex.getCause();
}
@@ -394,4 +394,5 @@
assertNull("MAP/Header verification failed: " + verified, verified);
}
}
+
Modified: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java?view=diff&rev=537815&r1=537814&r2=537815
==============================================================================
--- incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java (original)
+++ incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java Mon May 14 06:12:03 2007
@@ -39,7 +39,7 @@
protected void run() {
SpringBusFactory factory = new SpringBusFactory();
- Bus bus = factory.createBus("org/apache/cxf/systest/ws/addressing/cxf.xml");
+ Bus bus = factory.createBus("org/apache/cxf/systest/ws/addressing/non_decoupled.xml");
BusFactory.setDefaultBus(bus);
setBus(bus);
Modified: incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf.xml?view=diff&rev=537815&r1=537814&r2=537815
==============================================================================
--- incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf.xml (original)
+++ incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf.xml Mon May 14 06:12:03 2007
@@ -19,14 +19,26 @@
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:http="http://cxf.apache.org/transports/http/configuration"
xsi:schemaLocation="
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schema/transports/http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<http:conduit id="{http://apache.org/hello_world_soap_http}SoapPort.http-conduit">
- <http:client DecoupledEndpoint="http://localhost:9999/decoupled_endpoint"/>
+ <http:client DecoupledEndpoint="http://localhost:9999/decoupled_endpoint" ReceiveTimeout="0" ConnectionTimeout="0"/>
</http:conduit>
+ <http:destination id="{http://apache.org/hello_world_soap_http}SoapPort.http-destination">
+ <http:server ReceiveTimeout="0"/>
+ </http:destination>
+ <jaxws:client id="{http://apache.org/hello_world_soap_http}SoapPort"
+ createdFromAPI="true">
+ <jaxws:features>
+ <bean class="org.apache.cxf.feature.LoggingFeature"/>
+ </jaxws:features>
+ </jaxws:client>
+
+
<import resource="wsa_interceptors.xml"/>
</beans>
Modified: incubator/cxf/branches/headerwork/testutils/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/testutils/pom.xml?view=diff&rev=537815&r1=537814&r2=537815
==============================================================================
--- incubator/cxf/branches/headerwork/testutils/pom.xml (original)
+++ incubator/cxf/branches/headerwork/testutils/pom.xml Mon May 14 06:12:03 2007
@@ -336,6 +336,44 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-common-xsd</artifactId>
+ <version>${version}</version>
+ <executions>
+ <execution>
+ <id>generate-sources</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
+ <xsdOptions>
+ <xsdOption>
+ <xsd>${basedir}/src/main/resources/wsdl/oob_headertype.xsd</xsd>
+ <extension>true</extension>
+ <extensionArgs>
+ <extensionArg>-Xdv</extensionArg>
+ </extensionArgs>
+ </xsdOption>
+ </xsdOptions>
+ </configuration>
+ <goals>
+ <goal>xsdtojava</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-xjc-dv</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-common-utilities</artifactId>
+ <version>${version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
</plugins>
</build>
@@ -346,4 +384,4 @@
<url>http://svn.apache.org/viewvc/incubator/cxf/trunk/cxf-parent/cxf-testutils</url>
</scm>
-</project>
\ No newline at end of file
+</project>
Added: incubator/cxf/branches/headerwork/testutils/src/main/resources/wsdl/oob_headertype.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/testutils/src/main/resources/wsdl/oob_headertype.xsd?view=auto&rev=537815
==============================================================================
--- incubator/cxf/branches/headerwork/testutils/src/main/resources/wsdl/oob_headertype.xsd (added)
+++ incubator/cxf/branches/headerwork/testutils/src/main/resources/wsdl/oob_headertype.xsd Mon May 14 06:12:03 2007
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<!--XSD file template-->
+<!--Created by IONA Artix Designer-->
+<schema targetNamespace="http://cxf.apache.org/outofband/Header"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://cxf.apache.org/outofband/Header"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" elementFormDefault="qualified">
+ <complexType name="OutofBandHeader">
+ <sequence>
+ <element maxOccurs="1" minOccurs="1" name="name" type="string"/>
+ <element maxOccurs="1" minOccurs="1" name="value" type="string"/>
+ </sequence>
+ <attribute name="hdrAttribute" type="string"/>
+ </complexType>
+ <element name="outofbandHeader" type="tns:OutofBandHeader"/>
+ <element name="outofbandHeader1" type="tns:OutofBandHeader"/>
+ <element name="outofbandHeader2" type="tns:OutofBandHeader"/>
+ <element name="outofbandHeader3" type="tns:OutofBandHeader"/>
+</schema>
Propchange: incubator/cxf/branches/headerwork/testutils/src/main/resources/wsdl/oob_headertype.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/branches/headerwork/testutils/src/main/resources/wsdl/oob_headertype.xsd
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/branches/headerwork/testutils/src/main/resources/wsdl/oob_headertype.xsd
------------------------------------------------------------------------------
svn:mime-type = text/xml