//If the current element is metadata enclosure, look inside
if (xsr.getLocalName().equals(version.eprType.wsdlMetadata.getLocalPart())) {
String wsdlLoc = xsr.getAttributeValue("http://www.w3.org/ns/wsdl-instance","wsdlLocation");
if (wsdlLoc != null)
wsdliLocation = wsdlLoc.trim();
XMLStreamBuffer mark;
while ((mark = xsr.nextTagAndMark()) != null) {
localName = xsr.getLocalName();
ns = xsr.getNamespaceURI();
if (localName.equals(version.eprType.serviceName)) {
String portStr = xsr.getAttributeValue(null, version.eprType.portName);
if(serviceName != null)
throw new RuntimeException("More than one "+ version.eprType.serviceName +" element in EPR Metadata");
serviceName = getElementTextAsQName(xsr);
if (serviceName != null && portStr != null)
portName = new QName(serviceName.getNamespaceURI(), portStr);
} else if (localName.equals(version.eprType.portTypeName)) {
if(portTypeName != null)
throw new RuntimeException("More than one "+ version.eprType.portTypeName +" element in EPR Metadata");
portTypeName = getElementTextAsQName(xsr);
} else if (ns.equals(WSDLConstants.NS_WSDL)
&& localName.equals(WSDLConstants.QNAME_DEFINITIONS.getLocalPart())) {
wsdlSource = new XMLStreamBufferSource(mark);
} else {
XMLStreamReaderUtil.skipElement(xsr);
}
}
} else {
//Skip is it is not root element
if (!xsr.getLocalName().equals(rootElement))
XMLStreamReaderUtil.skipElement(xsr);
}
} while (XMLStreamReaderUtil.nextElementContent(xsr) == XMLStreamReader.START_ELEMENT);
if(wsdliLocation != null) {
String wsdlLocation = wsdliLocation.trim();
wsdlLocation = wsdlLocation.substring(wsdliLocation.lastIndexOf(" "));
wsdlSource = new StreamSource(wsdlLocation);
}
} else if (version == AddressingVersion.MEMBER) {
do {
localName = xsr.getLocalName();
ns = xsr.getNamespaceURI();
//If the current element is metadata enclosure, look inside
if (localName.equals(version.eprType.wsdlMetadata.getLocalPart()) &&
ns.equals(version.eprType.wsdlMetadata.getNamespaceURI())) {
while (xsr.nextTag() == XMLStreamReader.START_ELEMENT) {
XMLStreamBuffer mark;
while ((mark = xsr.nextTagAndMark()) != null) {
localName = xsr.getLocalName();
ns = xsr.getNamespaceURI();
if (ns.equals(WSDLConstants.NS_WSDL)
&& localName.equals(WSDLConstants.QNAME_DEFINITIONS.getLocalPart())) {