Java Code Examples for javax.xml.namespace.QName

The following are top voted examples for showing how to use javax.xml.namespace.QName. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: lams   File: MetadataCredentialResolver.java   View source code 7 votes vote down vote up
/**
 * Get the list of metadata role descriptors which match the given entityID, role and protocol.
 * 
 * @param entityID entity ID of the credential owner
 * @param role role in which the entity is operating
 * @param protocol protocol over which the entity is operating (may be null)
 * @return a list of role descriptors matching the given parameters, or null
 * @throws SecurityException thrown if there is an error retrieving role descriptors from the metadata provider
 */
protected List<RoleDescriptor> getRoleDescriptors(String entityID, QName role, String protocol)
        throws SecurityException {
    try {
        if (log.isDebugEnabled()) {
            log.debug("Retrieving metadata for entity '{}' in role '{}' for protocol '{}'", 
                    new Object[] {entityID, role, protocol});
        }

        if (DatatypeHelper.isEmpty(protocol)) {
            return metadata.getRole(entityID, role);
        } else {
            RoleDescriptor roleDescriptor = metadata.getRole(entityID, role, protocol);
            if (roleDescriptor == null) {
                return null;
            }
            List<RoleDescriptor> roles = new ArrayList<RoleDescriptor>();
            roles.add(roleDescriptor);
            return roles;
        }
    } catch (MetadataProviderException e) {
        log.error("Unable to read metadata from provider", e);
        throw new SecurityException("Unable to read metadata provider", e);
    }
}
 
Example 2
Project: openjdk-jdk10   File: Fault1_2Impl.java   View source code 7 votes vote down vote up
@Override
public void appendFaultSubcode(QName subcode) throws SOAPException {
    if (subcode == null) {
        return;
    }
    if (subcode.getNamespaceURI() == null ||
        "".equals(subcode.getNamespaceURI())) {

        log.severe("SAAJ0432.ver1_2.subcode.not.ns.qualified");
        throw new SOAPExceptionImpl("A Subcode must be namespace-qualified");
    }
    if (innermostSubCodeElement == null) {
        if (faultCodeElement == null)
            findFaultCodeElement();
        innermostSubCodeElement = faultCodeElement;
    }
    String prefix = null;
    if (subcode.getPrefix() == null || "".equals(subcode.getPrefix())) {
        prefix =
            ((ElementImpl) innermostSubCodeElement).getNamespacePrefix(
                subcode.getNamespaceURI());
    } else
        prefix = subcode.getPrefix();
    if (prefix == null || "".equals(prefix)) {
        prefix = "ns1";
    }
    innermostSubCodeElement =
        innermostSubCodeElement.addChildElement(subcodeName);
    SOAPElement subcodeValueElement =
        innermostSubCodeElement.addChildElement(valueName);
    ((ElementImpl) subcodeValueElement).ensureNamespaceIsDeclared(
        prefix,
        subcode.getNamespaceURI());
    subcodeValueElement.addTextNode(prefix + ":" + subcode.getLocalPart());
}
 
Example 3
Project: convertigo-engine   File: WebServiceServlet.java   View source code 7 votes vote down vote up
private static void addWsdlPortTypeOperation(Definition definition, QName portTypeQName, String operationName, String operationComment, QName inputQName, QName ouptutQName) {
Message inputMessage = definition.createMessage();
inputMessage.setQName(inputQName);
Input input = definition.createInput();
input.setMessage(inputMessage);

Message outpuMessage = definition.createMessage();
outpuMessage.setQName(ouptutQName);
Output output = definition.createOutput();
output.setMessage(outpuMessage);

Operation operation = definition.createOperation();
operation.setName(operationName);
operation.setInput(input);
operation.setOutput(output);
operation.setUndefined(false);
addWsdLDocumentation(definition, operation, operationComment);

PortType portType = definition.getPortType(portTypeQName);
portType.addOperation(operation);
  }
 
