Reputation: 211
Here is a nice example on how to produce a SOAP web service in Spring: https://spring.io/guides/gs/producing-web-service/
This example shows, how to obtian one endpoint and one service. How to obtain the same result with multiple services and endpoints?
Upvotes: 3
Views: 11272
Reputation: 3002
Basing on example from your link, all what you need to do is to add following methods to WebServiceConfig
like:
@Bean(name = "webservice2")
public DefaultWsdl11Definition webservice2Wsdl11Definition(XsdSchema webservice2Schema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("webservice2Port");
wsdl11Definition.setLocationUri("/ws");
wsdl11Definition.setTargetNamespace("your namespace");
wsdl11Definition.setSchema(webservice2Schema);
return wsdl11Definition;
}
@Bean(name="webservice2Schema")
public XsdSchema webservice2Schema() {
return new SimpleXsdSchema(new ClassPathResource("webservice2.xsd"));
}
And of course create
@Endpoint
public class Webservice2Endpoint
You can use as many webservices as you want in one module.
Upvotes: 1
Reputation: 211
Okay, it seems, that both answers were correct. I used Mike Adamenkos answer with a little extra tags to get it working.
@Bean(name = "webservice2")
public DefaultWsdl11Definition defaultWsdl11Definition(@Qualifier("Name") XsdSchema webservice2Schema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("webservice2Port");
wsdl11Definition.setLocationUri("/ws");
wsdl11Definition.setTargetNamespace("your namespace");
wsdl11Definition.setSchema(webservice2Schema);
return wsdl11Definition;
}
@Bean(name = "Name2")
public XsdSchema webservice2Schema() {
return new SimpleXsdSchema(new ClassPathResource("webservice2.xsd"));
}
So you need to add a name value for the XsdSchema
methods so you can get the correct method in your DefaultWsdl11Definition
with the @Qualifier
tag. Hope this helps!
Upvotes: 1