You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by cc...@apache.org on 2009/05/20 18:48:28 UTC
svn commit: r776760 - in
/servicemix/smx4/features/trunk/examples/cxf-ws-addressing: README.txt
client.html
Author: ccustine
Date: Wed May 20 16:48:28 2009
New Revision: 776760
URL: http://svn.apache.org/viewvc?rev=776760&view=rev
Log:
SMX4-271 - flesh out features/examples/cxf-ws-addressing
- Added missing files
Added:
servicemix/smx4/features/trunk/examples/cxf-ws-addressing/README.txt
servicemix/smx4/features/trunk/examples/cxf-ws-addressing/client.html
Added: servicemix/smx4/features/trunk/examples/cxf-ws-addressing/README.txt
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-ws-addressing/README.txt?rev=776760&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-ws-addressing/README.txt (added)
+++ servicemix/smx4/features/trunk/examples/cxf-ws-addressing/README.txt Wed May 20 16:48:28 2009
@@ -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.
+ */
+
+Welcome to the ServiceMix cxf ws-addressing example
+===================================================
+
+This example leverages CXF and Spring-DM to create a web service enabled for
+WS-Addressing, and then expose it through the OSGi HTTP Service.
+
+Quick steps to install the sample
+---------------------------------
+
+Launch the ServiceMix Kernel by running
+
+ bin/servicemix
+
+in the root dir of this distribution.
+
+When inside the console, just run the following commands to install the
+example:
+
+ features/install examples-cxf-ws-addressing
+
+If you have all the bundles available in your local repo, the installation
+of the example will be very fast, otherwise it may take some time to
+download everything needed.
+
+Testing the example
+-------------------
+
+When the feature is installed, output for publishing the cxf endpoint
+is displayed to the console.
+
+Now, just open your browser and go to the following url:
+
+ http://localhost:8080/cxf/SoapContext/SoapPort?wsdl
+
+It should display the WSDL of the service (if you use Safari, make sure to
+right click the window and select 'Show Source', else the page will be blank).
+Or you can also test it from ServiceMix console using"
+
+ optional/cat http://localhost:8080/cxf/SoapContext/SoapPort?wsdl
+
+You can also open the client.html page in a browser to try sending a request
+to the service.
+
+Or you can launch a programmatic Java client via:
+
+ mvn compile exec:java
+
+which makes an invocation with WS-Addressing headers and displays the response.
+
+How does it work?
+-----------------
+
+The installation leverages ServiceMix Kernel by installing what's called
+'features'. You can see the features definition file using the following
+command inside ServiceMix console:
+
+ optional/cat mvn:org.apache.servicemix.features/apache-servicemix/${version}/xml/features
+
+The list of available features can be obtained using:
+
+ features/list
+
+
Added: servicemix/smx4/features/trunk/examples/cxf-ws-addressing/client.html
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/cxf-ws-addressing/client.html?rev=776760&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/cxf-ws-addressing/client.html (added)
+++ servicemix/smx4/features/trunk/examples/cxf-ws-addressing/client.html Wed May 20 16:48:28 2009
@@ -0,0 +1,145 @@
+<!--
+
+ 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.
+
+-->
+<html>
+<head>
+<title>ServiceMix 4 CXF-OSGi Example</title>
+<script type="text/javascript">
+var urlToOpen = "http://localhost:8080/cxf/SoapContext/SoapPort"; //default URL to open
+
+function getHTTPObject() {
+ var xmlhttp = false;
+
+ /* Compilation conditionnelle d'IE */
+ /* Check if we are using IE */
+ /*@cc_on
+ @if (@_jscript_version >= 5)
+ try {
+ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
+ } catch (e) {
+ try {
+ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+ } catch (E) {
+ xmlhttp = false;
+ }
+ }
+ @else
+ xmlhttp = false;
+ @end @*/
+
+ /* on essaie de créer l'objet si ce n'est pas déjà fait */
+ /* Create the xmlhttp object if it is not yet defined */
+ if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
+ try {
+ xmlhttp = new XMLHttpRequest();
+ } catch (e) {
+ xmlhttp = false;
+ }
+ }
+
+ if (xmlhttp) {
+ /* on définit ce qui doit se passer quand la page répondra */
+ /* Define the callback function for the response */
+ xmlhttp.onreadystatechange=function() {
+ if (xmlhttp.readyState == 4) { /* 4 : état "complete" */
+ var response = document.getElementById("response");
+ var responseStatus = "";
+ try {
+ responseStatus = xmlhttp.status + "";
+ } catch (e) {
+ responseStatus = "ERROR WHILE RETRIEVING STATUS; MAYBE UNABLE TO CONNECT.";
+ }
+ response.value = "STATUS: " + responseStatus + "\n" + xmlhttp.responseText;
+ }
+ }
+ }
+ return xmlhttp;
+}
+
+function send() {
+ if ((document.getElementById("urlToOpen").value != urlToOpen) && (document.getElementById("urlToOpen").value != "")) {
+ // use user entry if it is not the empty string
+ urlToOpen = document.getElementById("urlToOpen").value;
+ }
+ var xmlhttp = getHTTPObject();
+ if (!xmlhttp) {
+ alert('cound not create XMLHttpRequest object');
+ return;
+ }
+ var request = document.getElementById("request");
+ var response = document.getElementById("response");
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead UniversalBrowserWrite");
+ } catch (e) {
+ }
+ try {
+ xmlhttp.open("POST", urlToOpen, true);
+ } catch (e) {
+ alert('error opening');
+ }
+ xmlhttp.send(request.value);
+}
+
+</script>
+</head>
+
+<body>
+
+<h1>ServiceMix 4 CXF WS-Addressing Example</h1>
+
+<p>Welcome to the CXF WS-Addressing example for ServiceMix 4</p>
+
+<p>Perform a POST into the HTTP binding. This requires JavaScript.</p>
+<p>Target: <input type="text" size="50" id="urlToOpen" value=""><script type="text/javascript">document.getElementById("urlToOpen").value = urlToOpen;</script>.</p>
+
+<table>
+ <tr>
+ <td>
+ <textarea id="request" style="width:600px;height:400px"><?xml version="1.0" encoding="UTF-8"?>
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Header>
+ <MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:10fb2ee6-43db-4d88-a3e5-6316f1763669</MessageID>
+ <To xmlns="http://www.w3.org/2005/08/addressing">http://localhost:9001/SoapContext/SoapPort</To>
+ <ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
+ <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
+ </ReplyTo>
+ <FaultTo xmlns="http://www.w3.org/2005/08/addressing">
+ <Address>http://www.w3.org/2005/08/addressing/anonymou</Address>
+ </FaultTo>
+ <Action xmlns="http://www.w3.org/2005/08/addressing">http://apache.org/hello_world_soap_http/Greeter/sayHiRequest</Action>
+ </soap:Header>
+ <soap:Body>
+ <sayHi xmlns="http://apache.org/hello_world_soap_http/types"/>
+ </soap:Body>
+</soap:Envelope>
+
+ </textarea>
+ </td>
+ <td>
+ <textarea id="response" style="width:600px;height:400px">
+ </textarea>
+ </td>
+ </tr>
+ <tr>
+ <td colspan=2>
+ <input type="button" value="Send" onClick="send();"/>
+ </td>
+ </tr>
+</table>
+</body>
+</html>