private void buildMetaDataInternal(ServiceMetaData serviceMetaData, WSDLDefinitions wsdlDefinitions) throws IOException
{
QName serviceName = serviceMetaData.getServiceName();
// Get the WSDL service
WSDLService wsdlService = null;
if (serviceName == null)
{
if (wsdlDefinitions.getServices().length != 1)
throw new IllegalArgumentException("Expected a single service element");
wsdlService = wsdlDefinitions.getServices()[0];
serviceMetaData.setServiceName(wsdlService.getName());
}
else
{
wsdlService = wsdlDefinitions.getService(serviceName);
}
if (wsdlService == null)
{
List<QName> serviceNames = new ArrayList<QName>();
for (WSDLService wsdls : wsdlDefinitions.getServices())
serviceNames.add(wsdls.getName());
throw new IllegalArgumentException("Cannot obtain wsdl service: " + serviceName + " we have " + serviceNames);
}
// Build endpoint meta data
for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
{
QName portName = wsdlEndpoint.getName();
QName interfaceQName = wsdlEndpoint.getInterface().getName();
ClientEndpointMetaData epMetaData = new ClientEndpointMetaData(serviceMetaData, portName, interfaceQName, Type.JAXWS);
epMetaData.setEndpointAddress(wsdlEndpoint.getAddress());