[jboss-svn-commits] JBL Code SVN: r37842 - in labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src: test/java/org/jboss/soa/esb/services/soapui and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jan 11 05:40:39 EST 2012


Author: mageshbk at jboss.com
Date: 2012-01-11 05:40:38 -0500 (Wed, 11 Jan 2012)
New Revision: 37842

Added:
   labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/JBESB_3719_SoapUIClientServiceMBeanUnitTest.java
   labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/helloworld_http_bindings.wsdl
   labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/helloworld_http_bindings1.wsdl
Modified:
   labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java
Log:
[JBESB-3719] - Fixed NPE when parsing WSDls with http:bindings

Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java	2012-01-05 20:43:00 UTC (rev 37841)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java	2012-01-11 10:40:38 UTC (rev 37842)
@@ -1119,19 +1119,23 @@
                             {
                                 first = false ;
                                 final WsdlInterface bindingWsdlInterface = bindingsToInterface.get(bindingName) ;
-                                endpoint = bindingWsdlInterface.getEndpoints()[0] ;
-                                contentType = bindingWsdlInterface.getSoapVersion().getContentType() ;
+                                if (bindingWsdlInterface != null) {
+                                    endpoint = bindingWsdlInterface.getEndpoints()[0] ;
+                                    contentType = bindingWsdlInterface.getSoapVersion().getContentType() ;
+                                }
                             }
                             
                             final Map<String, WsdlOperationInfo> bindingOperationInfoMap = bindingToOperationInfo.get(bindingName) ;
-                            for(Map.Entry<String, WsdlOperationInfo> entry: bindingOperationInfoMap.entrySet())
-                            {
-                                final String operationName = entry.getKey() ;
-                                final WsdlOperationInfo operationInfo = entry.getValue() ;
-                                final WsdlOperationInfo current = operationInfoMap.put(operationName, operationInfo) ;
-                                if (current != null)
+                            if (bindingOperationInfoMap != null) {
+                                for(Map.Entry<String, WsdlOperationInfo> entry: bindingOperationInfoMap.entrySet())
                                 {
-                                    operationInfoMap.put(operationName, current) ;
+                                    final String operationName = entry.getKey() ;
+                                    final WsdlOperationInfo operationInfo = entry.getValue() ;
+                                    final WsdlOperationInfo current = operationInfoMap.put(operationName, operationInfo) ;
+                                    if (current != null)
+                                    {
+                                        operationInfoMap.put(operationName, current) ;
+                                    }
                                 }
                             }
                         }

Added: labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/JBESB_3719_SoapUIClientServiceMBeanUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/JBESB_3719_SoapUIClientServiceMBeanUnitTest.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/JBESB_3719_SoapUIClientServiceMBeanUnitTest.java	2012-01-11 10:40:38 UTC (rev 37842)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.soa.esb.services.soapui;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.http.HttpClientFactory;
+import org.xml.sax.SAXException;
+
+/**
+ *
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar B</a>
+ */
+public class JBESB_3719_SoapUIClientServiceMBeanUnitTest extends TestCase {
+
+    private static final String WSDL_LOCATAION = "src/test/java/org/jboss/soa/esb/services/soapui";
+    private Properties properties;
+
+    protected void setUp() throws Exception {
+        properties = new Properties();
+    }
+
+    public void test_ignore_http_bindings() throws IOException, SAXException, ParserConfigurationException, ConfigurationException {
+        File wsdlFile = new File(WSDL_LOCATAION + "/helloworld_http_bindings.wsdl");
+        SoapUIClientService mbean = new SoapUIClientService();
+ 
+        properties.setProperty(HttpClientFactory.TARGET_HOST_URL, wsdlFile.toURI().toString());
+        Map<Object, Object> paras = new HashMap<Object, Object>();
+        paras.put("sayHiReponse.arg0", "response");
+        String str = mbean.buildResponse(wsdlFile.toURL().toString(), "HelloWorldPubServiceOp", null, paras, properties, null, null);
+    }
+    
+    public void test_ignore_http_bindings1() throws IOException, SAXException, ParserConfigurationException, ConfigurationException {
+        File wsdlFile = new File(WSDL_LOCATAION + "/helloworld_http_bindings1.wsdl");
+        SoapUIClientService mbean = new SoapUIClientService();
+ 
+        properties.setProperty(HttpClientFactory.TARGET_HOST_URL, wsdlFile.toURI().toString());
+        Map<Object, Object> paras = new HashMap<Object, Object>();
+        paras.put("sayHiReponse.arg0", "response");
+        String str = mbean.buildResponse(wsdlFile.toURL().toString(), "HelloWorldPubServiceOp", null, paras, properties, null, null);
+    }
+}

