Author: thomas.diesler(a)jboss.com
Date: 2007-04-02 08:29:48 -0400 (Mon, 02 Apr 2007)
New Revision: 2747
Modified:
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java
Log:
Add httpbinding testcase
Modified:
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java
===================================================================
---
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java 2007-04-02
12:13:46 UTC (rev 2746)
+++
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java 2007-04-02
12:29:48 UTC (rev 2747)
@@ -23,23 +23,17 @@
// $Id$
-import java.io.ByteArrayInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPConnectionFactory;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.Service.Mode;
-import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.http.HTTPBinding;
import junit.framework.Test;
@@ -58,11 +52,9 @@
*/
public class HttpPayloadTestCase extends JBossWSTest
{
- private String reqString =
- "<ns1:somePayload
xmlns:ns1='http://org.jboss.ws/httpbinding'>Hello</ns1:somePayload>";
+ private String reqString = "<ns1:somePayload
xmlns:ns1='http://org.jboss.ws/httpbinding'>Hello</ns1:somePayload>";
- private String resString =
- "<ns1:somePayload
xmlns:ns1='http://org.jboss.ws/httpbinding'>Hello:InboundLogicalHandler:OutboundLogicalHandler</ns1:somePayload>";
+ private String resString = "<ns1:somePayload
xmlns:ns1='http://org.jboss.ws/httpbinding'>Hello:InboundLogicalHandler:OutboundLogicalHandler</ns1:somePayload>";
public static Test suite()
{
@@ -81,35 +73,11 @@
{
Dispatch<Source> dispatch = createDispatch("ProviderEndpoint");
Source resPayload = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
-
+
Element docElement = getElementFromSource(resPayload);
assertEquals(DOMUtils.parse(resString), docElement);
}
- public void testProviderMessage() throws Exception
- {
- String reqEnvStr =
- "<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
- " <env:Body>" + reqString + "</env:Body>" +
- "</env:Envelope>";
-
- String resEnvString =
- "<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
- " <env:Header/>" +
- " <env:Body>" + resString + "</env:Body>" +
- "</env:Envelope>";
-
- MessageFactory msgFactory = MessageFactory.newInstance();
- SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
- SOAPMessage reqMsg = msgFactory.createMessage(null, new
ByteArrayInputStream(reqEnvStr.getBytes()));
-
- URL epURL = new URL("http://" + getServerHost() +
":8080/jaxws-samples-httpbinding-payload");
- SOAPMessage resMsg = con.call(reqMsg, epURL);
- SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
-
- assertEquals(DOMUtils.parse(resEnvString), resEnv);
- }
-
private Dispatch<Source> createDispatch(String target) throws
MalformedURLException, JAXBException
{
String targetNS = "http://org.jboss.ws/httpbinding";
@@ -118,8 +86,8 @@
URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-samples-httpbinding-payload/" + target + "?wsdl");
Service service = Service.create(serviceName);
- service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
wsdlURL.toExternalForm());
-
+ service.addPort(portName, HTTPBinding.HTTP_BINDING, wsdlURL.toExternalForm());
+
Dispatch<Source> dispatch = service.createDispatch(portName, Source.class,
Mode.PAYLOAD);
return dispatch;
}