MetadataType metadata = ...; Node oaidcNode = (Node)metadata.getAny(); // org.w3c.dom.Node JAXBContext oaidcContext = ...; Unmarshaller oaidcUnmarshaller = oaidcContext.createUnmarshaller(); // use Unmarshaller.unmarshal(Node) or Unmarshaller.unmarshal(Node, Class<T>)
/** * Create an instance of {@link MetadataType } * */ public MetadataType createMetadataType() { return new MetadataType(); }
public static String getWSDLLocation(EndpointReferenceType ref) { String wsdlLocation = null; MetadataType metadata = ref.getMetadata(); if (metadata != null) { wsdlLocation = metadata.getOtherAttributes().get(WSDL_LOCATION); if (wsdlLocation == null) { wsdlLocation = metadata.getOtherAttributes().get(WSDL_LOCATION2); } } if (null == wsdlLocation) { return null; } return wsdlLocation; }
/** * Sets the service and port name of the provided endpoint reference. * @param ref the endpoint reference. * @param serviceName the name of service. * @param portName the port name. */ public static void setServiceAndPortName(EndpointReferenceType ref, QName serviceName, String portName) { if (null != serviceName) { JAXBElement<ServiceNameType> jaxbElement = getServiceNameType(serviceName, portName); MetadataType mt = WSAEndpointReferenceUtils.getSetMetadata(ref); mt.getAny().add(jaxbElement); } }
/** * Create an instance of {@link MetadataType } * */ public MetadataType createMetadataType() { return new MetadataType(); }
public static String getWSDLLocation(EndpointReferenceType ref) { String wsdlLocation = null; MetadataType metadata = ref.getMetadata(); if (metadata != null) { wsdlLocation = metadata.getOtherAttributes().get(WSDL_LOCATION); if (wsdlLocation == null) { wsdlLocation = metadata.getOtherAttributes().get(WSDL_LOCATION2); } } if (null == wsdlLocation) { return null; } return wsdlLocation; }
/** * Sets the service and port name of the provided endpoint reference. * @param ref the endpoint reference. * @param serviceName the name of service. * @param portName the port name. */ public static void setServiceAndPortName(EndpointReferenceType ref, QName serviceName, String portName) { if (null != serviceName) { JAXBElement<ServiceNameType> jaxbElement = getServiceNameType(serviceName, portName); MetadataType mt = getSetMetadata(ref); mt.getAny().add(jaxbElement); } }
/** * Create an instance of {@link MetadataType } * */ public MetadataType createMetadataType() { return new MetadataType(); }
public static String getWSDLLocation(EndpointReferenceType ref) { String wsdlLocation = null; MetadataType metadata = ref.getMetadata(); if (metadata != null) { wsdlLocation = metadata.getOtherAttributes().get(WSDL_LOCATION); if (wsdlLocation == null) { wsdlLocation = metadata.getOtherAttributes().get(WSDL_LOCATION2); } } if (null == wsdlLocation) { return null; } //TODO The wsdlLocation inserted should be a valid URI //before doing a split. So temporarily return the string //return wsdlLocation.split(" "); return wsdlLocation; }
public static void setPortName(EndpointReferenceType ref, String portName) { MetadataType metadata = ref.getMetadata(); if (metadata != null) { for (Object obj : metadata.getAny()) { if (obj instanceof Element) { Element node = (Element)obj; if (node.getNodeName().contains("ServiceName") && (node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAW) || node.getNamespaceURI().equals(NS_WSAW_2005) || node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAM))) { node.setAttribute(JAXWSAConstants.WSAM_ENDPOINT_NAME, portName); } } else if (obj instanceof JAXBElement) { Object val = ((JAXBElement<?>)obj).getValue(); if (val instanceof ServiceNameType) { ((ServiceNameType)val).setEndpointName(portName); } } else if (obj instanceof ServiceNameType) { ((ServiceNameType)obj).setEndpointName(portName); } } } }
/** * Create an instance of {@link MetadataType } * */ public MetadataType createMetadataType() { return new MetadataType(); }
public static String getWSDLLocation(EndpointReferenceType ref) { String wsdlLocation = null; MetadataType metadata = ref.getMetadata(); if (metadata != null) { wsdlLocation = metadata.getOtherAttributes().get(WSDL_LOCATION); if (wsdlLocation == null) { wsdlLocation = metadata.getOtherAttributes().get(WSDL_LOCATION2); } } if (null == wsdlLocation) { return null; } //TODO The wsdlLocation inserted should be a valid URI //before doing a split. So temporarily return the string //return wsdlLocation.split(" "); return wsdlLocation; }
public static String findMEXLocation(EndpointReferenceType ref) { if (ref.getMetadata() != null && ref.getMetadata().getAny() != null) { for (Object any : ref.getMetadata().getAny()) { if (any instanceof Element) { String addr = findMEXLocation((Element)any); if (addr != null) { return addr; } } } } return null; }
public static MetadataType getSetMetadata(EndpointReferenceType ref) { MetadataType mt = ref.getMetadata(); if (null == mt) { mt = new MetadataType(); ref.setMetadata(mt); } return mt; }
public static void setWSDLLocation(EndpointReferenceType ref, String... wsdlLocation) { MetadataType metadata = getSetMetadata(ref); //wsdlLocation attribute is a list of anyURI. StringBuilder strBuf = new StringBuilder(); for (String str : wsdlLocation) { strBuf.append(str); strBuf.append(" "); } metadata.getOtherAttributes().put(WSDL_LOCATION, strBuf.toString().trim()); }
/** * Sets the service and port name of the provided endpoint reference. * @param ref the endpoint reference. * @param serviceName the name of service. * @param portName the port name. */ public static void setServiceAndPortName(EndpointReferenceType ref, QName serviceName, String portName) { if (null != serviceName) { JAXBElement<ServiceNameType> jaxbElement = getServiceNameType(serviceName, portName); MetadataType mt = getSetMetadata(ref); mt.getAny().add(jaxbElement); } }
public static MetadataType getSetMetadata(EndpointReferenceType ref) { MetadataType mt = ref.getMetadata(); if (null == mt) { mt = new MetadataType(); ref.setMetadata(mt); } return mt; }
public static void setWSDLLocation(EndpointReferenceType ref, String... wsdlLocation) { MetadataType metadata = getSetMetadata(ref); //wsdlLocation attribute is a list of anyURI. StringBuilder strBuf = new StringBuilder(); for (String str : wsdlLocation) { strBuf.append(str); strBuf.append(" "); } metadata.getOtherAttributes().put(WSDL_LOCATION, strBuf.toString().trim()); }
/** * Sets the service and port name of the provided endpoint reference. * @param ref the endpoint reference. * @param serviceName the name of service. * @param portName the port name. */ public static void setServiceAndPortName(EndpointReferenceType ref, QName serviceName, String portName) { if (null != serviceName) { JAXBElement<ServiceNameType> jaxbElement = getServiceNameType(serviceName, portName); MetadataType mt = WSAEndpointReferenceUtils.getSetMetadata(ref); mt.getAny().add(jaxbElement); } }
/** * Create an endpoint reference for the provided wsdl, service and portname. * @param wsdlUrl - url of the wsdl that describes the service. * @param serviceName - the <code>QName</code> of the service. * @param portName - the name of the port. * @return EndpointReferenceType - the endpoint reference */ public static EndpointReferenceType getEndpointReference(URL wsdlUrl, QName serviceName, String portName) { EndpointReferenceType reference = new EndpointReferenceType(); reference.setMetadata(new MetadataType()); setServiceAndPortName(reference, serviceName, portName); setWSDLLocation(reference, wsdlUrl.toString()); return reference; }