You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Trilok (JIRA)" <ji...@apache.org> on 2014/10/08 23:35:33 UTC
[jira] [Created] (CXF-6039) XML to Java Config of CXF Jaxws
Endpoint
Trilok created CXF-6039:
---------------------------
Summary: XML to Java Config of CXF Jaxws Endpoint
Key: CXF-6039
URL: https://issues.apache.org/jira/browse/CXF-6039
Project: CXF
Issue Type: Bug
Environment: Spring 3.2.8
CXF 2.7.11
Reporter: Trilok
I am Trying to convert XML configuration to java configuration for jaxws endpoint. XML configuration works fine.
I tried both ways to convert XML to java config. Either one is working. I am doing bit wise copy of XML to java.
XML Configuation:
<jaxws:endpoint id="userService"
implementor="com.example.components.userdata.ws.ImportUserEndpoint"
address="/userService" xmlns:user="urn:example:wsdl:user:soap:v1" endpointName="user:userSoapServicePort" serviceName="user:userSoapServicePorts" wsdlLocation="classpath:/service/user-soap-v1.wsdl">
<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
<jaxws:binding>
<soap:soapBinding mtomEnabled="true" version="1.2" />
</jaxws:binding>
</jaxws:endpoint>
First way using jaxwsEndpointImpl:
@Bean
public ApplicationTransport applicationTransport() {
return new ApplicationTransport();
}
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
public ImportUserEndpoint importUserEndpoint() {
return new ImportUserEndpoint(applicationTransport());
}
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
public Endpoint userService() {
String namespaceURI = "urn:example:wsdl:user:soap:v1";
QName endpointName = new QName(namespaceURI, "userSoapServicePort");
QName serviceName = new QName(namespaceURI, "userSoapServicePorts");
EndpointImpl Endpoint = new EndpointImpl(cxfBus, importUserEndpoint());
Endpoint.setServiceName(serviceName);
Endpoint.setEndpointName(endpointName);
Endpoint.setWsdlLocation("classpath:/service/user-soap-v1.wsdl");
Endpoint.setImplementorClass(ImportUserEndpoint.class);
Endpoint.setBindingUri(SOAPBinding.SOAP12HTTP_MTOM_BINDING);
Endpoint.setAddress("/userService1");
Endpoint.publish();
return Endpoint;
}
Second way using JaxWSserverfactory:
@Bean
public ApplicationTransport applicationTransport() {
return new ApplicationTransport();
}
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
public ImportUserEndpoint importUserEndpoint() {
return new ImportUserEndpoint(applicationTransport());
}
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
public ImportUserEndpoint userService() {
ImportUserEndpoint importUserEndpoint = importUserEndpoint();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(UserService.class);//This is the service contract
svrFactory.setServiceBean(importUserEndpoint);
svrFactory.setAddress("/userService");
svrFactory.create();
return importUserEndpoint;
}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)