use of org.apache.cxf.service.model.BindingOperationInfo in project cxf by apache.
the class CorbaStreamOutInterceptor method handleMessage.
public void handleMessage(Message msg) {
CorbaMessage message = (CorbaMessage) msg;
orb = (org.omg.CORBA.ORB) message.get(CorbaConstants.ORB);
Exchange exchange = message.getExchange();
service = exchange.getEndpoint().getEndpointInfo().getService();
typeMap = message.getCorbaTypeMap();
BindingOperationInfo boi = exchange.getBindingOperationInfo();
if (ContextUtils.isRequestor(message)) {
handleOutBoundMessage(message, boi);
} else {
handleInBoundMessage(message, boi);
}
message.getInterceptorChain().add(new CorbaStreamOutEndingInterceptor());
}
use of org.apache.cxf.service.model.BindingOperationInfo in project cxf by apache.
the class CorbaDSIServant method invoke.
public void invoke(ServerRequest request) throws CorbaBindingException {
String opName = request.operation();
QName requestOperation = operationMap.get(opName);
MessageImpl msgImpl = new MessageImpl();
msgImpl.setDestination(getDestination());
Exchange exg = new ExchangeImpl();
exg.put(String.class, requestOperation.getLocalPart());
exg.put(ORB.class, getOrb());
exg.put(ServerRequest.class, request);
msgImpl.setExchange(exg);
CorbaMessage msg = new CorbaMessage(msgImpl);
msg.setCorbaTypeMap(typeMap);
// If there's no output message part in our operation then it's a oneway op
BindingMessageInfo bindingMsgOutputInfo = null;
BindingOperationInfo bindingOpInfo = null;
try {
bindingOpInfo = this.destination.getEndPointInfo().getBinding().getOperation(requestOperation);
} catch (Exception ex) {
throw new CorbaBindingException("Invalid Request. Operation unknown: " + opName);
}
if (bindingOpInfo != null) {
bindingMsgOutputInfo = bindingOpInfo.getOutput();
if (bindingMsgOutputInfo == null) {
exg.setOneWay(true);
}
}
// invokes the interceptors
getObserver().onMessage(msg);
}
use of org.apache.cxf.service.model.BindingOperationInfo in project cxf by apache.
the class CorbaConduitTest method testBuildExceptionListWithExceptions.
@Test
public void testBuildExceptionListWithExceptions() throws Exception {
CorbaConduit conduit = setupCorbaConduit(false);
Message msg = new MessageImpl();
CorbaMessage message = new CorbaMessage(msg);
TestUtils testUtils = new TestUtils();
CorbaDestination destination = testUtils.getExceptionTypesTestDestination();
EndpointInfo endpointInfo2 = destination.getEndPointInfo();
QName name = new QName("http://schemas.apache.org/idl/except", "review_data", "");
BindingOperationInfo bInfo = destination.getBindingInfo().getOperation(name);
OperationType opType = bInfo.getExtensor(OperationType.class);
CorbaTypeMap typeMap = null;
List<TypeMappingType> corbaTypes = endpointInfo2.getService().getDescription().getExtensors(TypeMappingType.class);
if (corbaTypes != null) {
typeMap = CorbaUtils.createCorbaTypeMap(corbaTypes);
}
ExceptionList exList = conduit.getExceptionList(conduit.getOperationExceptions(opType, typeMap), message, opType);
assertNotNull("ExceptionList is not null", exList != null);
assertNotNull("TypeCode is not null", exList.item(0) != null);
assertEquals("ID should be equal", exList.item(0).id(), "IDL:BadRecord:1.0");
assertEquals("ID should be equal", exList.item(0).name(), "BadRecord");
assertEquals("ID should be equal", exList.item(0).member_count(), 2);
assertEquals("ID should be equal", exList.item(0).member_name(0), "reason");
assertNotNull("Member type is not null", exList.item(0).member_type(0) != null);
}
use of org.apache.cxf.service.model.BindingOperationInfo in project cxf by apache.
the class ComplexClient method main.
/**
* @param args
*/
public static void main(String[] args) throws Exception {
if (args.length == 0) {
System.out.println("please specify wsdl");
System.exit(1);
}
URL wsdlURL;
File wsdlFile = new File(args[0]);
if (wsdlFile.exists()) {
wsdlURL = wsdlFile.toURI().toURL();
} else {
wsdlURL = new URL(args[0]);
}
System.out.println(wsdlURL);
JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance();
Client client = factory.createClient(wsdlURL.toExternalForm(), SERVICE_NAME);
ClientImpl clientImpl = (ClientImpl) client;
Endpoint endpoint = clientImpl.getEndpoint();
ServiceInfo serviceInfo = endpoint.getService().getServiceInfos().get(0);
QName bindingName = new QName("http://Company.com/Application", "Company_ESB_Application_Biztalk_AgentDetails_4405_AgentDetails_PrtSoap");
BindingInfo binding = serviceInfo.getBinding(bindingName);
// {
QName opName = new QName("http://Company.com/Application", "GetAgentDetails");
BindingOperationInfo boi = binding.getOperation(opName);
BindingMessageInfo inputMessageInfo = boi.getInput();
List<MessagePartInfo> parts = inputMessageInfo.getMessageParts();
// only one part.
MessagePartInfo partInfo = parts.get(0);
Class<?> partClass = partInfo.getTypeClass();
// GetAgentDetails
System.out.println(partClass.getCanonicalName());
Object inputObject = partClass.newInstance();
// Unfortunately, the slot inside of the part object is also called 'part'.
// this is the descriptor for get/set part inside the GetAgentDetails class.
PropertyDescriptor partPropertyDescriptor = new PropertyDescriptor("part", partClass);
// This is the type of the class which really contains all the parameter information.
// AgentWSRequest
Class<?> partPropType = partPropertyDescriptor.getPropertyType();
System.out.println(partPropType.getCanonicalName());
Object inputPartObject = partPropType.newInstance();
partPropertyDescriptor.getWriteMethod().invoke(inputObject, inputPartObject);
PropertyDescriptor numberPropertyDescriptor = new PropertyDescriptor("agentNumber", partPropType);
numberPropertyDescriptor.getWriteMethod().invoke(inputPartObject, new Integer(314159));
Object[] result = client.invoke(opName, inputObject);
Class<?> resultClass = result[0].getClass();
// GetAgentDetailsResponse
System.out.println(resultClass.getCanonicalName());
PropertyDescriptor resultDescriptor = new PropertyDescriptor("agentWSResponse", resultClass);
Object wsResponse = resultDescriptor.getReadMethod().invoke(result[0]);
Class<?> wsResponseClass = wsResponse.getClass();
System.out.println(wsResponseClass.getCanonicalName());
PropertyDescriptor agentNameDescriptor = new PropertyDescriptor("agentName", wsResponseClass);
String agentName = (String) agentNameDescriptor.getReadMethod().invoke(wsResponse);
System.out.println("Agent name: " + agentName);
}
use of org.apache.cxf.service.model.BindingOperationInfo in project cxf by apache.
the class ReflectionServiceFactoryTest method testServerFactoryBean.
@Test
public void testServerFactoryBean() throws Exception {
Service service = createService(true);
assertEquals("test", service.get("test"));
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setAddress("http://localhost/Hello");
svrBean.setServiceFactory(serviceFactory);
svrBean.setServiceBean(new HelloServiceImpl());
svrBean.setBus(getBus());
Map<String, Object> props = new HashMap<>();
props.put("test", "test");
serviceFactory.setProperties(props);
svrBean.setProperties(props);
Server server = svrBean.create();
assertNotNull(server);
Map<QName, Endpoint> eps = service.getEndpoints();
assertEquals(1, eps.size());
Endpoint ep = eps.values().iterator().next();
EndpointInfo endpointInfo = ep.getEndpointInfo();
assertEquals("test", ep.get("test"));
BindingInfo b = endpointInfo.getService().getBindings().iterator().next();
assertTrue(b instanceof SoapBindingInfo);
SoapBindingInfo sb = (SoapBindingInfo) b;
assertEquals("HelloServiceSoapBinding", b.getName().getLocalPart());
assertEquals("document", sb.getStyle());
assertEquals(4, b.getOperations().size());
BindingOperationInfo bop = b.getOperations().iterator().next();
SoapOperationInfo sop = bop.getExtensor(SoapOperationInfo.class);
assertNotNull(sop);
assertEquals("", sop.getAction());
assertEquals("document", sop.getStyle());
}
Aggregations