Java Code Examples for javax.wsdl.extensions.ExtensionRegistry#createExtension()

The following examples show how to use javax.wsdl.extensions.ExtensionRegistry#createExtension() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XTeeSoapProvider.java    From j-road with Apache License 2.0 6 votes vote down vote up
private List<SOAPHeader> makeHeaders(Definition definition) throws WSDLException {
  List<SOAPHeader> list = new ArrayList<SOAPHeader>();
  String[] parts = new String[] { XTeeHeader.CLIENT.getLocalPart(), XTeeHeader.SERVICE.getLocalPart(),
                                  XTeeHeader.USER_ID.getLocalPart(), XTeeHeader.ID.getLocalPart(),
                                  XTeeHeader.PROTOCOL_VERSION.getLocalPart() };
  ExtensionRegistry extReg = definition.getExtensionRegistry();
  for (int i = 0; i < parts.length; i++) {
    SOAPHeader header =
        (SOAPHeader) extReg.createExtension(BindingInput.class, new QName(SOAP_11_NAMESPACE_URI, "header"));
    header.setMessage(new QName(definition.getTargetNamespace(), XTeeWsdlDefinition.XROAD_HEADER));
    header.setPart(parts[i]);
    if (use.equalsIgnoreCase(LITERAL)) {
      header.setUse(LITERAL);
    } else {
      header.setUse(ENCODED);
      header.setEncodingStyles(Arrays.asList(ENCODING));
    }
    list.add(header);
  }

  return list;
}
 
Example 2
Source File: XTeeSoapProvider.java    From j-road with Apache License 2.0 6 votes vote down vote up
@Override
protected void populatePort(Definition definition, Port port) throws WSDLException {
  super.populatePort(definition, port);
  ExtensionRegistry extensionRegistry = definition.getExtensionRegistry();
  extensionRegistry.mapExtensionTypes(Port.class,
                                      new QName(XTeeWsdlDefinition.XROAD_NAMESPACE,
                                                "address",
                                                XTeeWsdlDefinition.XROAD_PREFIX),
                                      UnknownExtensibilityElement.class);
  UnknownExtensibilityElement element =
      (UnknownExtensibilityElement) extensionRegistry.createExtension(Port.class,
                                                                      new QName(XTeeWsdlDefinition.XROAD_NAMESPACE,
                                                                                "address",
                                                                                XTeeWsdlDefinition.XROAD_NAMESPACE));
  Document doc;
  try {
    doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  } catch (ParserConfigurationException e) {
    throw new RuntimeException(e);
  }
  Element xRoadAddr = doc.createElementNS(XTeeWsdlDefinition.XROAD_NAMESPACE, "address");
  xRoadAddr.setPrefix(XTeeWsdlDefinition.XROAD_PREFIX);
  xRoadAddr.setAttribute("producer", xRoadDatabase);
  element.setElement(xRoadAddr);
  port.addExtensibilityElement(element);
}
 
Example 3
Source File: JAXWSBindingDeserializer.java    From cxf with Apache License 2.0 6 votes vote down vote up
public ExtensibilityElement unmarshall(@SuppressWarnings("rawtypes") Class parentType,
                                       QName elementType,
                                       Element el,
                                       Definition def,
                                       ExtensionRegistry extReg) throws WSDLException {
    JAXWSBinding jaxwsBinding = (JAXWSBinding)extReg.createExtension(parentType, elementType);

    jaxwsBinding.setElementType(elementType);
    jaxwsBinding.setElement(el);
    jaxwsBinding.setDocumentBaseURI(def.getDocumentBaseURI());

    JAXWSBindingParser parser = new JAXWSBindingParser(extReg);
    parser.parseElement(jaxwsBinding, el);

    return jaxwsBinding;
}
 
