use of org.apache.cxf.tools.wsdlto.frontend.jaxws.customization.JAXWSBinding in project cxf by apache.
the class ServiceProcessor method processPort.
private JavaPort processPort(JavaModel model, ServiceInfo si, EndpointInfo port) throws ToolException {
BindingInfo binding = port.getBinding();
String portType = binding.getInterface().getName().getLocalPart();
JavaInterface intf = PortTypeProcessor.getInterface(context, si, binding.getInterface());
JavaPort jport = new JavaPort(NameUtil.mangleNameToClassName(port.getName().getLocalPart()));
jport.setPackageName(intf.getPackageName());
jport.setPortName(port.getName().getLocalPart());
jport.setBindingAdress(port.getAddress());
jport.setBindingName(binding.getName().getLocalPart());
jport.setPortType(portType);
jport.setInterfaceClass(intf.getName());
bindingType = getBindingType(binding);
if (bindingType == null) {
org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message("BINDING_SPECIFY_ONE_PROTOCOL", LOG, binding.getName());
throw new ToolException(msg);
}
if (isSoapBinding()) {
SoapBinding spbd = SOAPBindingUtil.getProxy(SoapBinding.class, this.bindingObj);
jport.setStyle(SOAPBindingUtil.getSoapStyle(spbd.getStyle()));
jport.setTransURI(spbd.getTransportURI());
}
Collection<BindingOperationInfo> operations = binding.getOperations();
for (BindingOperationInfo bop : operations) {
processOperation(model, bop, binding);
}
jport.setJavaDoc(port.getDocumentation());
JAXWSBinding bind = port.getExtensor(JAXWSBinding.class);
if (bind != null) {
jport.setMethodName(bind.getMethodName());
jport.setJavaDoc(bind.getMethodJavaDoc());
}
return jport;
}
use of org.apache.cxf.tools.wsdlto.frontend.jaxws.customization.JAXWSBinding in project cxf by apache.
the class ServiceProcessor method process.
public void process(ServiceInfo si) throws ToolException {
jaxwsBinding = new JAXWSBinding();
this.service = si;
if (si.getName() == null) {
processBindings(context.get(JavaModel.class));
} else {
processService(context.get(JavaModel.class));
}
}
use of org.apache.cxf.tools.wsdlto.frontend.jaxws.customization.JAXWSBinding in project cxf by apache.
the class JAXWSDefinitionBuilderTest method testCustomizationWithDifferentNS.
@Test
public void testCustomizationWithDifferentNS() {
env.put(ToolConstants.CFG_WSDLURL, getClass().getResource("resources/hello_world.wsdl").toString());
env.put(ToolConstants.CFG_BINDING, getClass().getResource("resources/binding3.xml").toString());
JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder();
builder.setContext(env);
builder.setBus(BusFactory.getDefaultBus());
builder.build();
builder.customize();
Definition customizedDef = builder.getWSDLModel();
List<?> defExtensionList = customizedDef.getExtensibilityElements();
Iterator<?> ite = defExtensionList.iterator();
while (ite.hasNext()) {
ExtensibilityElement extElement = (ExtensibilityElement) ite.next();
JAXWSBinding binding = (JAXWSBinding) extElement;
assertEquals("Customized package name does not been parsered", "com.foo", binding.getPackage());
assertEquals("Customized enableAsync does not parsered", true, binding.isEnableAsyncMapping());
}
PortType portType = customizedDef.getPortType(new QName("http://apache.org/hello_world_soap_http", "Greeter"));
List<?> portTypeList = portType.getExtensibilityElements();
JAXWSBinding binding = (JAXWSBinding) portTypeList.get(0);
assertEquals("Customized enable EnableWrapperStyle name does not been parsered", true, binding.isEnableWrapperStyle());
List<?> opList = portType.getOperations();
Operation operation = (Operation) opList.get(0);
List<?> extList = operation.getExtensibilityElements();
binding = (JAXWSBinding) extList.get(0);
assertEquals("Customized method name does not parsered", "echoMeOneWay", binding.getMethodName());
assertEquals("Customized parameter element name does not parsered", "number1", binding.getJaxwsParas().get(0).getElementName().getLocalPart());
assertEquals("Customized parameter message name does not parsered", "greetMeOneWayRequest", binding.getJaxwsParas().get(0).getMessageName());
assertEquals("customized parameter name does not parsered", "num1", binding.getJaxwsParas().get(0).getName());
}
use of org.apache.cxf.tools.wsdlto.frontend.jaxws.customization.JAXWSBinding in project cxf by apache.
the class JAXWSDefinitionBuilderTest method testCustomization.
@Test
public void testCustomization() {
env.put(ToolConstants.CFG_WSDLURL, getClass().getResource("resources/hello_world.wsdl").toString());
env.put(ToolConstants.CFG_BINDING, getClass().getResource("resources/binding2.xml").toString());
JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder();
builder.setContext(env);
builder.setBus(BusFactory.getDefaultBus());
builder.build();
builder.customize();
Definition customizedDef = builder.getWSDLModel();
List<?> defExtensionList = customizedDef.getExtensibilityElements();
Iterator<?> ite = defExtensionList.iterator();
while (ite.hasNext()) {
ExtensibilityElement extElement = (ExtensibilityElement) ite.next();
JAXWSBinding binding = (JAXWSBinding) extElement;
assertEquals("Customized package name does not been parsered", "com.foo", binding.getPackage());
assertEquals("Customized enableAsync does not parsered", true, binding.isEnableAsyncMapping());
}
PortType portType = customizedDef.getPortType(new QName("http://apache.org/hello_world_soap_http", "Greeter"));
List<?> portTypeList = portType.getExtensibilityElements();
JAXWSBinding binding = (JAXWSBinding) portTypeList.get(0);
assertEquals("Customized enable EnableWrapperStyle name does not been parsered", true, binding.isEnableWrapperStyle());
List<?> opList = portType.getOperations();
Operation operation = (Operation) opList.get(0);
List<?> extList = operation.getExtensibilityElements();
binding = (JAXWSBinding) extList.get(0);
assertEquals("Customized method name does not parsered", "echoMeOneWay", binding.getMethodName());
assertEquals("Customized parameter element name does not parsered", "number1", binding.getJaxwsParas().get(0).getElementName().getLocalPart());
assertEquals("Customized parameter message name does not parsered", "greetMeOneWayRequest", binding.getJaxwsParas().get(0).getMessageName());
assertEquals("customized parameter name does not parsered", "num1", binding.getJaxwsParas().get(0).getName());
}
Aggregations