Example 4
Project: OpenJSharp   File: PayloadElementSniffer.java   View source code 6 votes vote down vote up
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {

    if (bodyStarted) {
        payloadQName = new QName(uri, localName);
        // we have what we wanted - let's skip rest of parsing ...
        throw new SAXException("Payload element found, interrupting the parsing process.");
    }

    // check for both SOAP 1.1/1.2
    if (equalsQName(uri, localName, SOAPConstants.QNAME_SOAP_BODY) ||
            equalsQName(uri, localName, SOAP12Constants.QNAME_SOAP_BODY)) {
        bodyStarted = true;
    }

}
 
Example 5
Project: openjdk-jdk10   File: RawTypeSetBuilder.java   View source code 6 votes vote down vote up
public void elementDecl(XSElementDecl decl) {

        QName n = BGMBuilder.getName(decl);
        if(elementNames.add(n)) {
            CElement elementBean = Ring.get(ClassSelector.class).bindToType(decl,null);
            if(elementBean==null)
                refs.add(new XmlTypeRef(decl));
            else {
                // yikes!
                if(elementBean instanceof CClass)
                    refs.add(new CClassRef(decl,(CClass)elementBean));
                else
                    refs.add(new CElementInfoRef(decl,(CElementInfo)elementBean));
            }
        }
    }
 
Example 6
Project: lams   File: StatusCodeSchemaValidator.java   View source code 6 votes vote down vote up
/**
 * Validates that the status code local name is one of the allowabled values.
 * 
 * @param statusCode the status code to validate
 * 
 * @throws ValidationException thrown if the status code local name is not an allowed value
 */
protected void validateValueContent(StatusCode statusCode) throws ValidationException {
    QName statusValue = statusCode.getValue();

    if (SAMLConstants.SAML10P_NS.equals(statusValue.getNamespaceURI())) {
        if (!(statusValue.equals(StatusCode.SUCCESS) 
                || statusValue.equals(StatusCode.VERSION_MISMATCH)
                || statusValue.equals(StatusCode.REQUESTER) 
                || statusValue.equals(StatusCode.RESPONDER)
                || statusValue.equals(StatusCode.REQUEST_VERSION_TOO_HIGH)
                || statusValue.equals(StatusCode.REQUEST_VERSION_TOO_LOW)
                || statusValue.equals(StatusCode.REQUEST_VERSION_DEPRICATED)
                || statusValue.equals(StatusCode.TOO_MANY_RESPONSES)
                || statusValue.equals(StatusCode.REQUEST_DENIED)
                || statusValue.equals(StatusCode.RESOURCE_NOT_RECOGNIZED))) {
            throw new ValidationException(
                    "Status code value was in the SAML 1 protocol namespace but was not of an allowed value: "
                            + statusValue);
        }
    } else if (SAMLConstants.SAML1_NS.equals(statusValue.getNamespaceURI())) {
        throw new ValidationException(
                "Status code value was in the SAML 1 assertion namespace, no values are allowed in that namespace");
    }
}
 
Example 7
Project: openjdk-jdk10   File: KeyInfoReferenceResolver.java   View source code 6 votes vote down vote up
/**
 * Validate the Element referred to by the KeyInfoReference.
 *
 * @param referentElement
 *
 * @throws XMLSecurityException
 */
private void validateReference(Element referentElement) throws XMLSecurityException {
    if (!XMLUtils.elementIsInSignatureSpace(referentElement, Constants._TAG_KEYINFO)) {
        Object exArgs[] = { new QName(referentElement.getNamespaceURI(), referentElement.getLocalName()) };
        throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.WrongType", exArgs);
    }

    KeyInfo referent = new KeyInfo(referentElement, "");
    if (referent.containsKeyInfoReference()) {
        if (secureValidation) {
            throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.ReferenceWithSecure");
        } else {
            // Don't support chains of references at this time. If do support in the future, this is where the code
            // would go to validate that don't have a cycle, resulting in an infinite loop. This may be unrealistic
            // to implement, and/or very expensive given remote URI references.
            throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.ReferenceWithoutSecure");
        }
    }

}
 
Example 8
Project: OpenJSharp   File: RELAXNGCompiler.java   View source code 6 votes vote down vote up
private void mapToClass(DElementPattern p) {
    NameClass nc = p.getName();
    if(nc.isOpen())
        return;   // infinite name. can't map to a class.

    Set<QName> names = nc.listNames();

    CClassInfo[] types = new CClassInfo[names.size()];
    int i=0;
    for( QName n : names ) {
        // TODO: read class names from customization
        String name = model.getNameConverter().toClassName(n.getLocalPart());

        bindQueue.put(
            types[i++] = new CClassInfo(model,pkg,name,p.getLocation(),null,n,null,null/*TODO*/),
            p.getChild() );
    }

    classes.put(p,types);
}
 
Example 9
Project: openjdk-jdk10   File: TDTDReader.java   View source code 5 votes vote down vote up
protected CPropertyInfo createAttribute(
    String elementName, String attributeName, String attributeType,
    String[] enums, short attributeUse, String defaultValue )
        throws SAXException {

    boolean required = attributeUse==USE_REQUIRED;

    // get the attribute-property declaration
    BIElement edecl = bindInfo.element(elementName);
    BIAttribute decl=null;
    if(edecl!=null)     decl=edecl.attribute(attributeName);

    String propName;
    if(decl==null)  propName = model.getNameConverter().toPropertyName(attributeName);
    else            propName = decl.getPropertyName();

    QName qname = new QName("",attributeName);

    // if no declaration is specified, just wrap it by
    // a FieldItem and let the normalizer handle its content.
    TypeUse use;

    if(decl!=null && decl.getConversion()!=null)
        use = decl.getConversion().getTransducer();
    else
        use = builtinConversions.get(attributeType);

    CPropertyInfo r = new CAttributePropertyInfo(
        propName, null,null/*TODO*/, copyLocator(), qname, use, null, required );

    if(defaultValue!=null)
        r.defaultValue = CDefaultValue.create( use, new XmlString(defaultValue) );

    return r;
}
 
Example 10
Project: openjdk-jdk10   File: XMLGregorianCalendarImpl.java   View source code 5 votes vote down vote up
/**
 * <p>Return the lexical representation of <code>this</code> instance.
 * The format is specified in
 * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">XML Schema 1.0 Part 2, Section 3.2.[7-14].1,
 * <i>Lexical Representation</i>".</a></p>
 *
 * <p>Specific target lexical representation format is determined by
 * {@link #getXMLSchemaType()}.</p>
 *
 * @return XML, as <code>String</code>, representation of this <code>XMLGregorianCalendar</code>
 *
 * @throws java.lang.IllegalStateException if the combination of set fields
 *    does not match one of the eight defined XML Schema builtin date/time datatypes.
 */
public String toXMLFormat() {

    QName typekind = getXMLSchemaType();

    String formatString = null;
    // Fix 4971612: invalid SCCS macro substitution in data string
    //   no %{alpha}% to avoid SCCS macro substitution
    if (typekind == DatatypeConstants.DATETIME) {
        formatString = "%Y-%M-%DT%h:%m:%s" + "%z";
    } else if (typekind == DatatypeConstants.DATE) {
        formatString = "%Y-%M-%D" + "%z";
    } else if (typekind == DatatypeConstants.TIME) {
        formatString = "%h:%m:%s" + "%z";
    } else if (typekind == DatatypeConstants.GMONTH) {
        formatString = "--%M" + "%z";
    } else if (typekind == DatatypeConstants.GDAY) {
        formatString = "---%D" + "%z";
    } else if (typekind == DatatypeConstants.GYEAR) {
        formatString = "%Y" + "%z";
    } else if (typekind == DatatypeConstants.GYEARMONTH) {
        formatString = "%Y-%M" + "%z";
    } else if (typekind == DatatypeConstants.GMONTHDAY) {
        formatString = "--%M-%D" + "%z";
    }
    return format(formatString);
}
 
Example 11
Project: parabuild-ci   File: GetQuote1.java   View source code 5 votes vote down vote up
/**
 * This method does the same thing that getQuote1 does, but in
 * addition it reuses the Call object to make another call.
 */
public float getQuote3(String args[]) throws Exception {
    Options opts = new Options(args);

    args = opts.getRemainingArgs();

    if (args == null) {
        System.err.println("Usage: GetQuote <symbol>");
        System.exit(1);
    }

    /* Define the service QName and port QName */
    /*******************************************/
    QName servQN = new QName("urn:xmltoday-delayed-quotes",
            "GetQuoteService");
    QName portQN = new QName("urn:xmltoday-delayed-quotes", "GetQuote");

    /* Now use those QNames as pointers into the WSDL doc */
    /******************************************************/
    Service service = ServiceFactory.newInstance().createService(
            new URL("file:samples/stock/GetQuote.wsdl"), servQN);
    Call call = service.createCall(portQN, "getQuote");

    /* Strange - but allows the user to change just certain portions of */
    /* the URL we're gonna use to invoke the service.  Useful when you  */
    /* want to run it thru tcpmon (ie. put  -p81 on the cmd line).      */
    /********************************************************************/
    opts.setDefaultURL(call.getTargetEndpointAddress());
    call.setTargetEndpointAddress(opts.getURL());

    /* Define some service specific properties */
    /*******************************************/
    call.setProperty(Call.USERNAME_PROPERTY, opts.getUser());
    call.setProperty(Call.PASSWORD_PROPERTY, opts.getPassword());

    /* Get symbol and invoke the service */
    /*************************************/
    Object result = call.invoke(new Object[] {symbol = args[0]});

    /* Reuse the Call object for a different call */
    /**********************************************/
    call.setOperationName(new QName("urn:xmltoday-delayed-quotes", "test"));
    call.removeAllParameters();
    call.setReturnType(XMLType.XSD_STRING);

    System.out.println(call.invoke(new Object[]{}));
    return ((Float) result).floatValue();
}
 
Example 12
Project: openjdk-jdk10   File: Util.java   View source code 5 votes vote down vote up
public static void verifyTagNSRootElement(Element element, QName name) {
    if (!element.getLocalName().equals(name.getLocalPart())
        || (element.getNamespaceURI() != null
            && !element.getNamespaceURI().equals(name.getNamespaceURI())))
        fail(
            "parsing.incorrectRootElement",
            new Object[] {
                element.getTagName(),
                element.getNamespaceURI(),
                name.getLocalPart(),
                name.getNamespaceURI()});
}
 
Example 13
Project: OpenJSharp   File: SOAPFaultBuilder.java   View source code 5 votes vote down vote up
private static @Nullable QName getFirstDetailEntryName(@Nullable Detail detail) {
    if (detail != null) {
        Iterator<DetailEntry> it = detail.getDetailEntries();
        if (it.hasNext()) {
            DetailEntry entry = it.next();
            return getFirstDetailEntryName(entry);
        }
    }
    return null;
}
 
Example 14
Project: incubator-netbeans   File: POMComponentFactoryImpl.java   View source code 5 votes vote down vote up
@Override
public POMComponent create(Element element, POMComponent context) {
    // return new SCAComponentCreateVisitor().create(element, context);
    QName qName = getQName(element, (POMComponentImpl)context);
    ElementFactory elementFactory = ElementFactoryRegistry.getDefault().get(qName);
    return create(elementFactory, element, context);
}
 
Example 15
Project: openjdk-jdk10   File: RuntimeModeler.java   View source code 5 votes vote down vote up
private ParameterBinding getBinding(String operation, String part, boolean isHeader, Mode mode){
    if(binding == null){
        if(isHeader)
            return ParameterBinding.HEADER;
        else
            return ParameterBinding.BODY;
    }
    QName opName = new QName(binding.getBinding().getPortType().getName().getNamespaceURI(), operation);
    return binding.getBinding().getBinding(opName, part, mode);
}
 
Example 16
Project: OpenJSharp   File: SOAPSEIModel.java   View source code 5 votes vote down vote up
public Set<QName> getKnownHeaders() {
    Set<QName> headers = new HashSet<QName>();
    for (JavaMethodImpl method : getJavaMethods()) {
        // fill in request headers
        Iterator<ParameterImpl> params = method.getRequestParameters().iterator();
        fillHeaders(params, headers, Mode.IN);

        // fill in response headers
        params = method.getResponseParameters().iterator();
        fillHeaders(params, headers, Mode.OUT);
    }
    return headers;
}
 
