JBossWS SVN: r9678 - stack/metro/trunk/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-03-25 05:35:56 -0400 (Wed, 25 Mar 2009)
New Revision: 9678
Modified:
stack/metro/trunk/modules/testsuite/test-excludes-jboss423.txt
stack/metro/trunk/modules/testsuite/test-excludes-jboss500.txt
stack/metro/trunk/modules/testsuite/test-excludes-jboss501.txt
stack/metro/trunk/modules/testsuite/test-excludes-jboss510.txt
stack/metro/trunk/modules/testsuite/test-excludes-jboss600.txt
Log:
[JBWS-2532] Enabling Tests
Modified: stack/metro/trunk/modules/testsuite/test-excludes-jboss423.txt
===================================================================
--- stack/metro/trunk/modules/testsuite/test-excludes-jboss423.txt 2009-03-25 09:31:35 UTC (rev 9677)
+++ stack/metro/trunk/modules/testsuite/test-excludes-jboss423.txt 2009-03-25 09:35:56 UTC (rev 9678)
@@ -60,6 +60,3 @@
# [JBWS-2527] BeanFactory not initialized or already closed (fixed on AS 5.x series only)
org/jboss/test/ws/jaxws/jbws2527/**
-
-# [JBWS-2532] Fix MTOM/XOP Content Type Testcase failure
-org/jboss/test/ws/jaxws/jbws2419/**
Modified: stack/metro/trunk/modules/testsuite/test-excludes-jboss500.txt
===================================================================
--- stack/metro/trunk/modules/testsuite/test-excludes-jboss500.txt 2009-03-25 09:31:35 UTC (rev 9677)
+++ stack/metro/trunk/modules/testsuite/test-excludes-jboss500.txt 2009-03-25 09:35:56 UTC (rev 9678)
@@ -47,6 +47,3 @@
# [JBWS-2462] Address rewrite test fails in Metro integration
org/jboss/test/ws/jaxws/jbws2150/**
-
-# [JBWS-2532] Fix MTOM/XOP Content Type Testcase failure
-org/jboss/test/ws/jaxws/jbws2419/**
Modified: stack/metro/trunk/modules/testsuite/test-excludes-jboss501.txt
===================================================================
--- stack/metro/trunk/modules/testsuite/test-excludes-jboss501.txt 2009-03-25 09:31:35 UTC (rev 9677)
+++ stack/metro/trunk/modules/testsuite/test-excludes-jboss501.txt 2009-03-25 09:35:56 UTC (rev 9678)
@@ -44,6 +44,3 @@
# [JBWS-2462] Address rewrite test fails in Metro integration
org/jboss/test/ws/jaxws/jbws2150/**
-
-# [JBWS-2532] Fix MTOM/XOP Content Type Testcase failure
-org/jboss/test/ws/jaxws/jbws2419/**
Modified: stack/metro/trunk/modules/testsuite/test-excludes-jboss510.txt
===================================================================
--- stack/metro/trunk/modules/testsuite/test-excludes-jboss510.txt 2009-03-25 09:31:35 UTC (rev 9677)
+++ stack/metro/trunk/modules/testsuite/test-excludes-jboss510.txt 2009-03-25 09:35:56 UTC (rev 9678)
@@ -44,6 +44,3 @@
# [JBWS-2462] Address rewrite test fails in Metro integration
org/jboss/test/ws/jaxws/jbws2150/**
-
-# [JBWS-2532] Fix MTOM/XOP Content Type Testcase failure
-org/jboss/test/ws/jaxws/jbws2419/**
Modified: stack/metro/trunk/modules/testsuite/test-excludes-jboss600.txt
===================================================================
--- stack/metro/trunk/modules/testsuite/test-excludes-jboss600.txt 2009-03-25 09:31:35 UTC (rev 9677)
+++ stack/metro/trunk/modules/testsuite/test-excludes-jboss600.txt 2009-03-25 09:35:56 UTC (rev 9678)
@@ -44,6 +44,3 @@
# [JBWS-2462] Address rewrite test fails in Metro integration
org/jboss/test/ws/jaxws/jbws2150/**
-
-# [JBWS-2532] Fix MTOM/XOP Content Type Testcase failure
-org/jboss/test/ws/jaxws/jbws2419/**
15 years, 9 months
JBossWS SVN: r9677 - in framework/trunk/testsuite/test: java/org/jboss/test/ws/jaxws/jbws2419 and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-03-25 05:31:35 -0400 (Wed, 25 Mar 2009)
New Revision: 9677
Added:
framework/trunk/testsuite/test/resources/jaxws/jbws2419/WEB-INF/wsdl/
framework/trunk/testsuite/test/resources/jaxws/jbws2419/WEB-INF/wsdl/SOAP12Service.wsdl
Modified:
framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/JBWS2419TestCase.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ClientHandler.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11Endpoint.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11EndpointBean.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ServerHandler.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ClientHandler.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12Endpoint.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12EndpointBean.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ServerHandler.java
Log:
[JBWS-2532] Fix MTOM/XOP Content Type Testcase failure
Modified: framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml
===================================================================
--- framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml 2009-03-24 18:34:35 UTC (rev 9676)
+++ framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml 2009-03-25 09:31:35 UTC (rev 9677)
@@ -659,6 +659,9 @@
<include name="org/jboss/test/ws/jaxws/jbws2419/jaxws-server-handlers1.xml"/>
<include name="org/jboss/test/ws/jaxws/jbws2419/jaxws-server-handlers2.xml"/>
</classes>
+ <webinf dir="${tests.output.dir}/test-resources/jaxws/jbws2419/WEB-INF">
+ <include name="wsdl/*"/>
+ </webinf>
</war>
<!-- jaxws-jbws2449 -->
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/JBWS2419TestCase.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/JBWS2419TestCase.java 2009-03-24 18:34:35 UTC (rev 9676)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/JBWS2419TestCase.java 2009-03-25 09:31:35 UTC (rev 9677)
@@ -74,8 +74,8 @@
((SOAPBinding)provider.getBinding()).setMTOMEnabled(true);
DataHandler response = port.namespace(new DataHandler("Jimbo","text/plain"));
- Object nsURI = getContent(response);
- assertEquals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, nsURI);
+ Object messg = getContent(response);
+ assertEquals("Hello Jimbo", messg);
}
public void testSOAP11ClientAccess() throws Exception
@@ -93,8 +93,8 @@
((SOAPBinding)provider.getBinding()).setMTOMEnabled(true);
DataHandler response = port.namespace(new DataHandler("Jimbo","text/plain"));
- Object nsURI = getContent(response);
- assertEquals(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, nsURI);
+ Object messg = getContent(response);
+ assertEquals("Hello Jimbo", messg);
}
protected Object getContent(DataHandler dh) throws IOException
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ClientHandler.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ClientHandler.java 2009-03-24 18:34:35 UTC (rev 9676)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ClientHandler.java 2009-03-25 09:31:35 UTC (rev 9677)
@@ -21,9 +21,14 @@
*/
package org.jboss.test.ws.jaxws.jbws2419;
+import java.util.ArrayList;
+import java.util.Map;
+
import javax.mail.internet.ContentType;
+import javax.mail.internet.ParseException;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.WebServiceException;
@@ -47,55 +52,75 @@
{
log.info("handleInbound");
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ try
+ {
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope)((SOAPMessageContext)msgContext).getMessage().getSOAPPart().getEnvelope();
+ String nsURI = soapEnvelope.getNamespaceURI();
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- String[] ct = mimeHeaders.getHeader("Content-Type");
- ContentType contentType;
- if (ct != null)
- {
- try
+ log.info("nsURI=" + nsURI);
+
+ if (!SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(nsURI))
{
- contentType = new ContentType(ct[0]);
- log.info("contentType="+contentType);
- String startInfo = contentType.getParameter("start-info");
- if (startInfo.equals(SOAPConstants.SOAP_1_1_CONTENT_TYPE))
- {
- return true;
- }
+ return false;
}
- catch(Exception e)
+ }
+ catch (SOAPException se)
+ {
+ throw new WebServiceException(se);
+ }
+
+ ContentType contentType = getContentType(msgContext);
+
+ if (contentType != null)
+ {
+ log.info("contentType="+contentType);
+ String startInfo = contentType.getParameter("start-info");
+ if (!startInfo.equals(SOAPConstants.SOAP_1_1_CONTENT_TYPE))
{
- throw new WebServiceException(e);
+ return false;
}
}
- return false;
+ else
+ {
+ return false;
+ }
+
+ return true;
}
- protected boolean handleOutbound(MessageContext msgContext)
+ protected ContentType getContentType(MessageContext msgContext)
{
- log.info("handleOutbound");
+ ContentType contentType = null;
try
{
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
- soapMessage.saveChanges();
+ //Metro does not process this header into the message
+ Map<String,ArrayList> headers = (Map)msgContext.get(MessageContext.HTTP_REQUEST_HEADERS);
+ ArrayList<String> ctype = (headers == null) ? null : headers.get("Content-Type");
+ log.info("ctype="+ctype);
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- String[] ct = mimeHeaders.getHeader("Content-Type");
- ContentType contentType;
- if (ct != null)
+ if (ctype == null)
{
- contentType = new ContentType(ct[0]);
- log.info("contentType="+contentType);
- if (contentType.getBaseType().equals(SOAPConstants.SOAP_1_1_CONTENT_TYPE))
- return true;
+ //Native has already processed this header into the message
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ String[] ct = mimeHeaders.getHeader("Content-Type");
+ log.info("ct="+ct);
+ if (ct != null)
+ {
+ contentType = new ContentType(ct[0]);
+ }
}
- return false;
+ else
+ {
+ contentType = new ContentType(ctype.get(0));
+ }
}
- catch (Exception ex)
+ catch (ParseException e)
{
- throw new WebServiceException(ex);
+ throw new WebServiceException(e);
}
+
+ return contentType;
}
}
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11Endpoint.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11Endpoint.java 2009-03-24 18:34:35 UTC (rev 9676)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11Endpoint.java 2009-03-25 09:31:35 UTC (rev 9677)
@@ -21,7 +21,7 @@
*/
package org.jboss.test.ws.jaxws.jbws2419;
-import static javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING;
+import static javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING;
import javax.activation.DataHandler;
import javax.jws.WebService;
@@ -31,9 +31,7 @@
import javax.xml.ws.BindingType;
@WebService(name = "SOAP11Endpoint", targetNamespace = "http://org.jboss.ws/jaxws/jbws2419")
-@SOAPBinding(style = Style.RPC)
-@BindingType(SOAP11HTTP_BINDING)
-
+@BindingType(SOAP11HTTP_MTOM_BINDING)
public interface SOAP11Endpoint
{
@XmlMimeType("text/plain")
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11EndpointBean.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11EndpointBean.java 2009-03-24 18:34:35 UTC (rev 9676)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11EndpointBean.java 2009-03-25 09:31:35 UTC (rev 9677)
@@ -21,63 +21,64 @@
*/
package org.jboss.test.ws.jaxws.jbws2419;
-import static javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING;
+import static javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING;
+import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import javax.activation.DataHandler;
-import javax.annotation.Resource;
import javax.jws.HandlerChain;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlMimeType;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
import javax.xml.ws.BindingType;
-import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.spi.Provider;
import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-import javax.xml.ws.soap.MTOM;
import org.jboss.logging.Logger;
-@WebService(name="SOAP11Endpoint", targetNamespace="http://org.jboss.ws/jaxws/jbws2419",
- endpointInterface = "org.jboss.test.ws.jaxws.jbws2419.SOAP11Endpoint")
-@BindingType(SOAP11HTTP_BINDING)
-@MTOM
+@WebService(name="SOAP11Endpoint", targetNamespace="http://org.jboss.ws/jaxws/jbws2419")
@HandlerChain(file = "jaxws-server-handlers1.xml")
+@BindingType(SOAP11HTTP_MTOM_BINDING)
public class SOAP11EndpointBean implements SOAP11Endpoint
{
private static Logger log = Logger.getLogger(SOAP11EndpointBean.class);
- @Resource
- public WebServiceContext context;
-
@XmlMimeType("text/plain")
public DataHandler namespace(@XmlMimeType("text/plain") DataHandler data)
{
try
{
- String name = (String)data.getContent();
+ String name = (String)getContent(data);
String type = (String)data.getContentType();
log.info("User " + name + " requested namespace with content type ["+ type +"]");
- SOAPMessageContext msgContext = (SOAPMessageContext)context.getMessageContext();
- SOAPMessage soapMessage = msgContext.getMessage();
- SOAPEnvelope soapEnvelope = (SOAPEnvelope)soapMessage.getSOAPPart().getEnvelope();
- String nsURI = soapEnvelope.getNamespaceURI();
-
- log.info(nsURI);
-
- return new DataHandler(nsURI, "text/plain");
+ return new DataHandler("Hello " + name, "text/plain");
}
catch (IOException e)
{
throw new WebServiceException(e);
}
- catch (SOAPException ex)
+ }
+
+ protected Object getContent(DataHandler dh) throws IOException
+ {
+ Object content = dh.getContent();
+
+ // Metro returns an ByteArrayInputStream
+ if (content instanceof InputStream)
{
- throw new WebServiceException(ex);
+ try
+ {
+ BufferedReader br = new BufferedReader(new InputStreamReader((InputStream)content));
+ return br.readLine();
+ }
+ finally
+ {
+ ((InputStream)content).close();
+ }
}
+ return content;
}
}
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ServerHandler.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ServerHandler.java 2009-03-24 18:34:35 UTC (rev 9676)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ServerHandler.java 2009-03-25 09:31:35 UTC (rev 9677)
@@ -21,9 +21,14 @@
*/
package org.jboss.test.ws.jaxws.jbws2419;
+import java.util.ArrayList;
+import java.util.Map;
+
import javax.mail.internet.ContentType;
+import javax.mail.internet.ParseException;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.WebServiceException;
@@ -47,55 +52,74 @@
{
log.info("handleInbound");
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ ContentType contentType = getContentType(msgContext);
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- String[] ct = mimeHeaders.getHeader("Content-Type");
- ContentType contentType;
- if (ct != null)
+ if (contentType != null)
{
- try
+ log.info("contentType="+contentType);
+ String startInfo = contentType.getParameter("start-info");
+ if (!startInfo.equals(SOAPConstants.SOAP_1_1_CONTENT_TYPE))
{
- contentType = new ContentType(ct[0]);
- log.info("contentType="+contentType);
- String startInfo = contentType.getParameter("start-info");
- if (startInfo.equals(SOAPConstants.SOAP_1_1_CONTENT_TYPE))
- {
- return true;
- }
+ return false;
}
- catch(Exception e)
+ }
+ else
+ {
+ return false;
+ }
+ try
+ {
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope)((SOAPMessageContext)msgContext).getMessage().getSOAPPart().getEnvelope();
+ String nsURI = soapEnvelope.getNamespaceURI();
+
+ log.info("nsURI=" + nsURI);
+
+ if (!SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(nsURI))
{
- throw new WebServiceException(e);
+ return false;
}
}
- return false;
+ catch (SOAPException se)
+ {
+ throw new WebServiceException(se);
+ }
+
+ return true;
}
- protected boolean handleOutbound(MessageContext msgContext)
+ protected ContentType getContentType(MessageContext msgContext)
{
- log.info("handleOutbound");
+ ContentType contentType = null;
try
{
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
- soapMessage.saveChanges();
+ //Metro does not process this header into the message
+ Map<String,ArrayList> headers = (Map)msgContext.get(MessageContext.HTTP_REQUEST_HEADERS);
+ ArrayList<String> ctype = (headers == null) ? null : headers.get("Content-Type");
+ log.info("ctype="+ctype);
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- String[] ct = mimeHeaders.getHeader("Content-Type");
- ContentType contentType;
- if (ct != null)
+ if (ctype == null)
{
- contentType = new ContentType(ct[0]);
- log.info("contentType="+contentType);
- if (contentType.getBaseType().equals(SOAPConstants.SOAP_1_1_CONTENT_TYPE))
- return true;
+ //Native has already processed this header into the message
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ String[] ct = mimeHeaders.getHeader("Content-Type");
+ log.info("ct="+ct);
+ if (ct != null)
+ {
+ contentType = new ContentType(ct[0]);
+ }
}
- return false;
+ else
+ {
+ contentType = new ContentType(ctype.get(0));
+ }
}
- catch (Exception ex)
+ catch (ParseException e)
{
- throw new WebServiceException(ex);
+ throw new WebServiceException(e);
}
+
+ return contentType;
}
}
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ClientHandler.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ClientHandler.java 2009-03-24 18:34:35 UTC (rev 9676)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ClientHandler.java 2009-03-25 09:31:35 UTC (rev 9677)
@@ -21,9 +21,14 @@
*/
package org.jboss.test.ws.jaxws.jbws2419;
+import java.util.ArrayList;
+import java.util.Map;
+
import javax.mail.internet.ContentType;
+import javax.mail.internet.ParseException;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.WebServiceException;
@@ -47,55 +52,75 @@
{
log.info("handleInbound");
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ try
+ {
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope)((SOAPMessageContext)msgContext).getMessage().getSOAPPart().getEnvelope();
+ String nsURI = soapEnvelope.getNamespaceURI();
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- String[] ct = mimeHeaders.getHeader("Content-Type");
- ContentType contentType;
- if (ct != null)
- {
- try
+ log.info("nsURI=" + nsURI);
+
+ if (!SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(nsURI))
{
- contentType = new ContentType(ct[0]);
- log.info("contentType="+contentType);
- String startInfo = contentType.getParameter("start-info");
- if (startInfo.equals(SOAPConstants.SOAP_1_2_CONTENT_TYPE))
- {
- return true;
- }
+ return false;
}
- catch(Exception e)
+ }
+ catch (SOAPException se)
+ {
+ throw new WebServiceException(se);
+ }
+
+ ContentType contentType = getContentType(msgContext);
+
+ if (contentType != null)
+ {
+ log.info("contentType="+contentType);
+ String startInfo = contentType.getParameter("start-info");
+ if (!startInfo.equals(SOAPConstants.SOAP_1_2_CONTENT_TYPE))
{
- throw new WebServiceException(e);
+ return false;
}
}
- return false;
+ else
+ {
+ return false;
+ }
+
+ return true;
}
- protected boolean handleOutbound(MessageContext msgContext)
+ protected ContentType getContentType(MessageContext msgContext)
{
- log.info("handleOutbound");
+ ContentType contentType = null;
try
{
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
- soapMessage.saveChanges();
+ //Metro does not process this header into the message
+ Map<String,ArrayList> headers = (Map)msgContext.get(MessageContext.HTTP_REQUEST_HEADERS);
+ ArrayList<String> ctype = (headers == null) ? null : headers.get("Content-Type");
+ log.info("ctype="+ctype);
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- String[] ct = mimeHeaders.getHeader("Content-Type");
- ContentType contentType;
- if (ct != null)
+ if (ctype == null)
{
- contentType = new ContentType(ct[0]);
- log.info("contentType="+contentType);
- if (contentType.getBaseType().equals(SOAPConstants.SOAP_1_2_CONTENT_TYPE))
- return true;
+ //Native has already processed this header into the message
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ String[] ct = mimeHeaders.getHeader("Content-Type");
+ log.info("ct="+ct);
+ if (ct != null)
+ {
+ contentType = new ContentType(ct[0]);
+ }
}
- return false;
+ else
+ {
+ contentType = new ContentType(ctype.get(0));
+ }
}
- catch (Exception ex)
+ catch (ParseException e)
{
- throw new WebServiceException(ex);
+ throw new WebServiceException(e);
}
+
+ return contentType;
}
}
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12Endpoint.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12Endpoint.java 2009-03-24 18:34:35 UTC (rev 9676)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12Endpoint.java 2009-03-25 09:31:35 UTC (rev 9677)
@@ -21,7 +21,7 @@
*/
package org.jboss.test.ws.jaxws.jbws2419;
-import static javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING;
+import static javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_MTOM_BINDING;
import javax.activation.DataHandler;
import javax.jws.WebService;
@@ -31,9 +31,7 @@
import javax.xml.ws.BindingType;
@WebService(name = "SOAP12Endpoint", targetNamespace = "http://org.jboss.ws/jaxws/jbws2419")
-@SOAPBinding(style = Style.RPC)
-@BindingType(SOAP12HTTP_BINDING)
-
+@BindingType(SOAP12HTTP_MTOM_BINDING)
public interface SOAP12Endpoint
{
@XmlMimeType("text/plain")
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12EndpointBean.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12EndpointBean.java 2009-03-24 18:34:35 UTC (rev 9676)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12EndpointBean.java 2009-03-25 09:31:35 UTC (rev 9677)
@@ -21,63 +21,64 @@
*/
package org.jboss.test.ws.jaxws.jbws2419;
-import static javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING;
+import static javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_MTOM_BINDING;
+import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import javax.activation.DataHandler;
-import javax.annotation.Resource;
import javax.jws.HandlerChain;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlMimeType;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
import javax.xml.ws.BindingType;
-import javax.xml.ws.WebServiceContext;
import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-import javax.xml.ws.soap.MTOM;
import org.jboss.logging.Logger;
-@WebService(name="SOAP12Endpoint", targetNamespace="http://org.jboss.ws/jaxws/jbws2419",
- endpointInterface = "org.jboss.test.ws.jaxws.jbws2419.SOAP12Endpoint")
-@BindingType(SOAP12HTTP_BINDING)
-@MTOM
+@WebService(name="SOAP12Endpoint", targetNamespace="http://org.jboss.ws/jaxws/jbws2419",
+ wsdlLocation = "WEB-INF/wsdl/SOAP12Service.wsdl")
@HandlerChain(file = "jaxws-server-handlers2.xml")
+@BindingType(SOAP12HTTP_MTOM_BINDING)
public class SOAP12EndpointBean implements SOAP12Endpoint
{
private static Logger log = Logger.getLogger(SOAP12EndpointBean.class);
- @Resource
- public WebServiceContext context;
-
@XmlMimeType("text/plain")
public DataHandler namespace(@XmlMimeType("text/plain") DataHandler data)
{
try
{
- String name = (String)data.getContent();
+ String name = (String)getContent(data);
String type = (String)data.getContentType();
log.info("User " + name + " requested namespace with content type ["+ type +"]");
- SOAPMessageContext msgContext = (SOAPMessageContext)context.getMessageContext();
- SOAPMessage soapMessage = msgContext.getMessage();
- SOAPEnvelope soapEnvelope = (SOAPEnvelope)soapMessage.getSOAPPart().getEnvelope();
- String nsURI = soapEnvelope.getNamespaceURI();
-
- log.info(nsURI);
-
- return new DataHandler(nsURI, "text/plain");
+ return new DataHandler("Hello " + name, "text/plain");
}
catch (IOException e)
{
throw new WebServiceException(e);
}
- catch (SOAPException ex)
+ }
+
+ protected Object getContent(DataHandler dh) throws IOException
+ {
+ Object content = dh.getContent();
+
+ // Metro returns an ByteArrayInputStream
+ if (content instanceof InputStream)
{
- throw new WebServiceException(ex);
+ try
+ {
+ BufferedReader br = new BufferedReader(new InputStreamReader((InputStream)content));
+ return br.readLine();
+ }
+ finally
+ {
+ ((InputStream)content).close();
+ }
}
+ return content;
}
}
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ServerHandler.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ServerHandler.java 2009-03-24 18:34:35 UTC (rev 9676)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ServerHandler.java 2009-03-25 09:31:35 UTC (rev 9677)
@@ -21,10 +21,14 @@
*/
package org.jboss.test.ws.jaxws.jbws2419;
+import java.util.ArrayList;
+import java.util.Map;
+
import javax.mail.internet.ContentType;
import javax.mail.internet.ParseException;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.WebServiceException;
@@ -48,59 +52,74 @@
{
log.info("handleInbound");
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ ContentType contentType = getContentType(msgContext);
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- String[] ct = mimeHeaders.getHeader("Content-Type");
- ContentType contentType;
- if (ct != null)
+ if (contentType != null)
{
- try
+ log.info("contentType="+contentType);
+ String startInfo = contentType.getParameter("start-info");
+ if (!startInfo.equals(SOAPConstants.SOAP_1_2_CONTENT_TYPE))
{
- contentType = new ContentType(ct[0]);
- log.info("contentType="+contentType);
- String startInfo = contentType.getParameter("start-info");
- if (startInfo.equals(SOAPConstants.SOAP_1_2_CONTENT_TYPE))
- {
- return true;
- }
+ return false;
}
- catch(Exception e)
+ }
+ else
+ {
+ return false;
+ }
+ try
+ {
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope)((SOAPMessageContext)msgContext).getMessage().getSOAPPart().getEnvelope();
+ String nsURI = soapEnvelope.getNamespaceURI();
+
+ log.info("nsURI=" + nsURI);
+
+ if (!SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(nsURI))
{
- throw new WebServiceException(e);
+ return false;
}
}
- return false;
+ catch (SOAPException se)
+ {
+ throw new WebServiceException(se);
+ }
+
+ return true;
}
- protected boolean handleOutbound(MessageContext msgContext)
+ protected ContentType getContentType(MessageContext msgContext)
{
- log.info("handleOutbound");
+ ContentType contentType = null;
try
{
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
- soapMessage.saveChanges();
+ //Metro does not process this header into the message
+ Map<String,ArrayList> headers = (Map)msgContext.get(MessageContext.HTTP_REQUEST_HEADERS);
+ ArrayList<String> ctype = (headers == null) ? null : headers.get("Content-Type");
+ log.info("ctype="+ctype);
- MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
- String[] ct = mimeHeaders.getHeader("Content-Type");
- ContentType contentType;
- if (ct != null)
+ if (ctype == null)
{
- contentType = new ContentType(ct[0]);
- log.info("contentType="+contentType);
- if (contentType.getBaseType().equals(SOAPConstants.SOAP_1_2_CONTENT_TYPE))
- return true;
+ //Native has already processed this header into the message
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ String[] ct = mimeHeaders.getHeader("Content-Type");
+ log.info("ct="+ct);
+ if (ct != null)
+ {
+ contentType = new ContentType(ct[0]);
+ }
}
- return false;
+ else
+ {
+ contentType = new ContentType(ctype.get(0));
+ }
}
catch (ParseException e)
{
throw new WebServiceException(e);
}
- catch (SOAPException ex)
- {
- throw new WebServiceException(ex);
- }
+
+ return contentType;
}
}
Added: framework/trunk/testsuite/test/resources/jaxws/jbws2419/WEB-INF/wsdl/SOAP12Service.wsdl
===================================================================
--- framework/trunk/testsuite/test/resources/jaxws/jbws2419/WEB-INF/wsdl/SOAP12Service.wsdl (rev 0)
+++ framework/trunk/testsuite/test/resources/jaxws/jbws2419/WEB-INF/wsdl/SOAP12Service.wsdl 2009-03-25 09:31:35 UTC (rev 9677)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name="SOAP12EndpointBeanService" targetNamespace="http://org.jboss.ws/jaxws/jbws2419" xmlns:tns="http://org.jboss.ws/jaxws/jbws2419" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <types>
+ </types>
+ <message name="SOAP12Endpoint_namespaceResponse">
+ <part name="return" type="xsd:base64Binary">
+ </part>
+ </message>
+ <message name="SOAP12Endpoint_namespace">
+ <part name="arg0" type="xsd:base64Binary">
+ </part>
+ </message>
+ <portType name="SOAP12Endpoint">
+ <operation name="namespace" parameterOrder="arg0">
+ <input message="tns:SOAP12Endpoint_namespace">
+ </input>
+ <output message="tns:SOAP12Endpoint_namespaceResponse">
+ </output>
+ </operation>
+ </portType>
+ <binding name="SOAP12EndpointBinding" type="tns:SOAP12Endpoint">
+ <soap12:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="namespace">
+ <soap12:operation soapAction=""/>
+ <input>
+ <soap12:body use="literal" namespace="http://org.jboss.ws/jaxws/jbws2419"/>
+ </input>
+ <output>
+ <soap12:body use="literal" namespace="http://org.jboss.ws/jaxws/jbws2419"/>
+ </output>
+ </operation>
+ </binding>
+ <service name="SOAP12EndpointBeanService">
+ <port name="SOAP12EndpointPort" binding="tns:SOAP12EndpointBinding">
+ <soap12:address location="http://127.0.0.1:9080/jaxws-jbws2419/soap12"/>
+ </port>
+ </service>
+</definitions>
Property changes on: framework/trunk/testsuite/test/resources/jaxws/jbws2419/WEB-INF/wsdl/SOAP12Service.wsdl
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 9 months
RE: UK Pharmacy Discount ID 611848
by 1981-2009 Pfizer Inc.
About this mailing:
You are receiving this e-mail because you subscribed to MSN Featured Offers. Microsoft respects your privacy. If you do not wish to receive this MSN Featured Offers e-mail, please click the "Unsubscribe" link below. This will not unsubscribe you from e-mail communications from third-party advertisers that may appear in MSN Feature Offers. This shall not constitute an offer by MSN. MSN shall not be responsible or liable for the advertisers' content nor any of the goods or service advertised. Prices and item availability subject to change without notice.
©2009 Microsoft | Unsubscribe at http://kibtowox.cn | More news at http://kibtowox.cn | Prvacy at http://kibtowox.cn
Microsoft Corporation, One Microsoft Way, Redmond, WA 98052
15 years, 9 months