Added: labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/helloworld_http_bindings.wsdl
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/helloworld_http_bindings.wsdl	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/helloworld_http_bindings.wsdl	2012-01-11 10:40:38 UTC (rev 37842)
@@ -0,0 +1,93 @@
+<wsdl:definitions targetNamespace='http://soa.jboss.org/ESBServiceSample' xmlns:ns1='http://www.jboss.org/sayHi' xmlns:ns2='http://www.jboss.org/sayHi' xmlns:ns3='http://www.jboss.org/sayHi' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://soa.jboss.org/ESBServiceSample' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' xmlns:http='http://schemas.xmlsoap.org/wsdl/http/' xmlns:mime='http://schemas.xmlsoap.org/wsdl/mime/'>
+ <wsdl:types>
+  <xs:schema elementFormDefault='qualified' targetNamespace='http://www.jboss.org/sayHi' version='1.0' xmlns:x1='http://www.jboss.org/sayHi' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+   <xs:element name='sayHi' type='x1:sayHi'/>
+   <xs:complexType name='sayHi'>
+    <xs:sequence>
+     <xs:element minOccurs='0' name='arg0' type='xs:string'/>
+    </xs:sequence>
+   </xs:complexType>
+
+  </xs:schema>
+  <xs:schema elementFormDefault='qualified' targetNamespace='http://www.jboss.org/sayHi' version='1.0' xmlns:x1='http://www.jboss.org/sayHi' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+   <xs:element name='sayHiReponse' type='x1:sayHiReponse'/>
+   <xs:complexType name='sayHiReponse'>
+    <xs:sequence>
+     <xs:element minOccurs='0' name='arg0' type='xs:string'/>
+    </xs:sequence>
+   </xs:complexType>
+  </xs:schema>
+
+  <xs:schema elementFormDefault='qualified' targetNamespace='http://www.jboss.org/sayHi' version='1.0' xmlns:x1='http://www.jboss.org/sayHi' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+   <xs:element name='sayFault' type='x1:fault'/>
+   <xs:complexType name='fault'>
+    <xs:sequence>
+     <xs:element name='code' type='xs:string'/>
+     <xs:element name='faultString' type='xs:string'/>
+    </xs:sequence>
+   </xs:complexType>
+  </xs:schema>
+
+ </wsdl:types>
+ <wsdl:message name='HelloWorldPubServiceReq'>
+  <wsdl:part element='ns1:sayHi' name='in'></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name='HelloWorldPubServiceRes'>
+  <wsdl:part element='ns1:sayHiReponse' name='out'></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name='HelloWorldPubServiceFault1'>
+  <wsdl:part element='ns1:sayFault' name='fault1'></wsdl:part>
+
+ </wsdl:message>
+ <wsdl:portType name='HelloWorldPubServicePortType'>
+  <wsdl:operation name='HelloWorldPubServiceOp'>
+   <wsdl:input message='tns:HelloWorldPubServiceReq' name='HelloWorldPubServiceReq'></wsdl:input>
+   <wsdl:output message='tns:HelloWorldPubServiceRes' name='HelloWorldPubServiceRes'></wsdl:output>
+   <wsdl:fault message='tns:HelloWorldPubServiceFault1' name='HelloWorldPubServiceFault1'></wsdl:fault>
+  </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name='HelloWorldPubServiceGetPortType'>
+  <wsdl:operation name='HelloWorldPubServiceOp'>
+   <wsdl:input message='tns:HelloWorldPubServiceReq' name='HelloWorldPubServiceReq'></wsdl:input>
+   <wsdl:output message='tns:HelloWorldPubServiceRes' name='HelloWorldPubServiceRes'></wsdl:output>
+  </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name='HelloWorldPubServiceBinding' type='tns:HelloWorldPubServicePortType'>
+
+  <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
+  <wsdl:operation name='HelloWorldPubServiceOp'>
+   <wsdl:input>
+    <soap:body use='literal'/>
+   </wsdl:input>
+   <wsdl:output>
+    <soap:body use='literal'/>
+   </wsdl:output>
+   <wsdl:fault name='HelloWorldPubServiceFault1'>
+
+    <soap:fault name='HelloWorldPubServiceFault1' use='literal'/>
+   </wsdl:fault>
+  </wsdl:operation>
+ </wsdl:binding>
+ 
+ <wsdl:binding name='HelloWorldPubServiceHttpGetBinding' type='tns:HelloWorldPubServiceGetPortType'>
+  <http:binding verb='GET'/>
+  <wsdl:operation name='HelloWorldPubServiceOp'>
+   <http:operation location='/HelloWorldPubServiceOp'/>
+    <wsdl:input>
+     <http:urlEncoded/>
+    </wsdl:input>
+    <wsdl:output>
+     <mime:mimeXml part='Body'/>
+    </wsdl:output>
+  </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name='HelloWorldPubServiceService'>
+  <wsdl:port binding='tns:HelloWorldPubServiceBinding' name='HelloWorldPubServicePortType'>
+   <soap:address location='http://127.0.0.1:8080/Quickstart_helloworld_pub_service/ESBServiceSample/HelloWorldPubService'/>
+  </wsdl:port>
+  <wsdl:port binding='tns:HelloWorldPubServiceHttpGetBinding' name='HelloWorldPubServiceGetPortType'>
+   <http:address location='http://127.0.0.1:8080/Quickstart_helloworld_pub_service'/>
+  </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>

Added: labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/helloworld_http_bindings1.wsdl
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/helloworld_http_bindings1.wsdl	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/helloworld_http_bindings1.wsdl	2012-01-11 10:40:38 UTC (rev 37842)
@@ -0,0 +1,90 @@
+<wsdl:definitions targetNamespace='http://soa.jboss.org/ESBServiceSample' xmlns:ns1='http://www.jboss.org/sayHi' xmlns:ns2='http://www.jboss.org/sayHi' xmlns:ns3='http://www.jboss.org/sayHi' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://soa.jboss.org/ESBServiceSample' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' xmlns:http='http://schemas.xmlsoap.org/wsdl/http/' xmlns:mime='http://schemas.xmlsoap.org/wsdl/mime/'>
+ <wsdl:types>
+  <xs:schema elementFormDefault='qualified' targetNamespace='http://www.jboss.org/sayHi' version='1.0' xmlns:x1='http://www.jboss.org/sayHi' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+   <xs:element name='sayHi' type='x1:sayHi'/>
+   <xs:complexType name='sayHi'>
+    <xs:sequence>
+     <xs:element minOccurs='0' name='arg0' type='xs:string'/>
+    </xs:sequence>
+   </xs:complexType>
+
+  </xs:schema>
+  <xs:schema elementFormDefault='qualified' targetNamespace='http://www.jboss.org/sayHi' version='1.0' xmlns:x1='http://www.jboss.org/sayHi' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+   <xs:element name='sayHiReponse' type='x1:sayHiReponse'/>
+   <xs:complexType name='sayHiReponse'>
+    <xs:sequence>
+     <xs:element minOccurs='0' name='arg0' type='xs:string'/>
+    </xs:sequence>
+   </xs:complexType>
+  </xs:schema>
+
+  <xs:schema elementFormDefault='qualified' targetNamespace='http://www.jboss.org/sayHi' version='1.0' xmlns:x1='http://www.jboss.org/sayHi' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+   <xs:element name='sayFault' type='x1:fault'/>
+   <xs:complexType name='fault'>
+    <xs:sequence>
+     <xs:element name='code' type='xs:string'/>
+     <xs:element name='faultString' type='xs:string'/>
+    </xs:sequence>
+   </xs:complexType>
+  </xs:schema>
+
+ </wsdl:types>
+ <wsdl:message name='HelloWorldPubServiceReq'>
+  <wsdl:part element='ns1:sayHi' name='in'></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name='HelloWorldPubServiceRes'>
+  <wsdl:part element='ns1:sayHiReponse' name='out'></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name='HelloWorldPubServiceFault1'>
+  <wsdl:part element='ns1:sayFault' name='fault1'></wsdl:part>
+
+ </wsdl:message>
+ <wsdl:portType name='HelloWorldPubServicePortType'>
+  <wsdl:operation name='HelloWorldPubServiceOp'>
+   <wsdl:input message='tns:HelloWorldPubServiceReq' name='HelloWorldPubServiceReq'></wsdl:input>
+   <wsdl:output message='tns:HelloWorldPubServiceRes' name='HelloWorldPubServiceRes'></wsdl:output>
+   <wsdl:fault message='tns:HelloWorldPubServiceFault1' name='HelloWorldPubServiceFault1'></wsdl:fault>
+  </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name='HelloWorldPubServiceGetPortType'>
+  <wsdl:operation name='HelloWorldPubServiceOp'>
+   <wsdl:input message='tns:HelloWorldPubServiceReq' name='HelloWorldPubServiceReq'></wsdl:input>
+   <wsdl:output message='tns:HelloWorldPubServiceRes' name='HelloWorldPubServiceRes'></wsdl:output>
+  </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name='HelloWorldPubServiceBinding' type='tns:HelloWorldPubServicePortType'>
+  <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
+  <wsdl:operation name='HelloWorldPubServiceOp'>
+   <wsdl:input>
+    <soap:body use='literal'/>
+   </wsdl:input>
+   <wsdl:output>
+    <soap:body use='literal'/>
+   </wsdl:output>
+   <wsdl:fault name='HelloWorldPubServiceFault1'>
+    <soap:fault name='HelloWorldPubServiceFault1' use='literal'/>
+   </wsdl:fault>
+  </wsdl:operation>
+ </wsdl:binding> 
+ <wsdl:binding name='HelloWorldPubServiceBindingGet' type='tns:HelloWorldPubServiceGetPortType'>
+  <http:binding verb='GET'/>
+  <wsdl:operation name='HelloWorldPubServiceOp'>
+   <http:operation location='/HelloWorldPubServiceOp'/>
+    <wsdl:input>
+     <http:urlEncoded/>
+    </wsdl:input>
+    <wsdl:output>
+     <mime:mimeXml part='Body'/>
+    </wsdl:output>
+  </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name='HelloWorldPubServiceService'>
+  <wsdl:port binding='tns:HelloWorldPubServiceBinding' name='HelloWorldPubServicePortType'>
+   <soap:address location='http://127.0.0.1:8080/Quickstart_helloworld_pub_service/ESBServiceSample/HelloWorldPubService'/>
+  </wsdl:port>
+  <wsdl:port binding='tns:HelloWorldPubServiceBindingGet' name='HelloWorldPubServiceGetPortType'>
+   <http:address location='http://127.0.0.1:8080/Quickstart_helloworld_pub_service'/>
+  </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>



More information about the jboss-svn-commits mailing list