下面列出了com.fasterxml.jackson.annotation.JsonAnySetter#javax.xml.namespace.QName 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
final QName parseElementName(XmlElementDecl e) {
String local = e.name();
String nsUri = e.namespace();
if(nsUri.equals("##default")) {
// if defaulted ...
XmlSchema xs = reader().getPackageAnnotation(XmlSchema.class,
nav().getDeclaringClassForMethod(method),this);
if(xs!=null)
nsUri = xs.namespace();
else {
nsUri = builder.defaultNsUri;
}
}
return new QName(nsUri.intern(),local.intern());
}
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);
}
@Test(groups = "wso2.esb", description = "- Logging proxy" + "- Publish WSDL Options - Specified source url")
public void testLoggingProxy() throws Exception {
OMElement response = axis2Client
.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("wsdlOptionsFromSourceUrlLoggingProxy"), null,
"WSO2");
String lastPrice = response.getFirstElement()
.getFirstChildWithName(new QName("http://services.samples/xsd", "last")).getText();
assertNotNull(lastPrice, "Fault: response message 'last' price null");
String symbol = response.getFirstElement()
.getFirstChildWithName(new QName("http://services.samples/xsd", "symbol")).getText();
assertEquals(symbol, "WSO2", "Fault: value 'symbol' mismatched");
}
/**
* Creates a PortAddressResolver that maps portname to its address
*
* @param endpointImpl application endpoint Class that eventually serves the request.
*/
public PortAddressResolver createPortAddressResolver(final String baseAddress, final Class<?> endpointImpl) {
return new PortAddressResolver() {
@Override
public String getAddressFor(@NotNull QName serviceName, @NotNull String portName) {
String urlPattern = addressMap.get(new PortInfo(serviceName,portName, endpointImpl));
if (urlPattern == null) {
//if a WSDL defines more ports, urlpattern is null (portName does not match endpointImpl)
//so fallback to the default behaviour where only serviceName/portName is checked
for (Entry<PortInfo, String> e : addressMap.entrySet()) {
if (serviceName.equals(e.getKey().serviceName) && portName.equals(e.getKey().portName)) {
urlPattern = e.getValue();
break;
}
}
}
return (urlPattern == null) ? null : baseAddress+urlPattern;
}
};
}
private static String convert(Object obj) {
try {
Class clazz = obj.getClass();
if (!jaxbContextMap.containsKey(clazz)) {
jaxbContextMap.put(clazz, JAXBContext.newInstance(clazz));
}
JAXBContext context = (JAXBContext)jaxbContextMap.get(clazz);
Marshaller marshaller = context.createMarshaller();
StringWriter writer = new StringWriter();
if (obj.getClass().isAnnotationPresent(XmlRootElement.class)) {
marshaller.marshal(obj, (Writer)writer);
} else if (obj.getClass().isAnnotationPresent(XmlType.class)) {
JAXBElement jaxbElement = new JAXBElement(new QName("", obj.getClass().getSimpleName()), clazz, obj);
marshaller.marshal(jaxbElement, (Writer)writer);
}
return writer.toString();
} catch (Exception var6) {
LOG.error(var6.getMessage(), var6);
Assert.fail(var6.getMessage());
return null;
}
}
/**
* Get a header block from the SOAP envelope contained within the specified message context's
* {@link MessageContext#getOutboundMessage()}.
*
* @param msgContext the message context being processed
* @param headerName the name of the header block to return
* @param targetNodes the explicitly specified SOAP node actors (1.1) or roles (1.2) for which the header is desired
* @param isFinalDestination true specifies that headers targeted for message final destination should be returned,
* false specifies they should not be returned
* @return the list of matching header blocks
*/
public static List<XMLObject> getOutboundHeaderBlock(MessageContext msgContext, QName headerName,
Set<String> targetNodes, boolean isFinalDestination) {
XMLObject outboundEnvelope = msgContext.getOutboundMessage();
if (outboundEnvelope == null) {
throw new IllegalArgumentException("Message context does not contain an outbound SOAP envelope");
}
// SOAP 1.1 Envelope
if (outboundEnvelope instanceof Envelope) {
return getSOAP11HeaderBlock((Envelope) outboundEnvelope, headerName, targetNodes, isFinalDestination);
}
//TODO SOAP 1.2 support when object providers are implemented
return Collections.emptyList();
}
protected void generateSOAPHeaders(TypedXmlWriter writer, List<ParameterImpl> parameters, QName message) {
for (ParameterImpl headerParam : parameters) {
Header header = writer._element(Header.class);
header.message(message);
header.part(headerParam.getPartName());
header.use(LITERAL);
}
}
@Override
public SDDocument resolve(String systemId) {
SDDocument sdi = docs.get(systemId);
if (sdi == null) {
SDDocumentSource sds;
try {
sds = SDDocumentSource.create(new URL(systemId));
} catch(MalformedURLException e) {
throw new WebServiceException(e);
}
sdi = SDDocumentImpl.create(sds, new QName(""), new QName(""));
docs.put(systemId, sdi);
}
return sdi;
}
@Test(groups = "wso2.esb", description = "Tests-Replace out going message envelop")
public void testReplaceEnvelop() throws AxisFault {
response = axis2Client.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("enrichReplaceEnvelopTestProxy"), null, "WSO2");
assertNotNull(response, "Response is null");
assertEquals(response.getQName().getLocalPart(), "getQuote");
assertEquals(response.getFirstElement().getLocalName().toString(),
"request", "Local name does not match");
assertEquals(response.getFirstElement().getFirstChildWithName
(new QName("http://services.samples", "symbol")).getText(),
"WSO2", "Tag does not match");
}
public Fitness validateServerSide(PolicyAssertion assertion) {
QName assertionName = assertion.getName();
if (serverSideSupportedAssertions.contains(assertionName)) {
return Fitness.SUPPORTED;
} else if (clientSideSupportedAssertions.contains(assertionName)) {
return Fitness.UNSUPPORTED;
} else {
return Fitness.UNKNOWN;
}
}
private QName addPortEpr(WSEndpointReference wsepr) {
if (wsepr == null)
throw new WebServiceException(ProviderApiMessages.NULL_EPR());
QName eprPortName = getPortNameFromEPR(wsepr, null);
//add Port, if it does n't exist;
// TODO: what if it has different epr address?
{
PortInfo portInfo = new PortInfo(this, (wsepr.getAddress() == null) ? null : EndpointAddress.create(wsepr.getAddress()), eprPortName,
getPortModel(wsdlService, eprPortName).getBinding().getBindingId());
if (!ports.containsKey(eprPortName)) {
ports.put(eprPortName, portInfo);
}
}
return eprPortName;
}
public static OMElement serialize(RealmConfiguration realmConfig) {
OMFactory factory = OMAbstractFactory.getOMFactory();
// add the user store manager properties
OMElement userStoreManagerElement = factory.createOMElement(new QName(
UserCoreConstants.RealmConfig.LOCAL_NAME_USER_STORE_MANAGER));
addPropertyElements(factory, userStoreManagerElement, realmConfig.getUserStoreClass(), realmConfig.getUserStoreProperties());
return userStoreManagerElement;
}
/**
* A helper method that appends indented string representation of this instance to the input string buffer.
*
* @param indentLevel indentation level to be used.
* @param buffer buffer to be used for appending string representation of this instance
* @return modified buffer containing new string representation of the instance
*/
public StringBuffer toString(final int indentLevel, final StringBuffer buffer) {
final String indent = PolicyUtils.Text.createIndent(indentLevel);
final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1);
final String innerDoubleIndent = PolicyUtils.Text.createIndent(indentLevel + 2);
buffer.append(indent);
if (type == ModelNode.Type.ASSERTION) {
buffer.append("assertion data {");
} else {
buffer.append("assertion parameter data {");
}
buffer.append(PolicyUtils.Text.NEW_LINE);
buffer.append(innerIndent).append("namespace = '").append(name.getNamespaceURI()).append('\'').append(PolicyUtils.Text.NEW_LINE);
buffer.append(innerIndent).append("prefix = '").append(name.getPrefix()).append('\'').append(PolicyUtils.Text.NEW_LINE);
buffer.append(innerIndent).append("local name = '").append(name.getLocalPart()).append('\'').append(PolicyUtils.Text.NEW_LINE);
buffer.append(innerIndent).append("value = '").append(value).append('\'').append(PolicyUtils.Text.NEW_LINE);
buffer.append(innerIndent).append("optional = '").append(optional).append('\'').append(PolicyUtils.Text.NEW_LINE);
buffer.append(innerIndent).append("ignorable = '").append(ignorable).append('\'').append(PolicyUtils.Text.NEW_LINE);
synchronized (attributes) {
if (attributes.isEmpty()) {
buffer.append(innerIndent).append("no attributes");
} else {
buffer.append(innerIndent).append("attributes {").append(PolicyUtils.Text.NEW_LINE);
for(Map.Entry<QName, String> entry : attributes.entrySet()) {
final QName aName = entry.getKey();
buffer.append(innerDoubleIndent).append("name = '").append(aName.getNamespaceURI()).append(':').append(aName.getLocalPart());
buffer.append("', value = '").append(entry.getValue()).append('\'').append(PolicyUtils.Text.NEW_LINE);
}
buffer.append(innerIndent).append('}');
}
}
buffer.append(PolicyUtils.Text.NEW_LINE).append(indent).append('}');
return buffer;
}
private URI createEndpointComponentUri(@NotNull QName serviceName, @NotNull QName portName) {
StringBuilder sb = new StringBuilder(serviceName.getNamespaceURI()).append("#wsdl11.port(").append(serviceName.getLocalPart()).append('/').append(portName.getLocalPart()).append(')');
try {
return new URI(sb.toString());
} catch (URISyntaxException ex) {
Logger.getLogger(TubelineAssemblyController.class).warning(
TubelineassemblyMessages.MASM_0020_ERROR_CREATING_URI_FROM_GENERATED_STRING(sb.toString()),
ex);
return null;
}
}
protected SOAPElement addElement(QName name) throws SOAPException {
if (hasFault()) {
log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
throw new SOAPExceptionImpl(
"No other element except Fault allowed in SOAPBody");
}
return super.addElement(name);
}
@Override
public Set<QName> getUnderstoodHeaders() {
Set<QName> understoodHdrs = new HashSet<QName>();
for (int i = 0; i < size(); i++) {
if (isUnderstood(i)) {
Header header = get(i);
understoodHdrs.add(new QName(header.getNamespaceURI(), header.getLocalPart()));
}
}
return understoodHdrs;
// throw new UnsupportedOperationException("getUnderstoodHeaders() is not implemented by HeaderList");
}
public @NotNull Map<QName, ? extends EditableWSDLBoundPortType> getBindings() {
return unmBindings;
}
QName getFaultcode() {
return faultcode;
}
public static @NotNull QName getDefaultPortName(@NotNull QName serviceName, Class endpointClass, MetadataReader metadataReader) {
return getDefaultPortName(serviceName, endpointClass, true, metadataReader);
}
protected Operation processSOAPOperation() {
Operation operation =
new Operation(new QName(null, info.bindingOperation.getName()), info.bindingOperation);
setDocumentationIfPresent(
operation,
info.portTypeOperation.getDocumentation());
if (info.portTypeOperation.getStyle()
!= OperationStyle.REQUEST_RESPONSE
&& info.portTypeOperation.getStyle() != OperationStyle.ONE_WAY) {
if (options.isExtensionMode()) {
warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_NOT_SUPPORTED_STYLE(info.portTypeOperation.getName()));
return null;
} else {
error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_NOT_SUPPORTED_STYLE(info.portTypeOperation.getName(),
info.port.resolveBinding(document).resolvePortType(document).getName()));
}
}
SOAPStyle soapStyle = info.soapBinding.getStyle();
// find out the SOAP operation extension, if any
SOAPOperation soapOperation =
(SOAPOperation) getExtensionOfType(info.bindingOperation,
SOAPOperation.class);
if (soapOperation != null) {
if (soapOperation.getStyle() != null) {
soapStyle = soapOperation.getStyle();
}
if (soapOperation.getSOAPAction() != null) {
operation.setSOAPAction(soapOperation.getSOAPAction());
}
}
operation.setStyle(soapStyle);
String uniqueOperationName =
getUniqueName(info.portTypeOperation, info.hasOverloadedOperations);
if (info.hasOverloadedOperations) {
operation.setUniqueName(uniqueOperationName);
}
info.operation = operation;
//attachment
SOAPBody soapRequestBody = getSOAPRequestBody();
if (soapRequestBody == null) {
// the WSDL document is invalid
error(info.bindingOperation, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_INPUT_MISSING_SOAP_BODY(info.bindingOperation.getName()));
}
if (soapStyle == SOAPStyle.RPC) {
if (soapRequestBody.isEncoded()) {
if(options.isExtensionMode()){
warning(soapRequestBody, ModelerMessages.WSDLMODELER_20_RPCENC_NOT_SUPPORTED());
processNonSOAPOperation();
}else{
error(soapRequestBody, ModelerMessages.WSDLMODELER_20_RPCENC_NOT_SUPPORTED());
}
}
return processLiteralSOAPOperation(StyleAndUse.RPC_LITERAL);
}
// document style
return processLiteralSOAPOperation(StyleAndUse.DOC_LITERAL);
}
public QName getAttributeName(int index) {
return reader.getAttributeName(index);
}
public SOAPFault addSOAP12Fault(QName faultCode, String faultReason, Locale locale) {
// log message here
throw new UnsupportedOperationException("Not supported in SOAP 1.1");
}
public FaultElement1_1Impl(SOAPDocumentImpl ownerDoc, QName qname) {
super(ownerDoc, qname);
}
public QName getSamlToken() {
return SAML_TOKEN;
}
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);
}
/**
* Creates a {@link QName} from this.
*/
public QName toQName() {
return new QName(nsUri,localName);
}
/**
* Creates a {@link QName} from this.
*/
public QName toQName() {
return new QName(nsUri,localName);
}
public QName getRealName() {
return constants.getX509Token();
}
@Deprecated
public DataSourceDispatch(QName port, Service.Mode mode, WSServiceDelegate service, Tube pipe, BindingImpl binding, WSEndpointReference epr) {
super(port, mode, service, pipe, binding, epr );
}
@NotNull
public QName getQName() {
return new QName(operation.getName().getNamespaceURI(), name);
}