You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2017/03/22 16:19:12 UTC
cxf git commit: Update jaxws_spring_boot sample client to make a call
to the service and print result
Repository: cxf
Updated Branches:
refs/heads/master cbbf90575 -> 19c72e204
Update jaxws_spring_boot sample client to make a call to the service and print result
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/19c72e20
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/19c72e20
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/19c72e20
Branch: refs/heads/master
Commit: 19c72e2049bf4cd98bd9e3e09a21e555226f1e60
Parents: cbbf905
Author: Daniel Kulp <dk...@apache.org>
Authored: Wed Mar 22 12:18:48 2017 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Wed Mar 22 12:18:48 2017 -0400
----------------------------------------------------------------------
.../release/samples/jaxws_spring_boot/pom.xml | 4 +++
.../sample/ws/SampleWsApplicationClient.java | 30 ++++++++++++--------
2 files changed, 22 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/19c72e20/distribution/src/main/release/samples/jaxws_spring_boot/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jaxws_spring_boot/pom.xml b/distribution/src/main/release/samples/jaxws_spring_boot/pom.xml
index 000f336..88feb93 100644
--- a/distribution/src/main/release/samples/jaxws_spring_boot/pom.xml
+++ b/distribution/src/main/release/samples/jaxws_spring_boot/pom.xml
@@ -25,6 +25,10 @@
</dependencyManagement>
<dependencies>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>${project.version}</version>
http://git-wip-us.apache.org/repos/asf/cxf/blob/19c72e20/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/SampleWsApplicationClient.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/SampleWsApplicationClient.java b/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/SampleWsApplicationClient.java
index 361b067..e234fd2 100644
--- a/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/SampleWsApplicationClient.java
+++ b/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/SampleWsApplicationClient.java
@@ -19,30 +19,36 @@
package sample.ws;
import java.io.StringReader;
+import java.net.URL;
-import javax.xml.transform.stream.StreamResult;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+
+import org.apache.cxf.staxutils.StaxUtils;
//CHECKSTYLE:OFF
public class SampleWsApplicationClient {
- public static void main(String[] args) {
+ public static void main(String[] args) throws Exception {
String address = "http://localhost:8080/Service/Hello";
- // final String request =
- // "<q0:sayHello xmlns:q0=\"http://service.ws.sample\">Elan</q0:sayHello>";
String request = "<q0:sayHello xmlns:q0=\"http://service.ws.sample/\"><myname>Elan</myname></q0:sayHello>";
StreamSource source = new StreamSource(new StringReader(request));
- StreamResult result = new StreamResult(System.out);
-
- //assertThat(this.output.toString(),
- // containsString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- // + "<ns2:sayHelloResponse xmlns:ns2=\"http://service.ws.sample/\">"
- // + "<return>Hello, Welcome to CXF Spring boot Elan!!!</return>"
- // + "</ns2:sayHelloResponse>"));
+ Service service = Service.create(new URL(address + "?wsdl"),
+ new QName("http://service.ws.sample/" , "HelloService"));
+ Dispatch<Source> disp = service.createDispatch(new QName("http://service.ws.sample/" , "HelloPort"),
+ Source.class, Mode.PAYLOAD);
+
+ Source result = disp.invoke(source);
+ String resultAsString = StaxUtils.toString(result);
+ System.out.println(resultAsString);
+
}
-
}
//CHECKSTYLE:ON