1 6 7 package org.enhydra.shark.wfxml.test; 8 9 import java.net.URL ; 10 import java.util.HashMap ; 11 import java.util.Map ; 12 13 import javax.xml.namespace.QName ; 14 15 import org.apache.axis.encoding.DefaultTypeMappingImpl; 16 import org.apache.axis.types.URI; 17 import org.enhydra.shark.asap.types.FactoryPropertiesGroup; 18 import org.enhydra.shark.asap.types.Request; 19 import org.enhydra.shark.asap.types.holders.GetPropertiesRsHolder; 20 import org.enhydra.shark.asap.types.holders.ResponseHolder; 21 import org.enhydra.shark.wfxml.SharkWebServiceLocator; 22 import org.enhydra.shark.wfxml.WfXmlFactoryBindingStub; 23 import org.enhydra.shark.wfxml.util.AltBeanDeserializerFactory; 24 import org.enhydra.shark.wfxml.util.AltBeanSerializerFactory; 25 26 31 public class ForeignWebServiceTestCase extends junit.framework.TestCase { 32 static private URI ik; 33 static private Map factories = new HashMap (); 34 static { 35 factories.put("Fujitsu Retailer","http://interop.i-flow.com/iflowjsp/jsp/ProcDef.jsp?planName=Retailer"); 36 factories.put("Fujitsu Manufacturer","http://interop.i-flow.com/iflowjsp/jsp/ProcDef.jsp?planName=Manufacturer"); 37 factories.put("EasyASAP Retailer","http://68.96.20.206:7777/asap_evm"); 38 factories.put("EasyASAP Manufacturer","http://68.96.20.206:7787/asap_evm"); 39 factories.put("HandySoft Retailer","http://63.137.54.122/bizflow/services/wfxmlservice/ProcDef?pid=103"); 40 factories.put("HandySoft Manufacturer","http://63.137.54.122/bizflow/services/wfxmlservice/ProcDef?pid=102"); 41 factories.put("TIBCO Retailer","http://www.staffware.co.za:8080/ASAPServer/FactoryService.asmx"); 42 factories.put(".NET reference factory, California","http://interop.i-flow.com/ASAPServer/FactoryService.asmx"); 43 factories.put("Enhydra Shark","http://vajat:8080/axis/services/wfxmlFactoryBinding"); 44 } 45 public ForeignWebServiceTestCase(java.lang.String name) { 46 super(name); 47 QName xmlType = new javax.xml.namespace.QName ("http://www.w3.org/2001/XMLSchema", 48 "anyType"); 49 DefaultTypeMappingImpl.getSingleton() 50 .register(String .class, 51 xmlType, 52 new AltBeanSerializerFactory(String .class, xmlType), 53 new AltBeanDeserializerFactory(String .class, xmlType)); 54 } 55 56 100 public void test9asapFactoryBindingGetProperties() throws Exception { 101 WfXmlFactoryBindingStub binding; 102 String uriString = (String ) factories.get("Enhydra Shark"); 103 104 try { 105 binding = (WfXmlFactoryBindingStub) new SharkWebServiceLocator() 106 .getwfxmlFactoryBinding(new URL (uriString)); 108 } catch (javax.xml.rpc.ServiceException jre) { 110 if (jre.getLinkedCause() != null) jre.getLinkedCause() 111 .printStackTrace(); 112 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " 113 + jre); 114 } 115 assertNotNull("binding is null", binding); 116 117 binding.setTimeout(60000); 119 Request rqHead = new Request(); 120 String rqBody = ""; ResponseHolder rsHead = new ResponseHolder(); 122 GetPropertiesRsHolder rsBody = new GetPropertiesRsHolder(); 123 rqHead.setReceiverKey(new URI(uriString)); 124 125 try { 127 binding.getProperties(rqHead, rqBody, rsHead, rsBody); 128 } catch (Throwable t) { 129 System.err.println("Throwable " 130 + t.getClass().getName() + "(" + t.getMessage() 131 + ")"); 132 } 133 Object [] oo = binding.getResponseHeaders(); 134 for (int n = 0; n < oo.length; ++n) { 135 System.err.println("" 136 + n + "#" 137 + binding.getResponseHeaders()[n].toString()); 138 } 139 System.err.println("res" + rsBody.value); 141 FactoryPropertiesGroup fpg = rsBody.value.getFactoryPropertiesGroup(); 142 System.err.println("Key=" + fpg.getKey()); 143 System.err.println("Name=" + fpg.getName()); 144 System.err.println("Subj=" + fpg.getSubject()); 145 System.err.println("desc=" + fpg.getDescription()); 146 try { 147 System.err.println("cds=" 148 + fpg.getContextDataSchema().get_any()[0].toString()); 149 System.err.println("rds=" 150 + fpg.getResultDataSchema().get_any()[0].toString()); 151 } catch (Throwable t) {} 152 } 153 288 } | Popular Tags |