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 di...@apache.org on 2008/04/14 23:09:57 UTC
svn commit: r647998 - in
/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message:
MessageRPCTests.java headers/ headers/ConfigHeader.java
headers/ObjectFactory.java headers/package-info.java
Author: dims
Date: Mon Apr 14 14:09:46 2008
New Revision: 647998
URL: http://svn.apache.org/viewvc?rev=647998&view=rev
Log:
Checking in a test case for a rpc/lit service with a jaxb object in the header, axiom breaks with a java.util.NoSuchElementException
Added:
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigHeader.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ObjectFactory.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/package-info.java
Modified:
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageRPCTests.java
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageRPCTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageRPCTests.java?rev=647998&r1=647997&r2=647998&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageRPCTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageRPCTests.java Mon Apr 14 14:09:46 2008
@@ -28,6 +28,7 @@
import org.apache.axis2.jaxws.message.databinding.JAXBBlockContext;
import org.apache.axis2.jaxws.message.factory.JAXBBlockFactory;
import org.apache.axis2.jaxws.message.factory.MessageFactory;
+import org.apache.axis2.jaxws.message.headers.ConfigHeader;
import org.apache.axis2.jaxws.registry.FactoryRegistry;
import org.test.stock1.ObjectFactory;
import org.test.stock1.StockPrice;
@@ -248,7 +249,6 @@
assertTrue(newText.contains("Body"));
}
-
public void testJAXBInflow_soap11() throws Exception {
_testJAXBInflow(sampleEnvelope11);
}
@@ -314,4 +314,77 @@
assertTrue(obj.getPrice().equals("100"));
}
+ // FIXME: This test fails, checking it in so that Rich can take a look
+ public void _testJAXBHeader() throws Exception {
+ String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
+ "\t<soapenv:Header>\n" +
+ "\t\t<ns2:ConfigHeader2 xmlns:ns2=\"http://headers.message.jaxws.axis2.apache.org/types4\">\n" +
+ "\t\t\t<message>configHeader2</message>\n" +
+ "\t\t</ns2:ConfigHeader2>\n" +
+ "\t\t<ns2:ConfigHeader3 xmlns:ns2=\"http://headers.message.jaxws.axis2.apache.org/types4\">\n" +
+ "\t\t\t<message>xyz</message>\n" +
+ "\t\t</ns2:ConfigHeader3>\n" +
+ "\t</soapenv:Header>\n" +
+ "\t<soapenv:Body>\n" +
+ "\t\t<rpcOp:echoItResponse xmlns:rpcOp=\"http://headers.message.jaxws.axis2.apache.org/W2JRLR2738TestService.wsdl\">\n" +
+ "\t\t\t<result xmlns:ns2=\"http://headers.message.jaxws.axis2.apache.org/types4\">Got it</result>\n" +
+ "\t\t</rpcOp:echoItResponse>\n" +
+ "\t</soapenv:Body>\n" +
+ "</soapenv:Envelope>";
+
+ // Create a SOAP OM out of the sample incoming XML. This
+ // simulates what Axis2 will be doing with the inbound message.
+ StringReader sr = new StringReader(xml);
+ XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);
+ StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow, null);
+ OMElement omElement = builder.getSOAPEnvelope();
+
+ // Create a SOAP 1.1 Message from the sample incoming XML
+ MessageFactory mf = (MessageFactory)
+ FactoryRegistry.getFactory(MessageFactory.class);
+ Message m = mf.createFrom(omElement, null);
+
+ // Check to see if the message is a fault. The client/server will always call this method.
+ // The Message must respond appropriately without doing a conversion.
+ boolean isFault = m.isFault();
+ assertTrue(!isFault);
+ assertTrue("XMLPart Representation is " + m.getXMLPartContentType(),
+ "OM".equals(m.getXMLPartContentType()));
+
+ // Indicate that the message should be accessed as RPC
+ m.setStyle(Style.RPC);
+
+ // Get the BlockFactory
+ JAXBBlockFactory bf = (JAXBBlockFactory)
+ FactoryRegistry.getFactory(JAXBBlockFactory.class);
+
+ // Create the JAXBContext instance that will be used
+ // to deserialize the JAX-B object content in the message.
+ JAXBBlockContext context = new JAXBBlockContext(ConfigHeader.class.getPackage().getName());
+
+ // Check to see if the message is a fault. The client/server will always call this method.
+ // The Message must respond appropriately without doing a conversion.
+ isFault = m.isFault();
+ assertTrue(!isFault);
+
+ // Get the JAXBBlock that wraps the content
+ Block block = m.getHeaderBlock("http://headers.message.jaxws.axis2.apache.org/types4","ConfigHeader2", context, bf);
+
+ // Get the business object from the block, which should be a
+ // JAX-B object
+ Object bo = block.getBusinessObject(true);
+
+ // Check to make sure the right object was returned
+ assertNotNull(bo);
+ if (bo instanceof JAXBElement) {
+ bo = ((JAXBElement) bo).getValue();
+ }
+ assertTrue(bo instanceof ConfigHeader);
+
+ Block block2 = m.getBodyBlock(context, bf);
+ Object b2 = block2.getBusinessObject(true);
+
+ assertTrue(b2 instanceof String);
+ }
}
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigHeader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigHeader.java?rev=647998&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigHeader.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigHeader.java Mon Apr 14 14:09:46 2008
@@ -0,0 +1,80 @@
+/*
+ * 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.axis2.jaxws.message.headers;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for ConfigHeader complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="ConfigHeader">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="message" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ConfigHeader", propOrder = {
+ "message"
+})
+public class ConfigHeader {
+
+ @XmlElement(required = true)
+ protected String message;
+
+ /**
+ * Gets the value of the message property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Sets the value of the message property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMessage(String value) {
+ this.message = value;
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ObjectFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ObjectFactory.java?rev=647998&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ObjectFactory.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ObjectFactory.java Mon Apr 14 14:09:46 2008
@@ -0,0 +1,73 @@
+/*
+ * 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.axis2.jaxws.message.headers;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _ConfigHeader1_QNAME = new QName("http://headers.message.jaxws.axis2.apache.org/types4", "ConfigHeader1");
+ private final static QName _ConfigHeader3_QNAME = new QName("http://headers.message.jaxws.axis2.apache.org/types4", "ConfigHeader3");
+ private final static QName _ConfigHeader2_QNAME = new QName("http://headers.message.jaxws.axis2.apache.org/types4", "ConfigHeader2");
+
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link ConfigHeader }
+ *
+ */
+ public ConfigHeader createConfigHeader() {
+ return new ConfigHeader();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link ConfigHeader }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://headers.message.jaxws.axis2.apache.org/types4", name = "ConfigHeader1")
+ public JAXBElement<ConfigHeader> createConfigHeader1(ConfigHeader value) {
+ return new JAXBElement<ConfigHeader>(_ConfigHeader1_QNAME, ConfigHeader.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link ConfigHeader }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://headers.message.jaxws.axis2.apache.org/types4", name = "ConfigHeader3")
+ public JAXBElement<ConfigHeader> createConfigHeader3(ConfigHeader value) {
+ return new JAXBElement<ConfigHeader>(_ConfigHeader3_QNAME, ConfigHeader.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link ConfigHeader }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://headers.message.jaxws.axis2.apache.org/types4", name = "ConfigHeader2")
+ public JAXBElement<ConfigHeader> createConfigHeader2(ConfigHeader value) {
+ return new JAXBElement<ConfigHeader>(_ConfigHeader2_QNAME, ConfigHeader.class, null, value);
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/package-info.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/package-info.java?rev=647998&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/package-info.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/package-info.java Mon Apr 14 14:09:46 2008
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://headers.message.jaxws.axis2.apache.org/types4")
+package org.apache.axis2.jaxws.message.headers;
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org