Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kkovarik committed May 7, 2017
1 parent f0f307c commit db368ed
Show file tree
Hide file tree
Showing 5 changed files with 3,235 additions and 0 deletions.
Expand Up @@ -16,13 +16,27 @@

package org.openhubframework.openhub.core.common.ws;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.stereotype.Service;
import org.springframework.ws.wsdl.wsdl11.Wsdl11Definition;
import org.springframework.xml.transform.ResourceSource;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;


/**
Expand All @@ -43,10 +57,27 @@ public class WsdlRegistrySpringImpl implements WsdlRegistry {

@Override
public Collection<String> getWsdls() {
try {
String host = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
e.printStackTrace();
}
if (wsdls != null) {
return wsdls.keySet();
} else {
return Collections.emptyList();
}
}

public String[] listOperations() throws FileNotFoundException, SAXException,
IOException, ParserConfigurationException {
Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder()
.parse(ResourceSource.sourceToInputSource(wsdls.get("hello").getSource()));
NodeList elements = d.getElementsByTagName("operation");
ArrayList<String> operations = new ArrayList<String>();
for (int i = 0; i < elements.getLength(); i++) {
operations.add(elements.item(i).getAttributes().getNamedItem("name").getNodeValue());
}
return operations.toArray(new String[operations.size()]);
}
}

0 comments on commit db368ed

Please sign in to comment.