[jboss-cvs] JBossAS SVN: r104920 - branches/JBPAPP_5_1/webservices/src/etc/examples/context/java/org/jboss/test/ws/jaxws/samples/context.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue May 18 03:38:26 EDT 2010
Author: alessio.soldano at jboss.com
Date: 2010-05-18 03:38:26 -0400 (Tue, 18 May 2010)
New Revision: 104920
Modified:
branches/JBPAPP_5_1/webservices/src/etc/examples/context/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java
branches/JBPAPP_5_1/webservices/src/etc/examples/context/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java
Log:
[JBPAPP-4243] Updating context sample
Modified: branches/JBPAPP_5_1/webservices/src/etc/examples/context/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java
===================================================================
--- branches/JBPAPP_5_1/webservices/src/etc/examples/context/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java 2010-05-18 07:21:42 UTC (rev 104919)
+++ branches/JBPAPP_5_1/webservices/src/etc/examples/context/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java 2010-05-18 07:38:26 UTC (rev 104920)
@@ -21,7 +21,9 @@
*/
package org.jboss.test.ws.jaxws.samples.context;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.net.URI;
import java.security.Principal;
import javax.annotation.Resource;
@@ -85,7 +87,7 @@
return "fail";
// Check standard jaxws properties
- InputSource wsdlSource = (InputSource)msgContext.get(MessageContext.WSDL_DESCRIPTION);
+ Object wsdl = msgContext.get(MessageContext.WSDL_DESCRIPTION);
QName service = (QName)msgContext.get(MessageContext.WSDL_SERVICE);
QName portType = (QName)msgContext.get(MessageContext.WSDL_INTERFACE);
QName port = (QName)msgContext.get(MessageContext.WSDL_PORT);
@@ -102,8 +104,21 @@
try
{
- Element root = DOMUtils.parse(wsdlSource);
- new DOMWriter(System.out).setPrettyprint(true).print(root);
+ Element root = null;
+ if (wsdl instanceof InputSource)
+ {
+ root = DOMUtils.parse((InputSource)wsdl);
+ }
+ else if (wsdl instanceof URI)
+ {
+ root = DOMUtils.parse(((URI)wsdl).toURL().openStream());
+ }
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ new DOMWriter(out).setPrettyprint(true).print(root);
+ if (!out.toString().contains("http://schemas.xmlsoap.org/wsdl/"))
+ {
+ throw new WebServiceException("Not a wsdl");
+ }
}
catch (IOException ex)
{
Modified: branches/JBPAPP_5_1/webservices/src/etc/examples/context/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java
===================================================================
--- branches/JBPAPP_5_1/webservices/src/etc/examples/context/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java 2010-05-18 07:21:42 UTC (rev 104919)
+++ branches/JBPAPP_5_1/webservices/src/etc/examples/context/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java 2010-05-18 07:38:26 UTC (rev 104920)
@@ -21,7 +21,9 @@
*/
package org.jboss.test.ws.jaxws.samples.context;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.net.URI;
import java.security.Principal;
import javax.annotation.Resource;
@@ -61,7 +63,7 @@
return "fail";
// Check standard jaxws properties
- InputSource wsdlSource = (InputSource)msgContext.get(MessageContext.WSDL_DESCRIPTION);
+ Object wsdl = msgContext.get(MessageContext.WSDL_DESCRIPTION);
QName service = (QName)msgContext.get(MessageContext.WSDL_SERVICE);
QName portType = (QName)msgContext.get(MessageContext.WSDL_INTERFACE);
QName port = (QName)msgContext.get(MessageContext.WSDL_PORT);
@@ -76,10 +78,24 @@
if (!operation.equals(new QName("http://org.jboss.ws/jaxws/context", "testMessageContextProperties")))
throw new WebServiceException("Invalid qname: " + operation);
+
try
{
- Element root = DOMUtils.parse(wsdlSource);
- new DOMWriter(System.out).setPrettyprint(true).print(root);
+ Element root = null;
+ if (wsdl instanceof InputSource)
+ {
+ root = DOMUtils.parse((InputSource)wsdl);
+ }
+ else if (wsdl instanceof URI)
+ {
+ root = DOMUtils.parse(((URI)wsdl).toURL().openStream());
+ }
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ new DOMWriter(out).setPrettyprint(true).print(root);
+ if (!out.toString().contains("http://schemas.xmlsoap.org/wsdl/"))
+ {
+ throw new WebServiceException("Not a wsdl");
+ }
}
catch (IOException ex)
{
More information about the jboss-cvs-commits
mailing list