1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
/**
* MyServiceTestCase.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.3 Jul 05, 2005 (04:50:41 KST) WSDL2Java emitter.
*/
package test.wsdl.axis2098;
public class MyServiceTestCase extends junit.framework.TestCase {
public MyServiceTestCase(java.lang.String name) {
super(name);
}
public void testHelloWorldWSDL() throws Exception {
javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();
java.net.URL url = new java.net.URL(new test.wsdl.axis2098.MyServiceLocator().getHelloWorldAddress() + "?WSDL");
javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.axis2098.MyServiceLocator().getServiceName());
assertTrue(service != null);
}
public void test1HelloWorldHelloWorld() throws Exception {
test.wsdl.axis2098.MySOAPBindingStub binding;
try {
binding = (test.wsdl.axis2098.MySOAPBindingStub)
new test.wsdl.axis2098.MyServiceLocator().getHelloWorld();
}
catch (javax.xml.rpc.ServiceException jre) {
if(jre.getLinkedCause()!=null)
jre.getLinkedCause().printStackTrace();
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertNotNull("binding is null", binding);
// Time out after a minute
binding.setTimeout(60000);
// Thread.sleep(10*1000);
MyRequestType request = new MyRequestType();
// Test operation
MyResponseType value = null;
XsiTestType test = new XsiTestType();
test.setString("Hello World --------------------------!");
// Will give a validation error: cvc-elt.4.3: Type 'xsd:boolean' is not validly derived from the type definition, 'LogicType', of element 'Logic'.
// It will add a xsi:type boolean but should not: <Logic xsi:type="xsd:boolean">true</Logic>
test.setLogic(true);
RestrictionType r = new RestrictionType();
// r.setFirstName("Hello"); //we do not set this but <firstName xsi:nil="true"/> is still sent over the wire
r.setLastName("World");
test.setRestriction(r);
test.setStringElem("String Ref");
request.setHelloworld(test);
// Invoke webservice
MyResponseType response = binding.helloWorld(request);
System.out.println("Response from the webservice:");
System.out.println("\t"+response.getHelloworld());
// TBD - validate results
}
}
|