本文整理汇总了Java中org.apache.axis2.description.AxisEndpoint.getBinding方法的典型用法代码示例。如果您正苦于以下问题:Java AxisEndpoint.getBinding方法的具体用法?Java AxisEndpoint.getBinding怎么用?Java AxisEndpoint.getBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.description.AxisEndpoint
的用法示例。
在下文中一共展示了AxisEndpoint.getBinding方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractBindingInformation
import org.apache.axis2.description.AxisEndpoint; //导入方法依赖的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);
}
示例2: applyPolicyToSOAPBindings
import org.apache.axis2.description.AxisEndpoint; //导入方法依赖的package包/类
/**
* Applies the MTOM policy to the binding level of the web service.
*
* @param axisService the {@link AxisService} to whom binding level the MTOM policy should be attached.
* @param policy the {@link Policy} object that contains the MTOM assertion.
* @throws AxisFault thrown if the parameter is locked on a parent level - thus it could not be added.
*/
public static void applyPolicyToSOAPBindings(AxisService axisService,
Policy policy) throws AxisFault {
Parameter param = axisService.getParameter(MTOM_ASSERTION_APPLIED);
if ( policy == null || (param != null && Constants.VALUE_TRUE.equals(param.getValue()))) {
return;
}
for (Object obj : axisService.getEndpoints().values()) {
AxisEndpoint endpoint = (AxisEndpoint) obj;
AxisBinding binding = endpoint.getBinding();
if (Java2WSDLConstants.TRANSPORT_URI.equals(binding.getType())
|| WSDL2Constants.URI_WSDL2_SOAP.equals(binding.getType())) {
binding.getPolicySubject().attachPolicy(policy);
}
}
axisService
.addParameter("MTOM_ASSERTION_APPLIED", Constants.VALUE_TRUE);
}
示例3: addPolicyToAllBindings
import org.apache.axis2.description.AxisEndpoint; //导入方法依赖的package包/类
public void addPolicyToAllBindings(AxisService axisService, Policy policy)
throws ServerException {
try {
if (policy.getId() == null) {
// Generate an ID
policy.setId(UUIDGenerator.getUUID());
}
Map endPointMap = axisService.getEndpoints();
for (Object o : endPointMap.entrySet()) {
Map.Entry entry = (Map.Entry) o;
AxisEndpoint point = (AxisEndpoint) entry.getValue();
AxisBinding binding = point.getBinding();
String bindingName = binding.getName().getLocalPart();
//only UTOverTransport is allowed for HTTP
if (bindingName.endsWith("HttpBinding") &&
(!policy.getAttributes().containsValue("UTOverTransport"))) {
continue;
}
binding.getPolicySubject().attachPolicy(policy);
// Add the new policy to the registry
}
} catch (Exception e) {
log.error("Error in adding security policy to all bindings", e);
throw new ServerException("addPoliciesToService", e);
}
}
示例4: addSecurityPolicyToAllBindings
import org.apache.axis2.description.AxisEndpoint; //导入方法依赖的package包/类
/**
* This method add Policy to service at the Registry. Does not add the
* policy to Axis2. To all Bindings available
*
* @param axisService Service
* @param policy Policy
* @throws org.wso2.carbon.utils.ServerException se
*/
public void addSecurityPolicyToAllBindings(AxisService axisService, Policy policy)
throws ServerException {
try {
if (policy.getId() == null) {
policy.setId(UUIDGenerator.getUUID());
}
Map endPointMap = axisService.getEndpoints();
for (Object o : endPointMap.entrySet()) {
Map.Entry entry = (Map.Entry) o;
AxisEndpoint point = (AxisEndpoint) entry.getValue();
AxisBinding binding = point.getBinding();
String bindingName = binding.getName().getLocalPart();
//only UTOverTransport is allowed for HTTP
if (bindingName.endsWith("HttpBinding") &&
(!policy.getAttributes().containsValue("UTOverTransport"))) {
continue;
}
binding.getPolicySubject().attachPolicy(policy);
}
} catch (Exception e) {
log.error("Error in adding security policy to all bindings", e);
throw new ServerException("addPoliciesToService", e);
}
}
示例5: removeSecurityPolicyFromAllBindings
import org.apache.axis2.description.AxisEndpoint; //导入方法依赖的package包/类
public void removeSecurityPolicyFromAllBindings(AxisService axisService, String uuid)
throws ServerException {
if (log.isDebugEnabled()) {
log.debug("Removing security policy from all bindings.");
}
Map endPointMap = axisService.getEndpoints();
for (Object o : endPointMap.entrySet()) {
Map.Entry entry = (Map.Entry) o;
AxisEndpoint point = (AxisEndpoint) entry.getValue();
AxisBinding binding = point.getBinding();
if (binding.getPolicySubject().getAttachedPolicyComponent(uuid) != null) {
binding.getPolicySubject().detachPolicyComponent(uuid);
}
}
}
示例6: addSecurityPolicyToAllBindings
import org.apache.axis2.description.AxisEndpoint; //导入方法依赖的package包/类
/**
* This method add Policy to service at the Registry. Does not add the
* policy to Axis2. To all Bindings available
*
* @param axisService Service
* @param policy Policy
* @throws org.wso2.carbon.utils.ServerException se
*/
public void addSecurityPolicyToAllBindings(AxisService axisService, Policy policy)
throws ServerException {
String serviceGroupId = axisService.getAxisServiceGroup().getServiceGroupName();
try {
if (policy.getId() == null) {
policy.setId(UUIDGenerator.getUUID());
}
Map endPointMap = axisService.getEndpoints();
for (Object o : endPointMap.entrySet()) {
Map.Entry entry = (Map.Entry) o;
AxisEndpoint point = (AxisEndpoint) entry.getValue();
AxisBinding binding = point.getBinding();
String bindingName = binding.getName().getLocalPart();
//only UTOverTransport is allowed for HTTP
if (bindingName.endsWith("HttpBinding") &&
(!policy.getAttributes().containsValue("UTOverTransport"))) {
continue;
}
binding.getPolicySubject().attachPolicy(policy);
}
} catch (Exception e) {
log.error("Error in adding security policy to all bindings", e);
throw new ServerException("addPoliciesToService", e);
}
}
示例7: findBinding
import org.apache.axis2.description.AxisEndpoint; //导入方法依赖的package包/类
private AxisBinding findBinding() {
if (axisService != null) {
if (axisService.getEndpointName() != null) {
AxisEndpoint axisEndpoint = axisService
.getEndpoint(axisService.getEndpointName());
if (axisEndpoint != null) {
return axisEndpoint.getBinding();
}
}
}
return null;
}
示例8: WSDLAwareSOAPProcessor
import org.apache.axis2.description.AxisEndpoint; //导入方法依赖的package包/类
public WSDLAwareSOAPProcessor(MessageContext inMsgCtx) throws AxisFault {
QName bindingQName;
AxisService axisService;
inMessageCtx = inMsgCtx;
axisService = inMsgCtx.getAxisService();
serviceName = new QName(axisService.getTargetNamespace(), axisService.getName());
wsdlDef = (Definition) axisService.getParameter(WSDL_4_J_DEFINITION).getValue();
if (wsdlDef == null) {
throw new AxisFault("No WSDL Definition was found for service " +
serviceName.getLocalPart() + ".");
}
wsdlServiceDef = wsdlDef.getService(serviceName);
if (wsdlServiceDef == null) {
throw new AxisFault("WSDL Service Definition not found for service " +
serviceName.getLocalPart());
}
/**
* This will get the current end point which Axis2 picks the incoming request.
*/
AxisEndpoint axisEndpoint = (AxisEndpoint) inMsgCtx.
getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
if (axisEndpoint == null) {
String defaultEndpointName = axisService.getEndpointName();
axisEndpoint = axisService.getEndpoints().get(defaultEndpointName);
if (axisEndpoint == null) {
throw new AxisFault("AxisEndpoint cannot be null.");
}
}
portName = axisEndpoint.getName();
AxisBinding axisBinding = axisEndpoint.getBinding();
bindingQName = axisBinding.getName();
/** In this implementation, we assume that AxisBinding's QName is equal to WSDL bindings QName. */
wsdlBinding = wsdlDef.getBinding(bindingQName);
if (wsdlBinding == null) {
throw new AxisFault("WSDL Binding null for incoming message.");
}
ExtensibilityElement bindingType = getBindingExtension(wsdlBinding);
if (!(bindingType instanceof SOAPBinding || bindingType instanceof SOAP12Binding ||
bindingType instanceof HTTPBinding)) {
throw new AxisFault("WSDL Binding not supported.");
}
isRPC = isRPC(bindingType);
soapFactory = (SOAPFactory) inMsgCtx.getEnvelope().getOMFactory();
if (soapFactory == null) {
if (bindingType instanceof SOAPBinding) {
soapFactory = OMAbstractFactory.getSOAP11Factory();
} else {
soapFactory = OMAbstractFactory.getSOAP12Factory();
}
}
if (soapFactory instanceof SOAP12Factory) {
soap12 = true;
}
}
示例9: WSDLAwareSOAPProcessor
import org.apache.axis2.description.AxisEndpoint; //导入方法依赖的package包/类
public WSDLAwareSOAPProcessor(MessageContext inMsgCtx) throws AxisFault {
QName bindingQName;
AxisService axisService;
tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
// Need to solve this one way call scenario
inMessageCtx = inMsgCtx;
axisService = inMsgCtx.getAxisService();
serviceName = new QName(axisService.getTargetNamespace(), axisService.getName());
wsdlDef = (Definition) axisService.getParameter(WSDL_4_J_DEFINITION).getValue();
if (wsdlDef == null) {
throw new AxisFault("No WSDL Definition was found for service " +
serviceName.getLocalPart() + ".");
}
Service wsdlServiceDef = wsdlDef.getService(serviceName);
if (wsdlServiceDef == null) {
throw new AxisFault("WSDL Service Definition not found for service " +
serviceName.getLocalPart());
}
/**
* This will get the current end point which Axis2 picks the incoming request.
*/
AxisEndpoint axisEndpoint = (AxisEndpoint) inMsgCtx.
getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
if (axisEndpoint == null) {
String defaultEndpointName = axisService.getEndpointName();
axisEndpoint = axisService.getEndpoints().get(defaultEndpointName);
if (axisEndpoint == null) {
throw new AxisFault("AxisEndpoint cannot be null.");
}
}
portName = axisEndpoint.getName();
AxisBinding axisBinding = axisEndpoint.getBinding();
bindingQName = axisBinding.getName();
/** In this implementation, we assume that AxisBinding's QName is equal to WSDL bindings QName. */
wsdlBinding = wsdlDef.getBinding(bindingQName);
if (wsdlBinding == null) {
throw new AxisFault("WSDL Binding null for incoming message.");
}
ExtensibilityElement bindingType = getBindingExtension(wsdlBinding);
if (!(bindingType instanceof SOAPBinding || bindingType instanceof SOAP12Binding ||
bindingType instanceof HTTPBinding)) {
throw new AxisFault("WSDL Binding not supported.");
}
isRPC = isRPC(bindingType);
soapFactory = (SOAPFactory) inMsgCtx.getEnvelope().getOMFactory();
if (soapFactory == null) {
if (bindingType instanceof SOAPBinding) {
soapFactory = OMAbstractFactory.getSOAP11Factory();
} else {
soapFactory = OMAbstractFactory.getSOAP12Factory();
}
}
}
示例10: checkTypePublishing
import org.apache.axis2.description.AxisEndpoint; //导入方法依赖的package包/类
public boolean checkTypePublishing(){
MessageContext msgctx= MessageContext.getCurrentMessageContext();
AxisService axisServce= msgctx.getAxisService();
AxisEndpoint axisEndpoint= axisServce.getEndpoint("AnnotationServiceHttpEndpoint");
AxisBinding axisBinding=axisEndpoint.getBinding();
AxisBindingOperation axisBindingOperation;
Iterator<AxisBindingOperation> iterator=axisBinding.getChildren();
while(iterator.hasNext()){
axisBindingOperation=iterator.next();
if(axisBindingOperation.getName().equals(new QName("addDataFromURLandBody"))){
if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION).equals("testroot/getFromBody/{data1}")){
System.out.println("wrong http location : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION)+" expected : testroot/getFromBody/{data1}" );
return false;
}
if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD).equals("POST")){
System.out.println("wrong http method : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD)+" expected : POST" );
return false;
}
if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION).equals("application/xml")){
System.out.println("INPUT SERIALIZATION TESTS");
System.out.println("wrong input serialization : found : "+ axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION) +" expected : application/xml" );
return false;
}
if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION).equals("text/xml")){
System.out.println("OUTPUT SERIALIZATION TEST");
System.out.println("wrong output serialization : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION)+" expected : text/xml" );
return false;
}
System.out.println("Type publishing test \"addDataFromURLandBody\" OK.........");
}
if(axisBindingOperation.getName().equals(new QName("updateDataFromURL"))){
if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION).equals("testroot/update/{data1}")){
System.out.println("wrong http location : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION)+" expected : testroot/update/{data1}" );
return false;
}
if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD).equals("PUT")){
System.out.println("wrong http method : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD)+" expected : PUT" );
return false;
}
if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION).equals("text/xml")){
System.out.println("wrong input serialization : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION)+" expected : text/xml" );
return false;
}
if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION).equals("application/xml")) {
System.out.println("wrong output serialization : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION)+" expected : application/xml" );
return false;
}
System.out.println("Type publishing test \"updateDataFromURL\" OK.........");
}
if(axisBindingOperation.getName().equals(new QName("checkServicesXMLoverriding"))){
if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION).equals("serviceroot/check")){
System.out.println("wrong http location : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION)+" expected : serviceroot/check" );
return false;
}
if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD).equals("POST")){
System.out.println("wrong http method : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD)+" expected : POST" );
return false;
}
if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION).equals("application/xml")){
System.out.println("wrong input serialization : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION)+" expected : application/xml" );
return false;
}
if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION).equals("application/xml")) {
System.out.println("wrong output serialization : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION)+" expected : application/xml" );
return false;
}
System.out.println("Type publishing test \"checkServicesXMLoverriding\" OK.........");
}
}
return true; // all the test are ok
}
示例11: findBindingMessage
import org.apache.axis2.description.AxisEndpoint; //导入方法依赖的package包/类
private AxisBindingMessage findBindingMessage() {
if (axisService != null && axisOperation != null ) {
if (axisService.getEndpointName() != null) {
AxisEndpoint axisEndpoint = axisService
.getEndpoint(axisService.getEndpointName());
if (axisEndpoint != null) {
AxisBinding axisBinding = axisEndpoint.getBinding();
AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisBinding
.getChild(axisOperation.getName());
//If Binding Operation is not found, just return null
if (axisBindingOperation == null) {
return null;
}
String direction = axisMessage.getDirection();
AxisBindingMessage axisBindingMessage = null;
if (WSDLConstants.WSDL_MESSAGE_DIRECTION_IN
.equals(direction)
&& WSDLUtil
.isInputPresentForMEP(axisOperation
.getMessageExchangePattern())) {
axisBindingMessage = (AxisBindingMessage) axisBindingOperation
.getChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
return axisBindingMessage;
} else if (WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT
.equals(direction)
&& WSDLUtil
.isOutputPresentForMEP(axisOperation
.getMessageExchangePattern())) {
axisBindingMessage = (AxisBindingMessage) axisBindingOperation
.getChild(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
return axisBindingMessage;
}
}
}
}
return null;
}
示例12: processDocument
import org.apache.axis2.description.AxisEndpoint; //导入方法依赖的package包/类
/**
* @return Returns the document element.
*/
public OMElement processDocument(InputStream inputStream, String contentType,
MessageContext messageContext)
throws AxisFault {
MultipleEntryHashMap parameterMap = new MultipleEntryHashMap();
SOAPFactory soapFactory;
AxisBindingOperation axisBindingOperation =
(AxisBindingOperation) messageContext.getProperty(
Constants.AXIS_BINDING_OPERATION);
String queryParameterSeparator = null;
String templatedPath = null;
if (axisBindingOperation != null) {
queryParameterSeparator = (String) axisBindingOperation
.getProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR);
templatedPath =
(String) axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION);
}
if (queryParameterSeparator == null) {
queryParameterSeparator =
WSDL20DefaultValueHolder.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR_DEFAULT;
}
AxisEndpoint axisEndpoint =
(AxisEndpoint) messageContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
if (axisEndpoint != null) {
AxisBinding axisBinding = axisEndpoint.getBinding();
String soapVersion =
(String) axisBinding.getProperty(WSDL2Constants.ATTR_WSOAP_VERSION);
soapFactory = getSOAPFactory(soapVersion);
} else {
soapFactory = getSOAPFactory(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
}
EndpointReference endpointReference = messageContext.getTo();
if (endpointReference == null) {
throw new AxisFault("Cannot create DocumentElement without destination EPR");
}
String requestURL = endpointReference.getAddress();
try {
requestURL = extractParametersUsingHttpLocation(templatedPath, parameterMap,
requestURL,
queryParameterSeparator);
} catch (UnsupportedEncodingException e) {
throw AxisFault.makeFault(e);
}
String query = requestURL;
int index;
if ((index = requestURL.indexOf("?")) > -1) {
query = requestURL.substring(index + 1);
}
extractParametersFromRequest(parameterMap, query, queryParameterSeparator,
(String) messageContext.getProperty(
Constants.Configuration.CHARACTER_SET_ENCODING),
inputStream);
messageContext.setProperty(Constants.REQUEST_PARAMETER_MAP, parameterMap);
return BuilderUtil.buildsoapMessage(messageContext, parameterMap,
soapFactory);
}