Improved the Web service classes, needs to be tested
RESOLVED - #92 http://bugs.koc.se/view.php?id=92
This commit is contained in:
parent
09b671bda7
commit
a2b6be1f35
13 changed files with 401 additions and 817 deletions
|
|
@ -21,16 +21,16 @@
|
|||
******************************************************************************/
|
||||
package zutil.test;
|
||||
|
||||
import javax.wsdl.WSDLException;
|
||||
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.io.OutputFormat;
|
||||
import org.dom4j.io.XMLWriter;
|
||||
|
||||
import zutil.net.http.soap.SOAPHttpPage;
|
||||
import zutil.net.ws.WSInterface;
|
||||
import zutil.net.ws.WSObject;
|
||||
import zutil.net.ws.WSReturnValueList;
|
||||
import zutil.net.ws.WSInterface.*;
|
||||
import zutil.net.ws.WSReturnObject;
|
||||
import zutil.net.ws.WebServiceDef;
|
||||
import zutil.parser.wsdl.WSDLWriter;
|
||||
|
||||
|
||||
public class SOAPTest {
|
||||
|
|
@ -42,64 +42,65 @@ public class SOAPTest {
|
|||
}
|
||||
|
||||
public SOAPTest(){
|
||||
try {
|
||||
SOAPHttpPage soap = new SOAPHttpPage("http://test.se:8080/", new SOAPTestClass());
|
||||
|
||||
// Response
|
||||
try {
|
||||
Document document = soap.genSOAPResponse(
|
||||
"<?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( "****************** RESPONSE *********************" );
|
||||
WebServiceDef wsDef = new WebServiceDef( SOAPTestClass.class );
|
||||
SOAPHttpPage soap = new SOAPHttpPage( wsDef );
|
||||
|
||||
WSDLWriter wsdl = new WSDLWriter( wsDef );
|
||||
wsdl.write(System.out);
|
||||
|
||||
// Response
|
||||
try {
|
||||
Document document = soap.genSOAPResponse(
|
||||
"<?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( "****************** RESPONSE *********************" );
|
||||
|
||||
OutputFormat format = OutputFormat.createPrettyPrint();
|
||||
XMLWriter writer = new XMLWriter( System.out, format );
|
||||
writer.write( document );
|
||||
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) {
|
||||
System.out.println();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public class SOAPTestClass3 implements WSObject{
|
||||
public static class SOAPTestClass3 extends WSReturnObject{
|
||||
public String lol = "lol11";
|
||||
public String lol2 = "lol22";
|
||||
}
|
||||
|
||||
public class SOAPTestClass2 implements WSObject{
|
||||
@WSFieldName(value="lolz", optional=true)
|
||||
public static class SOAPTestClass2 extends WSReturnObject{
|
||||
@WSValueName(value="lolz")
|
||||
public String lol = "lol1";
|
||||
@WSFieldName("lolx")
|
||||
@WSValueName("lolx")
|
||||
public String lol2 = "lol2";
|
||||
public byte[] b = new byte[]{0x12, 0x23};
|
||||
public SOAPTestClass3 l = new SOAPTestClass3();
|
||||
}
|
||||
|
||||
public class SOAPTestRetClass extends WSReturnValueList{
|
||||
public static class SOAPTestRetClass extends WSReturnObject{
|
||||
@WSValueName("retTest")
|
||||
public String lol = "lol1";
|
||||
public String lol2 = "lol2";
|
||||
}
|
||||
|
||||
public class SOAPTestClass implements WSInterface{
|
||||
@WSNamespace("http://test.se:8080/")
|
||||
public static class SOAPTestClass implements WSInterface{
|
||||
public SOAPTestClass(){}
|
||||
|
||||
|
||||
@WSHeader()
|
||||
@WSDocumentation("hello")
|
||||
public void pubZ(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue