本文整理汇总了Java中org.apache.axis2.description.WSDL2Constants类的典型用法代码示例。如果您正苦于以下问题:Java WSDL2Constants类的具体用法?Java WSDL2Constants怎么用?Java WSDL2Constants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WSDL2Constants类属于org.apache.axis2.description包,在下文中一共展示了WSDL2Constants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gzipCompressionInsideOutSequenceTest
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "having 'Content-Encoding = gzip' within outsequence")
public void gzipCompressionInsideOutSequenceTest() throws Exception {
ServiceClient client = getServiceClient(getProxyServiceURLHttp("sendingGZIPCompressedPayloadToClient"));
client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP, true);
OMElement response = client.sendReceive(Utils.getStockQuoteRequest("GZIP"));
OperationContext operationContext = client.getLastOperationContext();
MessageContext inMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);
CommonsTransportHeaders transportHeaders = (CommonsTransportHeaders) inMessageContext.getProperty(TRANSPORT_HEADERS);
Assert.assertTrue(transportHeaders.containsKey(CONTENT_ENCODING), "Response Message not encoded");
Assert.assertEquals(transportHeaders.get(CONTENT_ENCODING), "gzip", "Response Message not gzip encoded");
Assert.assertTrue(response.toString().contains("GZIP"));
Assert.assertTrue(response.toString().contains("GZIP Company"));
}
示例2: dispatchAndVerify
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
/**
* Finds axis Service and the Operation for DSS requests
*
* @param msgContext request message context
* @throws AxisFault if any exception occurs while finding axis service or operation
*/
private static void dispatchAndVerify(MessageContext msgContext) throws AxisFault {
requestDispatcher.invoke(msgContext);
AxisService axisService = msgContext.getAxisService();
if (axisService != null) {
httpLocationBasedDispatcher.invoke(msgContext);
if (msgContext.getAxisOperation() == null) {
requestURIOperationDispatcher.invoke(msgContext);
}
AxisOperation axisOperation;
if ((axisOperation = msgContext.getAxisOperation()) != null) {
AxisEndpoint axisEndpoint =
(AxisEndpoint) msgContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
if (axisEndpoint != null) {
AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisEndpoint
.getBinding().getChild(axisOperation.getName());
msgContext.setProperty(Constants.AXIS_BINDING_OPERATION, axisBindingOperation);
}
msgContext.setAxisOperation(axisOperation);
}
}
}
示例3: getOptions
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
protected Options getOptions(String action, boolean enableMTOM, String url) {
Options options = new Options();
options.setAction(action);
options.setProperty(WSDL2Constants.ATTRIBUTE_MUST_UNDERSTAND,"1");
options.setTo( new EndpointReference(url) );
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
// try {
// String from = InetAddress.getLocalHost().getHostAddress();
// options.setFrom(new EndpointReference(from));
// }catch(UnknownHostException e) {
// //ignore From
// }
if (enableMTOM)
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
else
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_FALSE);
//use SOAP12,
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
return options;
}
示例4: extractBindingInformation
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
private static Binding extractBindingInformation(final AxisService service,
final Definition wsdlOfService,
final MessageContext inMessageContext) {
AxisEndpoint currentEndpoint = (AxisEndpoint) inMessageContext
.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
if (currentEndpoint == null) {
String defaultEndpointName = service.getEndpointName();
currentEndpoint = service.getEndpoints().get(defaultEndpointName);
if (currentEndpoint == null) {
throw new NullPointerException("AxisEndpoint cannot be null.");
}
}
AxisBinding currentAxisBinding = currentEndpoint.getBinding();
QName bindingQName = currentAxisBinding.getName();
return wsdlOfService.getBinding(bindingQName);
}
示例5: waitForReply
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
private void waitForReply(MessageContext messageContext, DatagramSocket datagramSocket,
String contentType) throws IOException {
// piggy back message constant is used to pass a piggy back
// message context in asnych model
if (!(messageContext.getAxisOperation() instanceof OutInAxisOperation) &&
messageContext.getProperty(org.apache.axis2.Constants.PIGGYBACK_MESSAGE) == null) {
return;
}
byte[] inputBuffer = new byte[4096]; //TODO set the maximum size parameter
DatagramPacket packet = new DatagramPacket(inputBuffer, inputBuffer.length);
datagramSocket.receive(packet);
// create the soap envelope
try {
MessageContext respMessageContext = messageContext.getOperationContext().
getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);
InputStream inputStream = new ByteArrayInputStream(inputBuffer, 0, packet.getLength());
SOAPEnvelope envelope = TransportUtils.createSOAPMessage(respMessageContext,
inputStream, contentType);
respMessageContext.setEnvelope(envelope);
} catch (XMLStreamException e) {
throw new AxisFault("Can not build the soap message ", e);
}
}
示例6: createMessageContext
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
public MessageContext createMessageContext() throws AxisFault {
MessageContext msgContext = listener.createMessageContext();
if (service != null) {
msgContext.setAxisService(service);
// find the operation for the message, or default to one
Parameter operationParam = service.getParameter(BaseConstants.OPERATION_PARAM);
QName operationQName = (
operationParam != null ?
BaseUtils.getQNameFromString(operationParam.getValue()) :
BaseConstants.DEFAULT_OPERATION);
AxisOperation operation = service.getOperation(operationQName);
if (operation != null) {
msgContext.setAxisOperation(operation);
msgContext.setAxisMessage(
operation.getMessage(WSDL2Constants.MESSAGE_LABEL_IN));
msgContext.setSoapAction("urn:" + operation.getName().getLocalPart());
}
}
return msgContext;
}
示例7: testAddDataFromURL
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
/**
*
* @throws Exception
*/
public void testAddDataFromURL() throws Exception{
Options options= TestUtil.getArchiveTestOptions();
// setting test case dependent settings
options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/add/{data1}");
options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_POST);
options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
String stringPayload = "<addDataFromURL xmlns=\"http://jaxrs.apache.org\"><data1>account</data1></addDataFromURL>";
OMElement payload= AXIOMUtil.stringToOM(stringPayload);
OMElement respond=sender.sendReceive(payload);
OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
assertEquals("account created", returnElem.getText() );
}
示例8: testAddDataFromURLandBody
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
public void testAddDataFromURLandBody() throws Exception{
Options options= TestUtil.getArchiveTestOptions();
// setting test case dependent settings
options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/getFromBody/{data1}");
options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_POST);
options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
String stringPayload = "<addDataFromURLandBody xmlns=\"http://jaxrs.apache.org\"><data1>account</data1><data2>password</data2></addDataFromURLandBody>";
OMElement payload= AXIOMUtil.stringToOM(stringPayload);
OMElement respond=sender.sendReceive(payload);
OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
assertEquals("account and password created", returnElem.getText() );
}
示例9: testUpdateDataFromURL
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
public void testUpdateDataFromURL() throws Exception{
Options options= TestUtil.getArchiveTestOptions();
// setting test case dependent settings
options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/update/{data1}");
options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_PUT);
options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
String stringPayload = "<addDataFromURL xmlns=\"http://jaxrs.apache.org\"><data1>account</data1></addDataFromURL>";
OMElement payload= AXIOMUtil.stringToOM(stringPayload);
OMElement respond=sender.sendReceive(payload);
OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
assertEquals("account updated", returnElem.getText() );
}
示例10: testUpdateDataFromURLandBody
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
public void testUpdateDataFromURLandBody() throws Exception{
Options options= TestUtil.getArchiveTestOptions();
// setting test case dependent settings
options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/getFromBody/{data1}");
options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_PUT);
options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
String stringPayload = "<addDataFromURLandBody xmlns=\"http://jaxrs.apache.org\"><data1>account</data1><data2>password</data2></addDataFromURLandBody>";
OMElement payload= AXIOMUtil.stringToOM(stringPayload);
OMElement respond=sender.sendReceive(payload);
OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
assertEquals("account and password updated", returnElem.getText() );
}
示例11: testGetDataFromURL
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
public void testGetDataFromURL() throws Exception{
Options options= TestUtil.getArchiveTestOptions();
// setting test case dependent settings
options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/get/{data1}");
options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_GET);
options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
String stringPayload = "<getDataFromURL xmlns=\"http://jaxrs.apache.org\"><data1>account</data1></getDataFromURL>";
OMElement payload= AXIOMUtil.stringToOM(stringPayload);
OMElement respond=sender.sendReceive(payload);
OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
assertEquals("account read", returnElem.getText() );
}
示例12: testGetDataFromURLandBody
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
public void testGetDataFromURLandBody() throws Exception{
Options options= TestUtil.getArchiveTestOptions();
// setting test case dependent settings
options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/getFromBody/{data1}");
options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_GET);
options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
String stringPayload = "<addDataFromURLandBody xmlns=\"http://jaxrs.apache.org\"><data1>account</data1><data2>password</data2></addDataFromURLandBody>";
OMElement payload= AXIOMUtil.stringToOM(stringPayload);
OMElement respond=sender.sendReceive(payload);
OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
assertEquals("account and password read", returnElem.getText() );
}
示例13: testDeleteDataFromURL
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
public void testDeleteDataFromURL() throws Exception{
Options options= TestUtil.getArchiveTestOptions();
// setting test case dependent settings
options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/delete/{data1}");
options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_DELETE);
options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
String stringPayload = "<deleteDataFromURL xmlns=\"http://jaxrs.apache.org\"><data1>account</data1></deleteDataFromURL>";
OMElement payload= AXIOMUtil.stringToOM(stringPayload);
OMElement respond=sender.sendReceive(payload);
OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
assertEquals("account deleted", returnElem.getText() );
}
示例14: testDeleteDataFromURLandBody
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
public void testDeleteDataFromURLandBody() throws Exception{
Options options= TestUtil.getArchiveTestOptions();
// setting test case dependent settings
options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/getFromBody/{data1}");
options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_DELETE);
options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
String stringPayload = "<addDataFromURLandBody xmlns=\"http://jaxrs.apache.org\"><data1>account</data1><data2>password</data2></addDataFromURLandBody>";
OMElement payload= AXIOMUtil.stringToOM(stringPayload);
OMElement respond=sender.sendReceive(payload);
OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
assertEquals("account and password deleted", returnElem.getText() );
}
示例15: testCheckServicesXMLoverriding
import org.apache.axis2.description.WSDL2Constants; //导入依赖的package包/类
public void testCheckServicesXMLoverriding() throws Exception{
Options options= TestUtil.getArchiveTestOptions();
// setting test case dependent settings
options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"serviceroot/check");
options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_POST);
options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_APPLICATION_XML);
ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
String stringPayload = "<checkServicesXMLoverriding xmlns=\"http://jaxrs.apache.org\"><data1>account</data1><data2>password</data2></checkServicesXMLoverriding>";
OMElement payload= AXIOMUtil.stringToOM(stringPayload);
OMElement respond=sender.sendReceive(payload);
OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
assertEquals("account and password correct", returnElem.getText() );
}