Example 17
Project: openjdk-jdk10   File: TXW.java   View source code 5 votes vote down vote up
/**
 * Creates a new {@link TypedXmlWriter} to write a new instance of a document.
 *
 * @param rootElement
 *      The {@link TypedXmlWriter} interface that declares the content model of the root element.
 *      This interface must have {@link XmlElement} annotation on it to designate the tag name
 *      of the root element.
 * @param out
 *      The target of the writing.
 */
public static <T extends TypedXmlWriter> T create( Class<T> rootElement, XmlSerializer out ) {
    if (out instanceof TXWSerializer) {
        TXWSerializer txws = (TXWSerializer) out;
        return txws.txw._element(rootElement);
    }

    Document doc = new Document(out);
    QName n = getTagName(rootElement);
    return new ContainerElement(doc,null,n.getNamespaceURI(),n.getLocalPart())._cast(rootElement);
}
 
Example 18
Project: convertigo-engine   File: XmlSchemaWalker.java   View source code 5 votes vote down vote up
protected void walkAttributeGroupRef(XmlSchema xmlSchema, XmlSchemaAttributeGroupRef obj) {
	walkAnnotated(xmlSchema, obj);
	QName refName = obj.getRefName();
	if ((refName != null) && deep) {
		walkByGroupRef(xmlSchema, refName);
	}
}
 
Example 19
Project: OpenJSharp   File: WsaTubeHelper.java   View source code 5 votes vote down vote up
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) {
    QName name = e.getProblemHeader();
    QName subsubcode = e.getSubsubcode();
    QName subcode = av.invalidMapTag;
    String faultstring = String.format(av.getInvalidMapText(), name, subsubcode);

    try {
        SOAPFactory factory;
        SOAPFault fault;
        if (soapVer == SOAPVersion.SOAP_12) {
            factory = SOAPVersion.SOAP_12.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            fault.appendFaultSubcode(subsubcode);
            getInvalidMapDetail(name, fault.addDetail());
        } else {
            factory = SOAPVersion.SOAP_11.getSOAPFactory();
            fault = factory.createFault();
            fault.setFaultCode(subsubcode);
        }

        fault.setFaultString(faultstring);

        return fault;
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example 20
Project: openjdk-jdk10   File: SOAPFaultBuilder.java   View source code 5 votes vote down vote up
private static @Nullable QName getFirstDetailEntryName(@Nullable Detail detail) {
    if (detail != null) {
        Iterator<DetailEntry> it = detail.getDetailEntries();
        if (it.hasNext()) {
            DetailEntry entry = it.next();
            return getFirstDetailEntryName(entry);
        }
    }
    return null;
}
 
Example 21
Project: springboot-shiro-cas-mybatis   File: Saml10ObjectBuilder.java   View source code 5 votes vote down vote up
/**
 * Create a new SAML status object.
 *
 * @param codeValue the code value
 * @param statusMessage the status message
 * @return the status
 */
public Status newStatus(final QName codeValue, final String statusMessage) {
    final Status status = newSamlObject(Status.class);
    final StatusCode code = newSamlObject(StatusCode.class);
    code.setValue(codeValue);
    status.setStatusCode(code);
    if (statusMessage != null) {
        final StatusMessage message = newSamlObject(StatusMessage.class);
        message.setMessage(statusMessage);
        status.setStatusMessage(message);
    }
    return status;
}
 
Example 22
Project: OpenJSharp   File: EndpointImpl.java   View source code 5 votes vote down vote up
private void createEndpoint(String urlPattern) {
    // Checks permission for "publishEndpoint"
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(ENDPOINT_PUBLISH_PERMISSION);
    }

    // See if HttpServer implementation is available
    try {
        Class.forName("com.sun.net.httpserver.HttpServer");
    } catch (Exception e) {
        throw new UnsupportedOperationException("Couldn't load light weight http server", e);
    }
    container = getContainer();
    MetadataReader metadataReader = EndpointFactory.getExternalMetadatReader(implClass, binding);
    WSEndpoint wse = WSEndpoint.create(
            implClass, true,
            invoker,
            getProperty(QName.class, Endpoint.WSDL_SERVICE),
            getProperty(QName.class, Endpoint.WSDL_PORT),
            container,
            binding,
            getPrimaryWsdl(metadataReader),
            buildDocList(),
            (EntityResolver) null,
            false
    );
    // Don't load HttpEndpoint class before as it may load HttpServer classes
    actualEndpoint = new HttpEndpoint(executor, getAdapter(wse, urlPattern));
}
 
Example 23
Project: OpenJSharp   File: W3CAddressingWSDLParserExtension.java   View source code 5 votes vote down vote up
private boolean addressibleElement(XMLStreamReader reader, WSDLFeaturedObject binding) {
    QName ua = reader.getName();
    if (ua.equals(AddressingVersion.W3C.wsdlExtensionTag)) {
        String required = reader.getAttributeValue(WSDLConstants.NS_WSDL, "required");
        binding.addFeature(new AddressingFeature(true, Boolean.parseBoolean(required)));
        XMLStreamReaderUtil.skipElement(reader);
        return true;        // UsingAddressing is consumed
    }

    return false;
}
 
Example 24
Project: OpenJSharp   File: ArrayERProperty.java   View source code 5 votes vote down vote up
protected ArrayERProperty(JAXBContextImpl grammar, RuntimePropertyInfo prop, QName tagName, boolean isWrapperNillable) {
    super(grammar,prop);
    if(tagName==null)
        this.wrapperTagName = null;
    else
        this.wrapperTagName = grammar.nameBuilder.createElementName(tagName);
    this.isWrapperNillable = isWrapperNillable;
}
 
Example 25
Project: lams   File: AbstractExtensibleXMLObjectMarshaller.java   View source code 5 votes vote down vote up
/**
 * Marshalls the <code>xs:anyAttribute</code> attributes.
 * 
 * {@inheritDoc}
 */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    AttributeExtensibleXMLObject anyAttribute = (AttributeExtensibleXMLObject) xmlObject;
    Attr attribute;
    Document document = domElement.getOwnerDocument();
    for (Entry<QName, String> entry : anyAttribute.getUnknownAttributes().entrySet()) {
        attribute = XMLHelper.constructAttribute(document, entry.getKey());
        attribute.setValue(entry.getValue());
        domElement.setAttributeNodeNS(attribute);
        if (Configuration.isIDAttribute(entry.getKey())
                || anyAttribute.getUnknownAttributes().isIDAttribute(entry.getKey())) {
            attribute.getOwnerElement().setIdAttributeNode(attribute, true);
        }
    }
}
 
Example 26
Project: lams   File: AdviceImpl.java   View source code 5 votes vote down vote up
/** {@inheritDoc} */
public List<AssertionIDReference> getAssertionIDReferences() {
    //
    // The cast in the line below is unsafe. (it's checking against the erasure of l - which is List.
    // We are, howeverever guaranteed by sublist that although l is 'just' a List it
    // will only contain <AssertionIDReferences> explicit code in IndexedXMLObjectChildrenList$ListView.indexCheck
    // helps us be sure.

    QName assertionIDRefQName = new QName(SAMLConstants.SAML1_NS, AssertionIDReference.DEFAULT_ELEMENT_LOCAL_NAME);
    return (List<AssertionIDReference>) assertionChildren.subList(assertionIDRefQName);
}
 
Example 27
Project: openjdk-jdk10   File: WSEndpointImpl.java   View source code 5 votes vote down vote up
protected WSEndpointImpl(@NotNull QName serviceName, @NotNull QName portName, WSBinding binding, Container container,
                      SEIModel seiModel, WSDLPort port,
                      Tube masterTubeline) {
              this.serviceName = serviceName;
              this.portName = portName;
              this.binding = binding;
              this.soapVersion = binding.getSOAPVersion();
              this.container = container;
              this.endpointPolicy = null;
              this.port = port;
              this.seiModel = seiModel;
              this.serviceDef = null;
              this.implementationClass = null;
              this.masterTubeline = masterTubeline;
              this.masterCodec = ((BindingImpl) this.binding).createCodec();

      LazyMOMProvider.INSTANCE.registerEndpoint(this);
      initManagedObjectManager();

      this.operationDispatcher = (port == null) ? null : new OperationDispatcher(port, binding, seiModel);
          this.context = new ServerPipeAssemblerContext(
              seiModel, port, this, null /* not known */, false);

              tubePool = new TubePool(masterTubeline);
              engine = new Engine(toString(), container);
              wsdlProperties = (port == null) ? new WSDLDirectProperties(serviceName, portName, seiModel) : new WSDLPortProperties(port, seiModel);
}
 
Example 28
Project: openjdk-jdk10   File: MUTube.java   View source code 5 votes vote down vote up
/**
 * @param notUnderstoodHeaders
 * @return SOAPfaultException with SOAPFault representing the MustUnderstand SOAP Fault.
 *         notUnderstoodHeaders are added in the fault detail.
 */
final SOAPFaultException createMUSOAPFaultException(Set<QName> notUnderstoodHeaders) {
    try {
        SOAPFault fault = soapVersion.getSOAPFactory().createFault(
            MUST_UNDERSTAND_FAULT_MESSAGE_STRING,
            soapVersion.faultCodeMustUnderstand);
        fault.setFaultString("MustUnderstand headers:" +
            notUnderstoodHeaders + " are not understood");
        return new SOAPFaultException(fault);
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }
}
 
Example 29
Project: OpenJSharp   File: TXW.java   View source code 5 votes vote down vote up
static QName getTagName( Class<?> c ) {
    String localName="";
    String nsUri="##default";

    XmlElement xe = c.getAnnotation(XmlElement.class);
    if(xe!=null) {
        localName = xe.value();
        nsUri = xe.ns();
    }

    if(localName.length()==0) {
        localName = c.getName();
        int idx = localName.lastIndexOf('.');
        if(idx>=0)
            localName = localName.substring(idx+1);

        localName = Character.toLowerCase(localName.charAt(0))+localName.substring(1);
    }

    if(nsUri.equals("##default")) {
        Package pkg = c.getPackage();
        if(pkg!=null) {
            XmlNamespace xn = pkg.getAnnotation(XmlNamespace.class);
            if(xn!=null)
                nsUri = xn.value();
        }
    }
    if(nsUri.equals("##default"))
        nsUri = "";

    return new QName(nsUri,localName);
}
 
Example 30
Project: openjdk-jdk10   File: RuntimeModeler.java   View source code 5 votes vote down vote up
private QName qualifyWrappeeIfNeeded(QName resultQName, String ns) {
    Object o = config.properties().get(DocWrappeeNamespapceQualified);
    boolean qualified = (o!= null && o instanceof Boolean) ? ((Boolean) o) : false;
    if (qualified) {
        if (resultQName.getNamespaceURI() == null || "".equals(resultQName.getNamespaceURI())) {
            return new QName(ns, resultQName.getLocalPart());
        }
    }
    return resultQName;
}
 
Example 31
Project: openjdk-jdk10   File: UnmarshallingContext.java   View source code 5 votes vote down vote up
/**
 * Allows to access attributes which are expected in current state.
 * Useful for getting attributes for current parent.
 *
 * @return
 */
public Collection<QName> getCurrentExpectedAttributes() {
    pushCoordinator();
    try {
        State s = getCurrentState();
        Loader l = s.loader;
        return (l != null) ? l.getExpectedAttributes() : null;
    } finally {
        popCoordinator();
    }
}
 
Example 32
Project: xpath-to-xml   File: AttributeTest.java   View source code 5 votes vote down vote up
@Test
public void shouldCreateAttribute() {
    // given
    setUpUnresolvableExpr();

    // when
    IterableNodeView<TestNode> result = stepExpr.resolve(new ViewContext<>(navigator, parentNode, true));

    // then
    assertThat((Iterable<?>) result).extracting("node").containsExactly(node("attr"));
    verify(navigator).createAttribute(node("node"), new QName("attr"));
}
 
