本文整理汇总了Java中org.apache.axiom.soap.SOAPFactory类的典型用法代码示例。如果您正苦于以下问题:Java SOAPFactory类的具体用法?Java SOAPFactory怎么用?Java SOAPFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SOAPFactory类属于org.apache.axiom.soap包,在下文中一共展示了SOAPFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDefaultSOAPEnvelope
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
private SOAPEnvelope createDefaultSOAPEnvelope(MessageContext inMsgCtx) {
String soapNamespace = inMsgCtx.getEnvelope().getNamespace()
.getNamespaceURI();
SOAPFactory soapFactory = null;
if (soapNamespace.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
soapFactory = OMAbstractFactory.getSOAP11Factory();
} else if (soapNamespace
.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
soapFactory = OMAbstractFactory.getSOAP12Factory();
} else {
log.error("Unknown SOAP Envelope");
}
if (soapFactory != null) {
return soapFactory.getDefaultEnvelope();
}
return null;
}
示例2: buildSoapEnvelope
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
private SOAPEnvelope buildSoapEnvelope(String clientID, String value) {
SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
SOAPHeader header = soapFactory.createSOAPHeader();
envelope.addChild(header);
OMNamespace synNamespace = soapFactory.createOMNamespace(
"http://ws.apache.org/ns/synapse", "syn");
OMElement clientIDElement = soapFactory.createOMElement("ClientID", synNamespace);
clientIDElement.setText(clientID);
header.addChild(clientIDElement);
SOAPBody body = soapFactory.createSOAPBody();
envelope.addChild(body);
OMElement valueElement = soapFactory.createOMElement("Value", null);
valueElement.setText(value);
body.addChild(valueElement);
return envelope;
}
示例3: buildSoapEnvelope
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
private SOAPEnvelope buildSoapEnvelope(String clientID, String value) {
SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
SOAPHeader header = soapFactory.createSOAPHeader();
envelope.addChild(header);
OMNamespace synNamespace = soapFactory.
createOMNamespace("http://ws.apache.org/ns/synapse", "syn");
OMElement clientIDElement = soapFactory.createOMElement("ClientID", synNamespace);
clientIDElement.setText(clientID);
header.addChild(clientIDElement);
SOAPBody body = soapFactory.createSOAPBody();
envelope.addChild(body);
OMElement valueElement = soapFactory.createOMElement("Value", null);
valueElement.setText(value);
body.addChild(valueElement);
return envelope;
}
示例4: createMultipleQuoteRequestBody
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
private OMElement createMultipleQuoteRequestBody(String symbol, int iterations) {
SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
OMElement method1 = fac.createOMElement("getQuotes", omNs);
OMElement method2 = fac.createOMElement("getQuote", omNs);
for (int i = 0; i < iterations; i++) {
OMElement value1 = fac.createOMElement("request", omNs);
OMElement value2 = fac.createOMElement("symbol", omNs);
value2.addChild(fac.createOMText(value1, symbol));
value1.addChild(value2);
method2.addChild(value1);
method1.addChild(method2);
}
return method1;
}
示例5: createNestedQuoteRequestBody
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
private OMElement createNestedQuoteRequestBody(String symbol, int noOfItr) {
SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
OMElement method1 = fac.createOMElement("getQuotes", omNs);
for (int i = 0; i < noOfItr; i++) {
OMElement method2 = fac.createOMElement("getQuote", omNs);
for (int j = 0; j < noOfItr; j++) {
OMElement value1 = fac.createOMElement("request", omNs);
OMElement value2 = fac.createOMElement("symbol", omNs);
value2.addChild(fac.createOMText(value1, symbol));
value1.addChild(value2);
method2.addChild(value1);
}
method1.addChild(method2);
}
return method1;
}
示例6: createGetQuotesRequestBody
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
private OMElement createGetQuotesRequestBody(String symbol, int iterations) {
SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
OMElement top = fac.createOMElement("getQuotes", omNs);
for (int i = 0; i < iterations; i++) {
OMElement method = fac.createOMElement("getQuote", omNs);
OMElement value1 = fac.createOMElement("request", omNs);
OMElement value2 = fac.createOMElement("symbol", omNs);
value2.addChild(fac.createOMText(value1, symbol));
value1.addChild(value2);
method.addChild(value1);
top.addChild(method);
}
return top;
}
示例7: createPayload
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
private OMElement createPayload() {
// creation of payload for placeOrder
SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
OMNamespace omXsdNs = fac.createOMNamespace("http://services.samples", "xsd");
OMNamespace omSerNs = fac.createOMNamespace("http://services.samples", "ser");
OMElement operation = fac.createOMElement("placeOrder", omSerNs);
OMElement method = fac.createOMElement("order", omSerNs);
OMElement getPrice = fac.createOMElement("price", omXsdNs);
OMElement getQuantity = fac.createOMElement("quantity", omXsdNs);
OMElement getSymbol = fac.createOMElement("symbol", omXsdNs);
method.addChild(fac.createOMText(getPrice, "123.32"));
method.addChild(fac.createOMText(getQuantity, "4"));
method.addChild(fac.createOMText(getSymbol, "IBM"));
operation.addChild(method);
return operation;
}
示例8: sendSOAPResponse
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
public static String sendSOAPResponse(HttpServletResponse response, OMElement resultElements) {
try {
SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
SOAPEnvelope responseEnvelope = soapFactory.createSOAPEnvelope();
SOAPBody responseBody = soapFactory.createSOAPBody();
responseBody.addChild(resultElements);
responseEnvelope.addChild(responseBody);
// log the response message
if (Debug.infoOn()) {
Debug.logInfo("SOAP Response Message:\n" + responseEnvelope + "\n", module);
}
response.setContentType(SoapService.XML_TYPE);
OutputStream out = response.getOutputStream();
responseEnvelope.serialize(out);
out.flush();
}
catch (Exception ex) {
Debug.logError("Error invoking soap service " + ex.getMessage(), module);
return "error";
}
return "success";
}
示例9: createEnvelope
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
/**
* Creates a new SOAP Envelope for sending an ebMS 3 message. The created SOAP envelop will already contain a
* declaration of the ebMS 3 namespace.
*
* @param v The SOAP version to use
* @return The newly created SOAP envelope
*/
public static org.apache.axiom.soap.SOAPEnvelope createEnvelope(final SOAPVersion v) {
SOAPFactory omFactory = null;
// Check which SOAP version to use
if (v == SOAPVersion.SOAP_11) {
omFactory = OMAbstractFactory.getSOAP11Factory();
} else {
omFactory = OMAbstractFactory.getSOAP12Factory();
}
final org.apache.axiom.soap.SOAPEnvelope envelope = omFactory.getDefaultEnvelope();
declareNamespaces(envelope);
return envelope;
}
示例10: createBPELMessageContext
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
/**
* Create BPELMessageContext object using information from in message context.
*
* @param inMessageContext in message context
* @param processProxy BPEL process proxy object
* @param soapFactory SOAPFactory instance
* @return BPELMessageContext instance
* @throws AxisFault in case of a error(most of the times AxisFault will be thrown from methods
* used inside the implementation).
*/
public static BPELMessageContext createBPELMessageContext(final MessageContext inMessageContext,
final BPELProcessProxy processProxy,
final SOAPFactory soapFactory)
throws AxisFault {
BPELMessageContext bpelMessageContext =
new BPELMessageContext(processProxy.getWsdlDefinition());
bpelMessageContext.setInMessageContext(inMessageContext);
bpelMessageContext.setSoapFactoryForCurrentMessageFlow(soapFactory);
if (hasResponse(inMessageContext.getAxisOperation())) {
setOutMessageContextToBPELMessageContext(bpelMessageContext);
}
fillBindingAndRelatedInformation(bpelMessageContext);
bpelMessageContext.setRequestMessage(
extractRequestMessageFromInMessageContext(inMessageContext));
return bpelMessageContext;
}
示例11: createSoapFault
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
/**
* Crete SOAP Fault from fault information returned from ODE.
*
* @param bpelMessageContext DTO containing information on current messageflow.
* @param odeMessageContext ODE MyRoleMessageExchange containing information on current process
* invocation.
* @return SOAPFault instance
* @throws AxisFault in case of a error while creating SOAP Fault.
*/
public static SOAPFault createSoapFault(final BPELMessageContext bpelMessageContext,
final MessageExchange odeMessageContext)
throws AxisFault {
SOAPFactory soapFactory = bpelMessageContext.getSoapFactoryForCurrentMessageFlow();
OMElement detail = buildSoapDetail(bpelMessageContext, odeMessageContext);
SOAPFault fault = soapFactory.createSOAPFault();
SOAPFaultCode code = soapFactory.createSOAPFaultCode(fault);
code.setText(new QName(Namespaces.SOAP_ENV_NS, "Server"));
SOAPFaultReason reason = soapFactory.createSOAPFaultReason(fault);
reason.setText(odeMessageContext.getFault());
SOAPFaultDetail soapDetail = soapFactory.createSOAPFaultDetail(fault);
if (detail != null) {
soapDetail.addDetailEntry(detail);
}
return fault;
}
示例12: getSoapFactory
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
public SOAPFactory getSoapFactory() throws FaultException {
Binding binding = getBinding();
ExtensibilityElement bindingType = SOAPHelper.getBindingExtension(binding);
if (!(bindingType instanceof SOAPBinding || bindingType instanceof SOAP12Binding ||
bindingType instanceof HTTPBinding)) {
throw new FaultException(BPEL4PeopleConstants.B4P_FAULT,
"Service binding is not supported for service " + serviceName + " and port " +
getServicePort());
}
if (bindingType instanceof SOAPBinding) {
return OMAbstractFactory.getSOAP11Factory();
} else {
return OMAbstractFactory.getSOAP12Factory();
}
}
示例13: invoke
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
public OMElement invoke(OMElement obj) {
// since this is test code, let's check the inbound obj:
SOAPEnvelope inboundEnv = (SOAPEnvelope)obj;
SOAPBody inboundBody = inboundEnv.getBody();
Iterator it = inboundBody.getChildren();
OMElement el3 = null;
for (;it.hasNext();) {
OMElement el2 = (OMElement)it.next();
Iterator it2 = el2.getChildElements();
for (;it2.hasNext();) {
el3 = (OMElement)it2.next();
assert(el3.getText().equals("SAMPLE REQUEST MESSAGE"));
}
}
assert(el3 != null);
OMElement payload = createPayload();
SOAPFactory factory = new SOAP12Factory();
SOAPEnvelope env = factory.createSOAPEnvelope();
SOAPBody body = factory.createSOAPBody(env);
body.addChild(payload);
return env;
}
示例14: getDocumentFromSOAPEnvelope
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
/**
* 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();
}
示例15: addChildElement
import org.apache.axiom.soap.SOAPFactory; //导入依赖的package包/类
public SOAPElement addChildElement(SOAPElement soapElement) throws SOAPException {
OMNamespace ns = new NamespaceImpl(soapElement.getNamespaceURI(),
soapElement.getPrefix());
SOAPHeaderBlock headerBlock = null;
if (this.element.getOMFactory() instanceof SOAP11Factory) {
headerBlock = new SOAP11HeaderBlockImpl(soapElement.getLocalName(), ns,
omSOAPHeader,
(SOAPFactory)this.element.getOMFactory());
} else {
headerBlock = new SOAP12HeaderBlockImpl(soapElement.getLocalName(), ns,
omSOAPHeader,
(SOAPFactory)this.element.getOMFactory());
}
SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock);
element.setUserData(SAAJ_NODE, this, null);
soapHeaderElement.element.setUserData(SAAJ_NODE, soapHeaderElement, null);
soapHeaderElement.setParentElement(this);
return soapHeaderElement;
}