Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change soap address at end of wsdl

I have a WSDL that is being generated by Apache CXF WS that looks like this

<wsdl:service name="MyWS">
    <wsdl:port binding="tns:MyWSSoapBinding" name="MyWSImplPort">
        <soap:address location="http://someaddress/MyApp/ws/MyWS"/>
    </wsdl:port>
</wsdl:service>

I would like to change the soap:address to have the protocol of https instead of http.

The reason behind this need. We are running a SpringBootApp on a tomcat server behind a LoadBalancer. The load balancer will receive the request on address https://someaddress/MyApp/ws/MyWs?wsdl and then forwards the request to the server through http. When the wsdl is autogenerated by Apache CXF, it is generating it with the soap:address with the protocol of http instead of https.

In the Application.java

@Bean
public ServletRegistrationBean servletRegistrationBean() {
   CXFServlet servlet = new CXFServlet();
   return new ServletRegistrationBean(servlet, "/MyApp/ws/*");
}

@Bean
@Autowired
public Endpoint submitAssessment(ApplicationContext context, MyWS myWS) {
   Bus cxfBus = (Bus)context.getBean(Bus.DEFAULT_BUS_ID);
   EndpointImpl endpoint = new EndpointImpl(cxfBus, myWS);
   endpoint.setAddress("/MyWS");
   cxfBus.getInInterceptors().add(new LoggingInInterceptor());
   endpoint.publish();
   return endpoint;
}

On my Service implementation

@Service
@WebService(serviceName = "MyWS", name = "MyWSPortType", portName = "MyWSPort", )
public class MyWSImpl implements MyWS {
like image 727
DashingSuprHero Avatar asked Mar 04 '16 19:03

DashingSuprHero


People also ask

What is WSDL endpoint URL?

The URL prefix format is protocol://host_name:port_number , for example, http:// myHost :9045 . The actual endpoint URL that is contained in a published WSDL file consists of the prefix followed by the module's context-root and the web service url-pattern, for example, http:// myHost :9045/services/ myService .

What is SOAP address location in the WSDL?

the soap:address location appears with the Hostname of the machine. This part of the xml tells the application where to find the web service. So, because the machine is in a private network, this site is unreachable to everyone behind the cloud.

Is WSDL and SOAP same?

WSDL, or Web Service Description Language, is an XML based definition language. It's used for describing the functionality of a SOAP based web service. WSDL files are central to testing SOAP-based services. SoapUI uses WSDL files to generate test requests, assertions and mock services.


1 Answers

The parameter "publishedEndpointURL" looks like the one you're searching for.

See: http://cxf.apache.org/docs/jax-ws-configuration.html

like image 159
Aydin K. Avatar answered Sep 23 '22 05:09

Aydin K.