Allot of fixes
This commit is contained in:
parent
694e3081bb
commit
952a388cf1
22 changed files with 1197 additions and 408 deletions
|
|
@ -1,104 +0,0 @@
|
|||
package zutil.test;
|
||||
|
||||
import javax.wsdl.WSDLException;
|
||||
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.io.OutputFormat;
|
||||
import org.dom4j.io.XMLWriter;
|
||||
|
||||
import zutil.network.http.soap.SOAPHttpPage;
|
||||
import zutil.network.http.soap.SOAPInterface;
|
||||
import zutil.network.http.soap.SOAPObject;
|
||||
|
||||
public class SOAPTest {
|
||||
//*******************************************************************************************
|
||||
//**************************** TEST *********************************************************
|
||||
|
||||
public static void main(String[] args){
|
||||
try {
|
||||
SOAPHttpPage soap = new SOAPHttpPage("http://test.se:8080/", new SOAPTestClass());
|
||||
|
||||
// Response
|
||||
try {
|
||||
Document document = soap.soapResponse(
|
||||
"<?xml version=\"1.0\"?>" +
|
||||
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
|
||||
" <soap:Body xmlns:m=\"http://www.example.org/stock\">\n" +
|
||||
//" <m:pubA>\n" +
|
||||
//" <m:Ztring>IBM</m:Ztring>\n" +
|
||||
//" </m:pubA>\n" +
|
||||
//" <m:pubZ>\n" +
|
||||
//" <m:olle>66</m:olle>\n" +
|
||||
//" </m:pubZ>\n" +
|
||||
" <m:pubB>\n" +
|
||||
" <m:byte>IBM</m:byte>\n" +
|
||||
" </m:pubB>\n" +
|
||||
" </soap:Body>\n" +
|
||||
"</soap:Envelope>");
|
||||
System.out.println();
|
||||
|
||||
OutputFormat format = OutputFormat.createPrettyPrint();
|
||||
XMLWriter writer = new XMLWriter( System.out, format );
|
||||
writer.write( document );
|
||||
|
||||
System.out.println();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (WSDLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SOAPTestClass3 implements SOAPObject{
|
||||
public String lol = "lol11";
|
||||
public String lol2 = "lol22";
|
||||
}
|
||||
|
||||
class SOAPTestClass2 implements SOAPObject{
|
||||
@SOAPFieldName(value="lolz", optional=true)
|
||||
public String lol = "lol1";
|
||||
@SOAPFieldName("lolx")
|
||||
public String lol2 = "lol2";
|
||||
public byte[] b = new byte[]{0x12, 0x23};
|
||||
public SOAPTestClass3 l = new SOAPTestClass3();
|
||||
}
|
||||
|
||||
class SOAPTestClass implements SOAPInterface{
|
||||
public SOAPTestClass(){}
|
||||
|
||||
@SOAPHeader()
|
||||
@WSDLDocumentation("hello")
|
||||
public void pubZ(
|
||||
@SOAPParamName(value="olle", optional=true) int lol) throws Exception{
|
||||
//System.out.println("Param: "+lol);
|
||||
throw new Exception("Ziver is the fizle");
|
||||
}
|
||||
|
||||
@SOAPReturnName("param")
|
||||
@WSDLParamDocumentation("null is the shizzle")
|
||||
public String[][] pubA (
|
||||
@SOAPParamName("Ztring") String lol) throws Exception{
|
||||
//System.out.println("ParamZ: "+lol);
|
||||
return new String[][]{{"test","test2"},{"test3","test4"}};
|
||||
}
|
||||
|
||||
@SOAPReturnName("zivarray")
|
||||
@WSDLParamDocumentation("null is the shizzle")
|
||||
public SOAPTestClass2[] pubX (
|
||||
@SOAPParamName("Ztring") String lol) throws Exception{
|
||||
return new SOAPTestClass2[]{new SOAPTestClass2(), new SOAPTestClass2()};
|
||||
}
|
||||
|
||||
@SOAPReturnName("zivarray")
|
||||
@WSDLParamDocumentation("null is the shizzle")
|
||||
public byte[] pubB (
|
||||
@SOAPParamName("byte") String lol) throws Exception{
|
||||
return new byte[]{0x12, 0x23};
|
||||
}
|
||||
|
||||
@SOAPDisabled()
|
||||
public void privaZ(){ }
|
||||
protected void protZ(){ }
|
||||
}
|
||||
42
src/zutil/test/UPnPServerTest.java
Normal file
42
src/zutil/test/UPnPServerTest.java
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package zutil.test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.wsdl.WSDLException;
|
||||
|
||||
import zutil.MultiPrintStream;
|
||||
import zutil.log.Logger;
|
||||
import zutil.network.http.HttpServer;
|
||||
import zutil.network.http.soap.SOAPHttpPage;
|
||||
import zutil.network.ssdp.SSDPServer;
|
||||
import zutil.network.upnp.UPnPMediaServer;
|
||||
import zutil.network.upnp.services.UPnPContentDirectory;
|
||||
|
||||
public class UPnPServerTest {
|
||||
|
||||
public static void main(String[] args) throws IOException, WSDLException{
|
||||
//Logger.setGlobalLogLevel(Level.FINEST);
|
||||
|
||||
UPnPMediaServer upnp = new UPnPMediaServer("http://192.168.0.60:8080/");
|
||||
MultiPrintStream.out.println("UPNP Server running");
|
||||
|
||||
UPnPContentDirectory cds = new UPnPContentDirectory(new File("C:\\Users\\Ziver\\Desktop\\lan"));
|
||||
|
||||
HttpServer http = new HttpServer("http://192.168.0.60/", 8080);
|
||||
//http.setDefaultPage(upnp);
|
||||
http.setPage("/RootDesc", upnp );
|
||||
http.setPage("/SCP/ContentDir", cds );
|
||||
SOAPHttpPage soap = new SOAPHttpPage("Action/ContentDir", cds);
|
||||
soap.enableSession(false);
|
||||
http.setPage("/Action/ContentDir", soap );
|
||||
http.start();
|
||||
MultiPrintStream.out.println("HTTP Server running");
|
||||
|
||||
SSDPServer ssdp = new SSDPServer();
|
||||
ssdp.addService( upnp );
|
||||
ssdp.start();
|
||||
MultiPrintStream.out.println("SSDP Server running");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue