antelder 2002/11/22 01:52:19 Modified: java/test/docStyle NWBankTest.java ZipCodeAxisTest.java java/test/docStyle/wsifservice nwBank.wsdl zipCodeResolver.wsdl java/src/org/apache/wsif/providers/soap/apacheaxis WSIFOperation_ApacheAxis.java java/src/org/apache/wsif/util/jms JMS2HTTPBridge.java Log: Change AXIS document style to work with AXIS over JMS Revision Changes Path 1.3 +19 -3 xml-axis-wsif/java/test/docStyle/NWBankTest.java Index: NWBankTest.java =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/test/docStyle/NWBankTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- NWBankTest.java 15 Nov 2002 17:27:53 -0000 1.2 +++ NWBankTest.java 22 Nov 2002 09:52:18 -0000 1.3 @@ -98,9 +98,14 @@ super(name); } - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } + public static void main(String[] args) { + TestUtilities.startListeners( + TestUtilities.ADDRESSBOOK_LISTENER + | TestUtilities.ASYNC_LISTENER + | TestUtilities.NATIVEJMS_LISTENER); + junit.textui.TestRunner.run(suite()); + TestUtilities.stopListeners(); + } public static Test suite() { return new TestSuite(NWBankTest.class); @@ -112,7 +117,18 @@ public void testDynamicAxis() { doitDyn("pwspNoCentrbankCurRatesSoap", "axis"); + } + + public void testStubsAxis() { doitStub("pwspNoCentrbankCurRatesSoap", "axis"); + } + + public void testDynJMS() { + doitDyn("pwspNoCentrbankCurRatesSoapJMS", "axis"); + } + + public void testStubsAxisJMS() { + doitStub("pwspNoCentrbankCurRatesSoapJMS", "axis"); } private void doitDyn(String portName, String protocol) { 1.3 +12 -8 xml-axis-wsif/java/test/docStyle/ZipCodeAxisTest.java Index: ZipCodeAxisTest.java =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/test/docStyle/ZipCodeAxisTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ZipCodeAxisTest.java 21 Nov 2002 11:33:20 -0000 1.2 +++ ZipCodeAxisTest.java 22 Nov 2002 09:52:18 -0000 1.3 @@ -87,19 +87,23 @@ public class ZipCodeAxisTest extends TestCase { String wsdlLocation = TestUtilities.getWsdlPath("java\\test\\docStyle\\wsifservice") + + "zipCodeResolver.wsdl"; // + "zipCode.wsdl"; // + "zipCodeLocal.wsdl"; - + "zipCodeResolver.wsdl"; -// + "zipCodeJMS.wsdl"; // "http://webservices.eraserver.net/zipcoderesolver/zipcoderesolver.asmx?WSDL"; public ZipCodeAxisTest(String name) { super(name); } - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } + public static void main(String[] args) { + TestUtilities.startListeners( + TestUtilities.ADDRESSBOOK_LISTENER + | TestUtilities.ASYNC_LISTENER + | TestUtilities.NATIVEJMS_LISTENER); + junit.textui.TestRunner.run(suite()); + TestUtilities.stopListeners(); + } public static Test suite() { return new TestSuite(ZipCodeAxisTest.class); @@ -121,9 +125,9 @@ doitMessaging("ZipCodeResolverSoap", "axis"); } -// public void testDynamicAxisJMS() { -// doitStub("ZipCodeResolverSoapJMS", "axis"); -// } + public void testDyn() { + doitStub("ZipCodeResolverSoapJMS", "axis"); + } private void doitDyn(String portName, String protocol) { if (portName.toUpperCase().indexOf("JMS") != -1 1.2 +25 -1 xml-axis-wsif/java/test/docStyle/wsifservice/nwBank.wsdl Index: nwBank.wsdl =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/test/docStyle/wsifservice/nwBank.wsdl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- nwBank.wsdl 15 Nov 2002 16:46:45 -0000 1.1 +++ nwBank.wsdl 22 Nov 2002 09:52:18 -0000 1.2 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http/www.pointwsp.net/ws/finance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http/www.pointwsp.net/ws/finance" xmlns="http://schemas.xmlsoap.org/wsdl/"> +<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http/www.pointwsp.net/ws/finance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http/www.pointwsp.net/ws/finance" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:jms="http://schemas.xmlsoap.org/wsdl/jms/"> <types> <s:schema elementFormDefault="qualified" targetNamespace="http/www.pointwsp.net/ws/finance"> <s:element name="GetRatesXML"> @@ -118,6 +118,20 @@ </operation> </binding> + <binding name="pwspNoCentrbankCurRatesSoapJMS" type="s0:pwspNoCentrbankCurRatesSoap"> + <soap:binding transport="http://schemas.xmlsoap.org/soap/jms" style="document" /> + <operation name="GetRatesXML"> + <soap:operation soapAction="http/www.pointwsp.net/ws/finance/GetRatesXML" style="document" /> + <input> + <soap:body use="literal" /> + <jms:propertyValue name="SOAPAction" type="s:string" + value="http/www.pointwsp.net/ws/finance/GetRatesXML"/> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + </binding> <service name="pwspNoCentrbankCurRates"> <documentation>Shows norwegian central bank daily rates</documentation> <port name="pwspNoCentrbankCurRatesSoap" binding="s0:pwspNoCentrbankCurRatesSoap"> @@ -129,6 +143,16 @@ </port> <port name="pwspNoCentrbankCurRatesHttpPost" binding="s0:pwspNoCentrbankCurRatesHttpPost"> <http:address location="http://server1.pointwsp.net/ws/finance/currency.asmx" /> + </port> + <port name="pwspNoCentrbankCurRatesSoapJMS" binding="s0:pwspNoCentrbankCurRatesSoapJMS"> + <jms:address jndiDestinationName="SoapJmsAddressBookQueue" + destinationStyle="queue" + jndiConnectionFactoryName="WSIFSampleQCF" + initialContextFactory="com.sun.jndi.fscontext.RefFSContextFactory" + jndiProviderURL="file:///JNDI-Directory"> + <jms:propertyValue name="ServiceURL" type="s:string" + value="http://server1.pointwsp.net/ws/finance/currency.asmx"/> + </jms:address> </port> </service> </definitions> 1.2 +63 -1 xml-axis-wsif/java/test/docStyle/wsifservice/zipCodeResolver.wsdl Index: zipCodeResolver.wsdl =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/test/docStyle/wsifservice/zipCodeResolver.wsdl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- zipCodeResolver.wsdl 21 Nov 2002 11:33:20 -0000 1.1 +++ zipCodeResolver.wsdl 22 Nov 2002 09:52:18 -0000 1.2 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://webservices.eraserver.net/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://webservices.eraserver.net/" xmlns="http://schemas.xmlsoap.org/wsdl/"> +<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://webservices.eraserver.net/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://webservices.eraserver.net/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:jms="http://schemas.xmlsoap.org/wsdl/jms/"> <types> <s:schema elementFormDefault="qualified" targetNamespace="http://webservices.eraserver.net/"> <s:element name="FullZipCode"> @@ -332,6 +332,56 @@ </output> </operation> </binding> + <binding name="ZipCodeResolverSoapJMS" type="s0:ZipCodeResolverSoap"> + <soap:binding transport="http://schemas.xmlsoap.org/soap/jms" style="document" /> + <operation name="FullZipCode"> + <soap:operation soapAction="http://webservices.eraserver.net/FullZipCode" style="document" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + <operation name="ShortZipCode"> + <soap:operation soapAction="http://webservices.eraserver.net/ShortZipCode" style="document" /> + <input> + <soap:body use="literal" /> + <jms:propertyValue name="SOAPAction" type="s:string" + value="http://webservices.eraserver.net/ShortZipCode"/> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + <operation name="CorrectedAddressHtml"> + <soap:operation soapAction="http://webservices.eraserver.net/CorrectedAddressHtml" style="document" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + <operation name="CorrectedAddressXml"> + <soap:operation soapAction="http://webservices.eraserver.net/CorrectedAddressXml" style="document" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + <operation name="VersionInfo"> + <soap:operation soapAction="http://webservices.eraserver.net/VersionInfo" style="document" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + </binding> <binding name="ZipCodeResolverHttpGet" type="s0:ZipCodeResolverHttpGet"> <http:binding verb="GET" /> <operation name="FullZipCode"> @@ -439,6 +489,18 @@ </port> <port name="ZipCodeResolverHttpPost" binding="s0:ZipCodeResolverHttpPost"> <http:address location="http://webservices.eraserver.net/zipcoderesolver/zipcoderesolver.asmx" /> + </port> + <port name="ZipCodeResolverSoapJMS" binding="s0:ZipCodeResolverSoapJMS"> + <jms:address jndiDestinationName="SoapJmsAddressBookQueue" + destinationStyle="queue" + jndiConnectionFactoryName="WSIFSampleQCF" + initialContextFactory="com.sun.jndi.fscontext.RefFSContextFactory" + jndiProviderURL="file:///JNDI-Directory"> + <jms:propertyValue name="ServiceURL" type="s:string" + value="http://webservices.eraserver.net/zipcoderesolver/zipcoderesolver.asmx"/> +<!-- <jms:propertyValue name="ServiceURL" type="s:string" + value="http://localhost:8080/soap/servlet/rpcrouter"/> --> + </jms:address> </port> </service> </definitions> 1.36 +10 -0 xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java Index: WSIFOperation_ApacheAxis.java =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- WSIFOperation_ApacheAxis.java 21 Nov 2002 11:33:20 -0000 1.35 +++ WSIFOperation_ApacheAxis.java 22 Nov 2002 09:52:18 -0000 1.36 @@ -957,6 +957,16 @@ } } + if (dest != null && inJmsPropVals != null && !inJmsPropVals.isEmpty()) { + checkForTimeoutProperties(inJmsPropVals, dest); + dest.setProperties(inJmsPropVals); + } + + //TODO: jms:property parts + + setDestinationContext(dest); + setCallContext(call); + if ("message".equals(style)) { workedOK = doAXISMessaging(call, inMsg, outMsg, faultMsg); } else { 1.7 +34 -1 xml-axis-wsif/java/src/org/apache/wsif/util/jms/JMS2HTTPBridge.java Index: JMS2HTTPBridge.java =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/util/jms/JMS2HTTPBridge.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- JMS2HTTPBridge.java 27 Aug 2002 10:24:07 -0000 1.6 +++ JMS2HTTPBridge.java 22 Nov 2002 09:52:19 -0000 1.7 @@ -88,6 +88,11 @@ public class JMS2HTTPBridge { private URL httpURL = null; private JMS2HTTPBridgeDestination destination = null; + + private static final ArrayList outGoingHeaders = + new ArrayList(Arrays.asList(new String[] + { "SOAPAction" })); + private static final ArrayList interestingProperties = new ArrayList(Arrays.asList(new String[] { "JMSPriority", "JMSDeliveryMode" })); private boolean verbose; @@ -273,9 +278,10 @@ TransportMessage tmsg = new TransportMessage(body, new SOAPContext(), new Hashtable()); + setOutGoingHeaders(msg, tmsg); tmsg.save(); - TransportMessage response = HTTPUtils.post(httpURL, tmsg, 30000, null, 0); + TransportMessage response = HTTPUtils.post(getServiceURL(msg), tmsg, 30000, null, 0); payload = IOUtils.getStringFromReader(response.getEnvelopeReader()); if (verbose) System.out.println("HTTP RESPONSE IS: '" + payload + "'"); @@ -327,4 +333,31 @@ Trc.exit(); return; } + + private void setOutGoingHeaders(Message m, TransportMessage tmsg) { + for (Iterator i = outGoingHeaders.iterator(); i.hasNext(); ) { + try { + String name = (String) i.next(); + String value = m.getStringProperty(name); + if (value != null && value.length() > 0 ) { + tmsg.setHeader(name, "\""+value+"\""); + } + } catch (JMSException e) { + Trc.ignoredException(e); + } + } + } + + private URL getServiceURL(Message m) { + URL serviceURL = null; + try { + String s = m.getStringProperty( "ServiceURL" ); + serviceURL = new URL(s); + } catch (Exception e) { + Trc.ignoredException(e); + serviceURL = httpURL; + } + return serviceURL; + } + }