Example 33
Project: OpenJSharp   File: WSDLModeler.java   View source code 5 votes vote down vote up
protected String getJavaNameOfSEI(Port port) {
    QName portTypeName =
            (QName) port.getProperty(
                    ModelProperties.PROPERTY_WSDL_PORT_TYPE_NAME);
    PortType pt = (PortType) document.find(Kinds.PORT_TYPE, portTypeName);
    //populate the portType map here. We should get rid of all these properties
    // lets not do it as it may break NB
    //TODO: clean all these stuff part of NB RFE
    port.portTypes.put(portTypeName, pt);
    JAXWSBinding jaxwsCust = (JAXWSBinding) getExtensionOfType(pt, JAXWSBinding.class);
    if (jaxwsCust != null && jaxwsCust.getClassName() != null) {
        CustomName name = jaxwsCust.getClassName();
        if (name != null && !name.getName().equals("")) {
            return makePackageQualified(name.getName());
        }
    }

    String interfaceName;
    if (portTypeName != null) {
        // got portType information from WSDL, use it to name the interface
        interfaceName =
                makePackageQualified(BindingHelper.mangleNameToClassName(portTypeName.getLocalPart()));
    } else {
        // somehow we only got the port name, so we use that
        interfaceName =
                makePackageQualified(BindingHelper.mangleNameToClassName(port.getName().getLocalPart()));
    }
    return interfaceName;
}
 
Example 34
Project: OpenJSharp   File: XmlUtil.java   View source code 5 votes vote down vote up
public static String getAttributeNSOrNull(
    Element e,
    QName name) {
    Attr a = e.getAttributeNodeNS(name.getNamespaceURI(), name.getLocalPart());
    if (a == null)
        return null;
    return a.getValue();
}
 
Example 35
Project: witsml-client   File: WMLSLocator.java   View source code 5 votes vote down vote up
/**
 * For the given interface, get the stub implementation.
 * If this service has no port for the given interface,
 * then ServiceException is thrown.
 */
public Remote getPort(QName portName, Class serviceEndpointInterface) throws ServiceException {
    if (portName == null) {
        return getPort(serviceEndpointInterface);
    }
    String inputPortName = portName.getLocalPart();
    if ("StoreSoapPort".equals(inputPortName)) {
        return getStoreSoapPort();
    }
    else  {
        Remote _stub = getPort(serviceEndpointInterface);
        ((Stub) _stub).setPortName(portName);
        return _stub;
    }
}
 
Example 36
Project: openjdk-jdk10   File: Fault1_1Impl.java   View source code 5 votes vote down vote up
@Override
public QName getFaultCodeAsQName() {
    String faultcodeString = getFaultCode();
    if (faultcodeString == null) {
        return null;
    }
    if (this.faultCodeElement == null)
        findFaultCodeElement();
    return convertCodeToQName(faultcodeString, this.faultCodeElement);
}
 
Example 37
Project: OpenJSharp   File: Port.java   View source code 5 votes vote down vote up
public Binding resolveBinding(AbstractDocument document) {
    try{
        return (Binding) document.find(Kinds.BINDING, _binding);
    } catch (NoSuchEntityException e) {
        errorReceiver.error(getLocator(), WsdlMessages.ENTITY_NOT_FOUND_BINDING(_binding, new QName(getNamespaceURI(), getName())));
        throw new AbortException();
    }
}
 
Example 38
Project: OpenJSharp   File: EndpointFactory.java   View source code 4 votes vote down vote up
public static @NotNull QName getDefaultPortName(QName serviceName, Class<?> implType, boolean isStandard) {
    return getDefaultPortName(serviceName, implType, isStandard, null);
}
 
Example 39
Project: openjdk-jdk10   File: BindingSubject.java   View source code 4 votes vote down vote up
public static BindingSubject createInputMessageSubject(QName bindingName, QName operationName, QName messageName) {
    final BindingSubject operationSubject = createOperationSubject(bindingName, operationName);
    return new BindingSubject(messageName, WsdlMessageType.INPUT, WsdlNameScope.MESSAGE, operationSubject);
}
 
Example 40
Project: OpenJSharp   File: Service.java   View source code 4 votes vote down vote up
protected Service(java.net.URL wsdlDocumentLocation, QName serviceName, WebServiceFeature ... features) {
    delegate = Provider.provider().createServiceDelegate(wsdlDocumentLocation,
            serviceName,
            this.getClass(), features);
}