Skip to content
Snippets Groups Projects
Commit 9b2790ff authored by NTUMBA WA NTUMBA Patient's avatar NTUMBA WA NTUMBA Patient
Browse files

Update setInvocationAddress Method

parent d7f011c9
No related branches found
No related tags found
No related merge requests found
package eu.chorevolution.vsb.test.baseService;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
@WebService(
name = "BaseService",
targetNamespace = "http://services.chorevolution.eu/"
)
public class Base implements BaseService {
protected Map<String,String> address_map=null;
protected String ENDPOINTADDRESS=null;
/**
* Each BasicService subclass has the following lifecycle:
* 1. start the service
* 2. send it its own enpoint address
* 3. send the service dependency data (according to Enactment Engine choreography requirements)
**/
public Base(){
address_map = new HashMap<String, String>();
}
/* (non-Javadoc)
* @see org.choreos.services.Base#setInvocationAddress(java.lang.String, java.lang.String)
*/
/* (non-Javadoc)
* @see eu.chorevolution.enactment.dependencies.ConfigurableService#setInvocationAddress(java.lang.String, java.lang.String, java.util.List)
*/
@WebMethod
public void setInvocationAddress(String role, String name, List<String> endpoints) {
System.out.println("Receive... role:"+role+" name:"+name+" endpoints:"+endpoints.get(0));
if (address_map.containsKey(name)) {
address_map.remove(name);
}
address_map.put(name, endpoints.get(0));
}
/**
* Example call: (Client1) (getPort("Client1", "http://localhost/client1?wsdl", Client1.class));
* @throws MalformedURLException
* */
public static <T> T getPort(String service_name, String wsdlLocation, Class<T> client_class) throws MalformedURLException{
T retPort = null;
QName serviceQName = null;
URL serviceUrl = null;
Service s;
serviceQName = new QName(namespace, service_name+"Service");
serviceUrl = new URL(wsdlLocation);
s = Service.create(serviceUrl, serviceQName);
retPort=(T) s.getPort(client_class);
return retPort;
}
}
package eu.chorevolution.vsb.test.baseService;
import java.util.List;
public interface BaseService {
public final static String namespace="http://services.chorevolution.eu/";
/* (non-Javadoc)
* @see org.choreos.services.Base#setInvocationAddress(java.lang.String, java.lang.String)
*/
void setInvocationAddress(String role, String name, List<String> endpoints);
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.9-b14002 svn-revision#14004. -->
<definitions targetNamespace="http://services.chorevolution.eu/" name="BaseService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:tns="http://services.chorevolution.eu/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
<types>
<xs:schema version="1.0" targetNamespace="http://services.chorevolution.eu/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="setInvocationAddress" type="tns:setInvocationAddress"/>
<xs:element name="setInvocationAddressResponse" type="tns:setInvocationAddressResponse"/>
<xs:complexType name="setInvocationAddress">
<xs:sequence>
<xs:element name="arg0" type="xs:string" minOccurs="0"/>
<xs:element name="arg1" type="xs:string" minOccurs="0"/>
<xs:element name="arg2" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="setInvocationAddressResponse">
<xs:sequence/>
</xs:complexType>
</xs:schema>
</types>
<message name="setInvocationAddress">
<part name="parameters" element="tns:setInvocationAddress"/>
</message>
<message name="setInvocationAddressResponse">
<part name="parameters" element="tns:setInvocationAddressResponse"/>
</message>
<portType name="ConfigurableService">
<operation name="setInvocationAddress">
<input wsam:Action="http://services.chorevolution.eu/ConfigurableService/setInvocationAddressRequest" message="tns:setInvocationAddress"/>
<output wsam:Action="http://services.chorevolution.eu/ConfigurableService/setInvocationAddressResponse" message="tns:setInvocationAddressResponse"/>
</operation>
</portType>
<binding name="ConfigurableServicePortBinding" type="tns:ConfigurableService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="setInvocationAddress">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="BaseService">
<port name="ConfigurableServicePort" binding="tns:ConfigurableServicePortBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>
package eu.chorevolution.vsb.test.baseService;
import javax.xml.ws.Endpoint;
public class BaseServicePublisher {
public static void main(String[] args) {
// TODO Auto-generated method stub
Endpoint.publish("http://localhost:9999/vsb/baseService", new Base());
System.out.println("WebServivce is running on port 9999");
}
}
package eu.chorevolution.vsb.test.baseServiceClient;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPBinding;
import eu.chorevolution.vsb.test.baseService.BaseService;
public class baseServiceClient {
public static void main(String[] args) {
// TODO Auto-generated method stub
URL url = null;
try {
url = new URL("http://localhost:9999/vsb/baseService?wsdl");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
QName qname = new QName("http://services.chorevolution.eu/", "BaseService");
Service service = Service.create(url, qname);
BaseService base = service.getPort(qname,BaseService.class);
String role = "baseService";
String name = "baseService";
List<String> endpoints = new ArrayList<String>();
endpoints.add("192.168.106.20");
base.setInvocationAddress(role, name, endpoints);
}
}
......@@ -15,7 +15,6 @@ public class VsbManagerTest{
public static void main(String[] args) {
String interfaceDescriptionPath = "PATH_TO_GIDL";
generateWarFile(interfaceDescriptionPath);
generateWarBytes(interfaceDescriptionPath);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment