Commit 4cba7706 by Patryk Czarnik

Klient Dispatcher z XSLT po stronie klienta c.d.

parent 0e8b412d
......@@ -34,3 +34,4 @@ build/
### Mac OS ###
.DS_Store
/wynik.html
/wyniki.html
......@@ -42,6 +42,3 @@ public class Klient3_Edycja {
}
}
// alt+Enter intellij =~= Ctrl+1 w eclipse
package ogloszenia.klient_niskopoziomowy;
import jakarta.xml.ws.Dispatch;
import jakarta.xml.ws.Service;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import java.io.StringReader;
import java.net.MalformedURLException;
import java.net.URL;
public class Klient6_DispatcherXSLT_Samowystarczalny {
static final String trescXML = "<o:readAll xmlns:o='http://soap.ogloszenia/'/>";
/* W tym przykładzie nie używamy wygenerowanych klas, to można zrobić "zawsze", nawet bez procedury wsimport */
public static void main(String[] args) {
System.out.println("Startujemy...");
try {
URL wsdlUrl = new URL("http://localhost:8080/OgloszeniaSerwer/Ogloszenia?wsdl");
QName serviceName = new QName("http://soap.ogloszenia/", "OgloszeniaService");
QName portName = new QName("http://soap.ogloszenia/", "OgloszeniaPort");
Service service = Service.create(wsdlUrl, serviceName);
Dispatch<Source> dispatch = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
System.out.println("Mam Dispatchera " + dispatch);
Source src = new StreamSource(new StringReader(trescXML));
System.out.println("Wysyłam zapytanie");
Source result = dispatch.invoke(src);
System.out.println("Mam wynik: " + result);
Utils utils = new Utils();
utils.xslt(result, "arkusz.xsl", "wyniki.html");
System.out.println("Gotowe");
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment