Author: seanoc
Date: Fri Feb 22 09:01:23 2008
New Revision: 630252
URL: http://svn.apache.org/viewvc?rev=630252&view=rev
Log:
Updated to work with latest JAX-WS version.
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/client/callback_infoset.xml
(with props)
Modified:
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/client/Client.java
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/server/ServerImpl.java
Modified:
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/client/Client.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/client/Client.java?rev=630252&r1=630251&r2=630252&view=diff
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/client/Client.java
(original)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/client/Client.java
Fri Feb 22 09:01:23 2008
@@ -21,15 +21,19 @@
package demo.callback.client;
import java.io.File;
+import java.io.InputStream;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Endpoint;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
import org.apache.callback.SOAPService;
import org.apache.callback.ServerPortType;
-import org.apache.cxf.ws.addressing.EndpointReferenceType;
-import org.apache.cxf.wsdl.EndpointReferenceUtils;
+import org.apache.cxf.helpers.XMLUtils;
@@ -75,11 +79,12 @@
SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
ServerPortType port = ss.getSOAPPort();
- EndpointReferenceType ref =
- EndpointReferenceUtils.getEndpointReference(wsdlURL,
- SERVICE_NAME_CALLBACK,
-
PORT_NAME_CALLBACK.getLocalPart());
- EndpointReferenceUtils.setInterfaceName(ref, PORT_TYPE_CALLBACK);
+ InputStream is =
demo.callback.client.Client.class.getResourceAsStream("callback_infoset.xml");
+ Document doc = XMLUtils.parse(is);
+ Element referenceParameters =
XMLUtils.fetchElementByNameAttribute(doc.getDocumentElement(),
+
"wsa:ReferenceParameters",
+ "");
+ W3CEndpointReference ref =
(W3CEndpointReference)endpoint.getEndpointReference(referenceParameters);
String resp = port.registerCallback(ref);
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/client/callback_infoset.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/client/callback_infoset.xml?rev=630252&view=auto
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/client/callback_infoset.xml
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/client/callback_infoset.xml
Fri Feb 22 09:01:23 2008
@@ -0,0 +1,14 @@
+<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+
<wsa:Address>http://localhost:9005/CallbackContext/CallbackPort</wsa:Address>
+ <wsa:ReferenceProperties></wsa:ReferenceProperties>
+ <wsa:ReferenceParameters>
+ <testParameter1>testValue1</testParameter1>
+ <testParameter2>testValue2</testParameter2>
+ </wsa:ReferenceParameters>
+ <wsa:Metadata
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:wsaw="http://www.w3.org/2005/02/addressing/wsdl"
+ xmlns:ns="http://apache.org/callback">
+ <wsaw:ServiceName
EndpointName="CallbackPort">ns:CallbackService</wsaw:ServiceName>
+ </wsa:Metadata>
+</wsa:EndpointReference>
\ No newline at end of file
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/client/callback_infoset.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/client/callback_infoset.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/client/callback_infoset.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified:
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/server/ServerImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/server/ServerImpl.java?rev=630252&r1=630251&r2=630252&view=diff
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/server/ServerImpl.java
(original)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/callback/src/demo/callback/server/ServerImpl.java
Fri Feb 22 09:01:23 2008
@@ -19,18 +19,12 @@
package demo.callback.server;
-import java.net.URL;
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
import org.apache.callback.CallbackPortType;
import org.apache.callback.ServerPortType;
-import org.apache.cxf.jaxb.JAXBUtils;
-import org.apache.cxf.ws.addressing.EndpointReferenceType;
-import org.apache.cxf.wsdl.EndpointReferenceUtils;
-import org.apache.cxf.wsdl.WSDLManager;
-import org.apache.cxf.wsdl11.WSDLManagerImpl;
@javax.jws.WebService(serviceName = "SOAPService",
@@ -40,38 +34,12 @@
public class ServerImpl implements ServerPortType {
- public String registerCallback(EndpointReferenceType callback) {
+ public String registerCallback(W3CEndpointReference callback) {
try {
- WSDLManager manager = new WSDLManagerImpl();
-
- QName interfaceName =
EndpointReferenceUtils.getInterfaceName(callback);
- String wsdlLocation =
EndpointReferenceUtils.getWSDLLocation(callback);
- QName serviceName =
EndpointReferenceUtils.getServiceName(callback);
- String portString = EndpointReferenceUtils.getPortName(callback);
-
- QName portName = new QName(serviceName.getNamespaceURI(),
portString);
-
- StringBuffer seiName = new StringBuffer();
-
seiName.append(JAXBUtils.namespaceURIToPackage(interfaceName.getNamespaceURI()));
- seiName.append(".");
-
seiName.append(JAXBUtils.nameToIdentifier(interfaceName.getLocalPart(),
-
JAXBUtils.IdentifierType.INTERFACE));
-
- System.out.println("the seiname is " + seiName.toString());
- Class<?> sei = null;
- try {
- sei = Class.forName(seiName.toString(),
- true, manager.getClass().getClassLoader());
- } catch (ClassNotFoundException ex) {
- ex.printStackTrace();
- }
-
- URL wsdlURL = new URL(wsdlLocation);
-
- Service service = Service.create(wsdlURL, serviceName);
- CallbackPortType port =
(CallbackPortType)service.getPort(portName, sei);
+ WebServiceFeature[] wfs = new WebServiceFeature[] {};
+ CallbackPortType port =
(CallbackPortType)callback.getPort(CallbackPortType.class, wfs);
System.out.println("Invoking on callback object");
String resp = port.serverSayHi(System.getProperty("user.name"));