本文整理汇总了Java中org.apache.axiom.soap.SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI属性的典型用法代码示例。如果您正苦于以下问题:Java SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI属性的具体用法?Java SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI怎么用?Java SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.axiom.soap.SOAP11Constants
的用法示例。
在下文中一共展示了SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConvertToDOOM
public void testConvertToDOOM() throws Exception {
String xml = "<?xml version='1.0' encoding='utf-8'?>" +
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
"<soapenv:Body><ns1:createAccountRequest xmlns:ns1=\"http://www.wso2.com/types\">" +
"<clientinfo xmlns=\"http://www.wso2.com/types\"><name>bob</name><ssn>123456789</ssn></clientinfo>" +
"<password xmlns=\"\">passwd</password></ns1:createAccountRequest></soapenv:Body></soapenv:Envelope>";
StAXSOAPModelBuilder builder2 = new StAXSOAPModelBuilder(
getTestEnvelope().getXMLStreamReader(),
DOOMAbstractFactory.getSOAP11Factory(),
SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
SOAPEnvelope envelope = builder2.getSOAPEnvelope();
envelope.build();
StringWriter writer = new StringWriter();
envelope.serialize(writer);
writer.flush();
String s2 = writer.toString();
assertXMLEqual(s2, xml);
}
示例2: getDocumentFromSOAPEnvelope
/**
* Create a DOM Document using the org.apache.axiom.soap.SOAPEnvelope
*
* @param env An org.apache.axiom.soap.SOAPEnvelope instance
* @return the DOM Document of the given SOAP Envelope
*/
public static Document getDocumentFromSOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope env) {
env.build();
//Check the namespace and find SOAP version and factory
String nsURI;
SOAPFactory factory;
if (env.getNamespace().getNamespaceURI()
.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
nsURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
factory = DOOMAbstractFactory.getSOAP11Factory();
} else {
nsURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
factory = DOOMAbstractFactory.getSOAP12Factory();
}
StAXSOAPModelBuilder stAXSOAPModelBuilder =
new StAXSOAPModelBuilder(env.getXMLStreamReader(), factory, nsURI);
SOAPEnvelope envelope = (stAXSOAPModelBuilder).getSOAPEnvelope();
envelope.build();
Element envElem = (Element)envelope;
return envElem.getOwnerDocument();
}
示例3: toDOOMSOAPEnvelope
/**
* Create a DOM Document using the org.apache.axiom.soap.SOAPEnvelope
*
* @param env An org.apache.axiom.soap.SOAPEnvelope instance
* @return the org.apache.axis2.soap.impl.dom.SOAPEnvelopeImpl of the given SOAP Envelope
*/
public static org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl
toDOOMSOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope env) {
env.build();
//Check the namespace and find SOAP version and factory
String nsURI;
SOAPFactory factory;
if (env.getNamespace().getNamespaceURI()
.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
nsURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
factory = DOOMAbstractFactory.getSOAP11Factory();
} else {
nsURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
factory = DOOMAbstractFactory.getSOAP11Factory();
}
StAXSOAPModelBuilder stAXSOAPModelBuilder =
new StAXSOAPModelBuilder(env.getXMLStreamReader(), factory, nsURI);
SOAPEnvelope envelope = (stAXSOAPModelBuilder).getSOAPEnvelope();
envelope.build();
return (org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl)envelope;
}
示例4: getEnvelopeNamespace
public static String getEnvelopeNamespace(String contentType) {
String soapNS = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
if (contentType != null) {
if (contentType.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1) {
// it is SOAP 1.2
soapNS = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
} else if (contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) {
// SOAP 1.1
soapNS = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
}
}
return soapNS;
}
示例5: testConvertToDOOM2
public void testConvertToDOOM2() throws Exception {
String xml =
"<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header /><soapenv:Body><ns1:createAccountRequest xmlns:ns1=\"http://www.wso2.com/types\"><ns1:clientinfo><name xmlns=\"\">bob</name><ssn xmlns=\"\">123456789</ssn></ns1:clientinfo><password xmlns=\"\">passwd</password></ns1:createAccountRequest></soapenv:Body></soapenv:Envelope>";
CreateAccountRequest request = new CreateAccountRequest();
ClientInfo clientInfo = new ClientInfo();
clientInfo.setName("bob");
clientInfo.setSsn("123456789");
request.setClientInfo(clientInfo);
request.setPassword("passwd");
ADBSOAPModelBuilder builder = new ADBSOAPModelBuilder(request
.getPullParser(CreateAccountRequest.MY_QNAME),
OMAbstractFactory.getSOAP11Factory());
SOAPEnvelope env = builder.getEnvelope();
StAXSOAPModelBuilder builder2 = new StAXSOAPModelBuilder(
getTestEnvelope().getXMLStreamReaderWithoutCaching(),
DOOMAbstractFactory.getSOAP11Factory(),
SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
SOAPEnvelope envelope = builder2.getSOAPEnvelope();
envelope.build();
StringWriter writer = new StringWriter();
envelope.serialize(writer);
writer.flush();
XMLStreamReader r = StAXUtils.createXMLStreamReader(new StringReader(writer.toString()));
PrintEvents.print(r);
//TODO: FIXME. Simpler test in testPrintEvents2
//assertXMLEqual(writer.toString(),xml);
}
示例6: getSoapVersionURI
/**
* Get SOAP version being used.
*
* @return version
*/
public String getSoapVersionURI() {
if (soapVersionURI == null && parent != null) {
return parent.getSoapVersionURI();
}
return soapVersionURI == null ? SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI
: soapVersionURI;
}
示例7: processSoapAttachments
private static void processSoapAttachments(String identifier,
List policyComponents, AxisService service) {
Map map = service.getEndpoints();
String soapVersion =
(identifier.indexOf("soap12") > -1) ? SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI
: SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
for (Object o : map.values()) {
AxisEndpoint axisEndpoint = (AxisEndpoint)o;
AxisBinding axisBinding = axisEndpoint.getBinding();
String wsoap = (String)axisBinding
.getProperty(WSDL2Constants.ATTR_WSOAP_VERSION);
if (soapVersion.equals(wsoap)) {
String[] identifiers = identifier.split("/");
int key = identifiers.length;
if (key == 1) {
axisBinding.getPolicySubject().attachPolicyComponents(
policyComponents);
} else if (key == 2 || key == 3) {
String opName = identifiers[1];
opName = opName.substring(opName.indexOf(":") + 1, opName
.length());
AxisBindingOperation bindingOperation = null;
boolean found = false;
for (Iterator i = axisBinding.getChildren(); i.hasNext();) {
bindingOperation = (AxisBindingOperation)i.next();
if (opName.equals(bindingOperation.getName()
.getLocalPart())) {
found = true;
break;
}
}
if (!found) {
throw new IllegalArgumentException(
"Invalid binding operation " + opName);
}
if (key == 2) {
bindingOperation.getPolicySubject()
.attachPolicyComponents(policyComponents);
} else {
if ("in".equals(identifiers[2])) {
AxisBindingMessage bindingInMessage =
(AxisBindingMessage)bindingOperation
.getChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
bindingInMessage.getPolicySubject()
.attachPolicyComponents(policyComponents);
} else if ("out".equals(identifiers[2])) {
AxisBindingMessage bindingOutMessage =
(AxisBindingMessage)bindingOperation
.getChild(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
bindingOutMessage.getPolicySubject()
.attachPolicyComponents(policyComponents);
} else {
// FIXME faults
}
}
}
break;
}
}
}
示例8: getSOAPNamespaceFromContentType
/**
* @param contentType The contentType of the incoming message. It may be null
* @param defaultSOAPNamespace Usually set the version that is expected. This a fallback if the contentType is unavailable or
* does not match our expectations
* @return null or the soap namespace. A null indicates that the message will be interpretted as a non-SOAP (i.e. REST) message
*/
private static String getSOAPNamespaceFromContentType(String contentType,
String defaultSOAPNamespace) {
String returnNS = defaultSOAPNamespace;
// Discriminate using the content Type
if (contentType != null) {
/*
* SOAP11 content-type is "text/xml"
* SOAP12 content-type is "application/soap+xml"
*
* What about other content-types?
*
* TODO: I'm not fully convinced this method is complete, given the media types
* listed in HTTPConstants. Should we assume all application/* is SOAP12?
* Should we assume all text/* is SOAP11?
*
* So, we'll follow this pattern:
* 1) find the content-type main setting
* 2) if (1) not understood, find the "type=" param
* Thilina: I merged (1) & (2)
*/
if (JavaUtils.indexOfIgnoreCase(contentType, SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1)
{
returnNS = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
}
// search for "type=text/xml"
else
if (JavaUtils.indexOfIgnoreCase(contentType, SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1)
{
returnNS = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
}
}
if (returnNS == null) {
if (log.isDebugEnabled()) {
log.debug("No content-type or \"type=\" parameter was found in the content-type " +
"header and no default was specified, thus defaulting to SOAP 1.1.");
}
returnNS = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
}
if (log.isDebugEnabled()) {
log.debug("content-type: " + contentType);
log.debug("defaultSOAPNamespace: " + defaultSOAPNamespace);
log.debug("Returned namespace: " + returnNS);
}
return returnNS;
}