Example 4
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static SoapBinding createSoapBinding(ExtensionRegistry extReg, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(Binding.class,
                                                           new QName(WSDLConstants.NS_SOAP12,
                                                                     "binding"));
        ((SOAP12Binding)extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    } else {
        extElement = extReg.createExtension(Binding.class,
                                                         new QName(WSDLConstants.NS_SOAP11,
                                                                   "binding"));
        ((SOAPBinding)extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    }
    return getSoapBinding(extElement);
}
 
Example 5
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static SOAPBinding createSoapBinding(ExtensionRegistry extReg, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(Binding.class,
                                                           new QName(WSDLConstants.NS_SOAP12,
                                                                     "binding"));
        ((SOAP12Binding)extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    } else {
        extElement = extReg.createExtension(Binding.class,
                                                         new QName(WSDLConstants.NS_SOAP11,
                                                                   "binding"));
        ((SOAPBinding)extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    }
    return getSoapBinding(extElement);
}
 
Example 6
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SoapAddress createSoapAddress(ExtensionRegistry extReg, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(Port.class,
                                                           WSDLConstants.QNAME_SOAP12_BINDING_ADDRESS);
    } else {
        extElement = extReg.createExtension(Port.class,
                                                         WSDLConstants.QNAME_SOAP_BINDING_ADDRESS);
    }
    return getSoapAddress(extElement);
}
 
Example 7
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SoapBody createSoapBody(ExtensionRegistry extReg, Class<?> clz, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(clz, new QName(WSDLConstants.NS_SOAP12,
                                                                       "body"));
    } else {
        extElement = extReg.createExtension(clz, new QName(WSDLConstants.NS_SOAP11,
                                                                     "body"));
    }
    return getSoapBody(extElement);
}
 
Example 8
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SoapOperation createSoapOperation(ExtensionRegistry extReg, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(BindingOperation.class,
                                                             new QName(WSDLConstants.NS_SOAP12,
                                                                       "operation"));
    } else {
        extElement = extReg.createExtension(BindingOperation.class,
                                                           new QName(WSDLConstants.NS_SOAP11,
                                                                     "operation"));
    }
    return getSoapOperation(extElement);
}
 
Example 9
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SoapFault createSoapFault(ExtensionRegistry extReg, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(BindingFault.class,
                                                         new QName(WSDLConstants.NS_SOAP12,
                                                                   "fault"));
    } else {
        extElement = extReg.createExtension(BindingFault.class,
                                                       new QName(WSDLConstants.NS_SOAP11,
                                                                 "fault"));
    }
    return getSoapFault(extElement);
}
 
Example 10
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SoapHeader createSoapHeader(ExtensionRegistry extReg, Class<?> clz, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(clz,
                                                          new QName(WSDLConstants.NS_SOAP12,
                                                                    "header"));
    } else {
        extElement = extReg.createExtension(clz,
                                                        new QName(WSDLConstants.NS_SOAP11,
                                                                  "header"));
    }
    return getSoapHeader(extElement);
}
 
Example 11
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SOAPAddress createSoapAddress(ExtensionRegistry extReg, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(Port.class,
                                                           WSDLConstants.QNAME_SOAP12_BINDING_ADDRESS);
    } else {
        extElement = extReg.createExtension(Port.class,
                                                         WSDLConstants.QNAME_SOAP_BINDING_ADDRESS);
    }
    return getSoapAddress(extElement);
}
 
Example 12
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SOAPBody createSoapBody(ExtensionRegistry extReg, Class<?> clz, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(clz, new QName(WSDLConstants.NS_SOAP12,
                                                                       "body"));
    } else {
        extElement = extReg.createExtension(clz, new QName(WSDLConstants.NS_SOAP11,
                                                                     "body"));
    }
    return getSoapBody(extElement);
}
 
Example 13
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SOAPOperation createSoapOperation(ExtensionRegistry extReg, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(BindingOperation.class,
                                                             new QName(WSDLConstants.NS_SOAP12,
                                                                       "operation"));
    } else {
        extElement = extReg.createExtension(BindingOperation.class,
                                                           new QName(WSDLConstants.NS_SOAP11,
                                                                     "operation"));
    }
    return getSoapOperation(extElement);
}
 
Example 14
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SOAPFault createSoapFault(ExtensionRegistry extReg, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(BindingFault.class,
                                                         new QName(WSDLConstants.NS_SOAP12,
                                                                   "fault"));
    } else {
        extElement = extReg.createExtension(BindingFault.class,
                                                       new QName(WSDLConstants.NS_SOAP11,
                                                                 "fault"));
    }
    return getSoapFault(extElement);
}
 
Example 15
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SOAPHeader createSoapHeader(ExtensionRegistry extReg, Class<?> clz, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(clz,
                                                          new QName(WSDLConstants.NS_SOAP12,
                                                                    "header"));
    } else {
        extElement = extReg.createExtension(clz,
                                                        new QName(WSDLConstants.NS_SOAP11,
                                                                  "header"));
    }
    return getSoapHeader(extElement);
}