You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mirae-dev@ws.apache.org by da...@apache.org on 2005/02/03 13:41:12 UTC
svn commit: r151149 [8/19] - in webservices/mirae/trunk: ./ bin/ bin/linux/
bin/windows/ build/ docs/ docs/images/ docs/images/CVS/ docs/javadoc/
genstub/ genstub/example8/ genstub/lk/ genstub/lk/opensource/
genstub/lk/opensource/wsmobile/ genstub/org/ genstub/org/apache/
genstub/org/apache/mirae/ genstub/org/apache/mirae/builtin/
genstub/org/apache/mirae/builtin/simpletypes/ genstub/uk/ genstub/uk/co/
genstub/uk/co/dsdata/ genstub/uk/co/dsdata/ws/
genstub/uk/co/dsdata/ws/travel/ genstub/uk/co/dsdata/ws/travel/sbg/
genstub/uk/co/dsdata/ws/travel/sbg/SBGAirFareQuotes/
genstub/ws_mobile_point/ lib/ logs/ samples/ samples/documentsamples/
samples/documentsamples/calculator/
samples/documentsamples/calculator/calculator/
samples/documentsamples/calculator/calculator/axis/
samples/documentsamples/calculator/calculator/axis/localhost/
samples/documentsamples/calculator/org/
samples/documentsamples/calculator/org/apache/
samples/documentsamples/calculator/org/apache/mirae/
samples/documentsamples/calculator/org/apache/mirae/builtin/
samples/documentsamples/calculator/org/apache/mirae/builtin/simpletypes/
samples/documentsamples/echo/ samples/documentsamples/echo/org/
samples/documentsamples/echo/org/apache/
samples/documentsamples/echo/org/apache/mirae/
samples/documentsamples/echo/org/apache/mirae/builtin/
samples/documentsamples/echo/org/apache/mirae/builtin/simpletypes/
samples/documentsamples/echo/org/soapinterop/
samples/documentsamples/employee/
samples/documentsamples/employee/jSR172UseCases/
samples/documentsamples/employee/jSR172UseCases/com/
samples/documentsamples/employee/jSR172UseCases/com/sun/
samples/documentsamples/employee/jSR172UseCases/com/sun/www/
samples/documentsamples/employee/org/
samples/documentsamples/employee/org/apache/
samples/documentsamples/employee/org/apache/mirae/
samples/documentsamples/employee/org/apache/mirae/builtin/
samples/documentsamples/employee/org/apache/mirae/builtin/simpletypes/
samples/documentsamples/employee/xsd/
samples/documentsamples/employee/xsd/JSR172AppendixA/
samples/documentsamples/employee/xsd/JSR172AppendixA/com/
samples/documentsamples/employee/xsd/JSR172AppendixA/com/sun/
samples/documentsamples/employee/xsd/JSR172AppendixA/com/sun/www/
samples/rpcsamples/ samples/rpcsamples/airfarequote/
samples/rpcsamples/airfarequote/org/
samples/rpcsamples/airfarequote/org/apache/
samples/rpcsamples/airfarequote/org/apache/mirae/
samples/rpcsamples/airfarequote/org/apache/mirae/builtin/
samples/rpcsamples/airfarequote/org/apache/mirae/builtin/simpletypes/
samples/rpcsamples/airfarequote/uk/ samples/rpcsamples/airfarequote/uk/co/
samples/rpcsamples/airfarequote/uk/co/dsdata/
samples/rpcsamples/airfarequote/uk/co/dsdata/ws/
samples/rpcsamples/airfarequote/uk/co/dsdata/ws/travel/
samples/rpcsamples/airfarequote/uk/co/dsdata/ws/travel/sbg/
samples/rpcsamples/airfarequote/uk/co/dsdata/ws/travel/sbg/SBGAirFareQuotes/
samples/rpcsamples/calculator/ samples/rpcsamples/calculator/lk/
samples/rpcsamples/calculator/lk/opensource/
samples/rpcsamples/calculator/lk/opensource/wsmobile/
samples/rpcsamples/calculator/org/ samples/rpcsamples/calculator/org/apache/
samples/rpcsamples/calculator/org/apache/mirae/
samples/rpcsamples/calculator/org/apache/mirae/builtin/
samples/rpcsamples/calculator/org/apache/mirae/builtin/simpletypes/
samples/rpcsamples/distance/ samples/rpcsamples/distance/org/
samples/rpcsamples/distance/org/apache/
samples/rpcsamples/distance/org/apache/mirae/
samples/rpcsamples/distance/org/apache/mirae/builtin/
samples/rpcsamples/distance/org/apache/mirae/builtin/simpletypes/
samples/rpcsamples/distance/wsdl/
samples/rpcsamples/distance/wsdl/DistanceService/
samples/rpcsamples/distance/wsdl/DistanceService/sd/
samples/rpcsamples/distance/wsdl/DistanceService/sd/net/
samples/rpcsamples/distance/wsdl/DistanceService/sd/net/xmethods/
samples/rpcsamples/distance/wsdl/DistanceService/sd/net/xmethods/www/
samples/rpcsamples/point/ samples/rpcsamples/point/org/
samples/rpcsamples/point/org/apache/
samples/rpcsamples/point/org/apache/mirae/
samples/rpcsamples/point/org/apache/mirae/builtin/
samples/rpcsamples/point/org/apache/mirae/builtin/simpletypes/
samples/rpcsamples/point/ws_mobile_point/ samples/rpcsamples/student/
samples/rpcsamples/student/example8/ samples/rpcsamples/student/org/
samples/rpcsamples/student/org/apache/
samples/rpcsamples/student/org/apache/mirae/
samples/rpcsamples/student/org/apache/mirae/builtin/
samples/rpcsamples/student/org/apache/mirae/builtin/simpletypes/ src/
src/mirae/ src/mirae/jaxp/ src/mirae/jaxp/javax/ src/mirae/jaxp/javax/xml/
src/mirae/jaxp/javax/xml/parsers/ src/mirae/jaxp/org/
src/mirae/jaxp/org/apache/ src/mirae/jaxp/org/apache/mirae/
src/mirae/jaxp/org/apache/mirae/j2me/
src/mirae/jaxp/org/apache/mirae/j2me/xml/
src/mirae/jaxp/org/apache/mirae/j2me/xml/sax/ src/mirae/jaxp/org/xml/
src/mirae/jaxp/org/xml/sax/ src/mirae/jaxp/org/xml/sax/helpers/
src/mirae/jaxrpc/ src/mirae/jaxrpc/javax/ src/mirae/jaxrpc/javax/xml/
src/mirae/jaxrpc/javax/xml/namespace/ src/mirae/jaxrpc/javax/xml/rpc/
src/mirae/jaxrpc/org/ src/mirae/jaxrpc/org/apache/
src/mirae/jaxrpc/org/apache/mirae/ src/mirae/jaxrpc/org/apache/mirae/util/
src/mirae/jaxrpc/org/apache/mirae/xml/
src/mirae/jaxrpc/org/apache/mirae/xml/rpc/ src/tools/
src/tools/simpletypes/ src/tools/wsdl2ws_j2me/ src/tools/wsdl2ws_j2me/org/
src/tools/wsdl2ws_j2me/org/apache/ src/tools/wsdl2ws_j2me/org/apache/axis/
src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/
src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/symbolTable/
src/tools/wsdl2ws_j2me/org/apache/mirae/
src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/
src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/
src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/
src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/j2me/
src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/j2me/client/
src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/rpc/ tests/
tests/functional/ tests/functional/client/
tests/functional/client/SBGGetAirFareQuote-client1/
tests/functional/client/SBGGetAirFareQuote-client2/
tests/functional/client/calculator/ tests/functional/client/point/
tests/functional/client/wst/ tests/functional/wsdl/ tests/unit/
tests/unit/inmessage/ tests/unit/mirae/ tests/unit/outmessage/
tests/unit/wsdl2ws/ wsdl/ wsdltests/ wsdltests/calculator/
wsdltests/calculator/client/ wsdltests/calculator/server/
wsdltests/exceptiontest/ wsdltests/exceptiontest/client/
wsdltests/exceptiontest/server/ wsdltests/interoptestround1/
wsdltests/interoptestround1/client/ wsdltests/interoptestround1/server/
Added: webservices/mirae/trunk/src/tools/simpletypes/WrapIntParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/WrapIntParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/WrapIntParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/WrapIntParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class WrapIntParam implements InOutParameter {
+ private Integer param;
+
+ public WrapIntParam() {
+ }
+
+ public WrapIntParam(String value) throws Exception {
+ if (value != null)
+ this.param = new Integer(Integer.parseInt(value));
+
+ }
+
+ public WrapIntParam(Integer param) {
+ this.param = param;
+ }
+
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+
+ if (value != null)
+ this.param = new Integer(Integer.parseInt(value));
+
+ }
+
+ public void serialize(StringBuffer buffer)throws IOException,Exception {
+ buffer.append(param);
+ }
+
+
+ /**
+ * @return
+ */
+ public Integer getParam() {
+ return param;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return Integer.toString(param.intValue());
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
Propchange: webservices/mirae/trunk/src/tools/simpletypes/WrapIntParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/simpletypes/WrapLongParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/WrapLongParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/WrapLongParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/WrapLongParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class WrapLongParam implements InOutParameter {
+ private Long param;
+ public WrapLongParam(){}
+ public WrapLongParam(String value) throws Exception {
+ if (value != null)
+ this.param = new Long(Long.parseLong(value));
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value) throws SAXException {
+
+
+ if (value != null)
+ this.param = new Long(Long.parseLong(value));
+
+ }
+
+ public WrapLongParam(Long param) {
+ this.param = param;
+ }
+
+
+ public void serialize(StringBuffer buffer)throws IOException,Exception {
+ buffer.append(param);
+ }
+
+
+ /**
+ * @return
+ */
+ public Long getParam() {
+ return param;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return String.valueOf(param);
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Propchange: webservices/mirae/trunk/src/tools/simpletypes/WrapLongParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/simpletypes/WrapShortParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/WrapShortParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/WrapShortParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/WrapShortParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.builtin.simpletypes;
+
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class WrapShortParam implements InOutParameter {
+ public Short param;
+ public WrapShortParam(){}
+
+ public WrapShortParam(Short param) {
+ this.param = param;
+ }
+
+
+
+ public WrapShortParam(String value) {
+ if (value != null)
+ this.param = new Short(Short.parseShort(value));
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+
+ if (value != null)
+ this.param = new Short(Short.parseShort(value));
+
+ }
+
+ public void serialize(StringBuffer buffer)throws IOException,Exception {
+ buffer.append(param.toString());
+ }
+
+ /**
+ * @return
+ */
+ public Short getParam() {
+ return param;
+ }
+
+ public String toString() {
+ return param.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: webservices/mirae/trunk/src/tools/simpletypes/YearMonthParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/YearMonthParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/YearMonthParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/YearMonthParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class YearMonthParam implements InOutParameter {
+
+ private int year;
+ private int month;
+ private String timezone = null;
+ private String param;
+
+ public YearMonthParam() {
+ }
+
+ /**
+ * Constructs a YearMonth with the given values No timezone is specified
+ */
+
+ public YearMonthParam(int year, int month) throws NumberFormatException {
+ setValue(year, month);
+ }
+
+ /**
+ * Constructs a YearMonth with the given values, including a timezone string
+ * The timezone is validated but not used.
+ */
+ public YearMonthParam(int year, int month, String timezone)
+ throws NumberFormatException {
+ setValue(year, month, timezone);
+ }
+
+ /**
+ * Construct a YearMonth from a String in the format [-]CCYY-MM
+ */
+
+ public YearMonthParam(String source) {
+ this.setSource(source);
+ }
+ public void setSource(String source) throws NumberFormatException {
+ int negative = 0;
+ if (source.charAt(0) == '-') {
+ negative = 1;
+ }
+ if (source.length() < (7 + negative)) {
+ throw new NumberFormatException("badYearMonthFormat");
+ }
+ // look for first '-'
+ int pos = source.substring(negative).indexOf('-');
+ if (pos < 0) {
+ throw new NumberFormatException("badYearMonthFormat");
+ }
+ if (negative > 0)
+ pos++; //adjust index for orginal string
+ setValue(Integer.parseInt(source.substring(0, pos)), Integer
+ .parseInt(source.substring(pos + 1, pos + 3)), source
+ .substring(pos + 3));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.axismora.encoding.OutParameter#serialize(org.apache.axis.encoding.SerializationContext)
+ */
+ public void serialize(StringBuffer buffer) throws IOException,Exception {
+
+ buffer.append(param);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.axismora.encoding.InParameter#desierialize(org.apache.axismora.MessageContext)
+ */
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+
+ this.setSource(value);
+ this.param = this.toString();
+
+ }
+
+ public void setYear(int year) {
+ // validate year, more than 4 digits are allowed!
+ if (year == 0) {
+ throw new NumberFormatException("badYearMonthFormat");
+ }
+
+ this.year = year;
+ }
+
+ public void setMonth(int month) {
+ // validate month
+ if (month < 1 || month > 12) {
+ throw new NumberFormatException("badYearMonthFormat");
+ }
+ this.month = month;
+ }
+
+ public void setTimezone(String timezone) {
+ // validate timezone
+ if (timezone != null && timezone.length() > 0) {
+ // Format [+/-]HH:MM
+ if (timezone.charAt(0) == '+' || (timezone.charAt(0) == '-')) {
+ if (timezone.length() != 6
+ || !Character.isDigit(timezone.charAt(1))
+ || !Character.isDigit(timezone.charAt(2))
+ || timezone.charAt(3) != ':'
+ || !Character.isDigit(timezone.charAt(4))
+ || !Character.isDigit(timezone.charAt(5)))
+ throw new NumberFormatException("badTimezoneFormat");
+
+ } else if (!timezone.equals("Z")) {
+ throw new NumberFormatException("badTimezoneFormat");
+ }
+ // if we got this far, its good
+ this.timezone = timezone;
+ }
+ }
+
+ public void setValue(int year, int month, String timezone)
+ throws NumberFormatException {
+ setYear(year);
+ setMonth(month);
+ setTimezone(timezone);
+ }
+
+ public void setValue(int year, int month) throws NumberFormatException {
+ setYear(year);
+ setMonth(month);
+ }
+
+ public String toString() {
+ String s = year + "-";
+ // month
+ s += month;
+ // timezone
+ if (timezone != null) {
+ s = s + timezone;
+ }
+ return s;
+ }
+
+ public YearMonthParam getParam() {
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
\ No newline at end of file
Propchange: webservices/mirae/trunk/src/tools/simpletypes/YearMonthParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/symbolTable/ElementDecl.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/symbolTable/ElementDecl.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/symbolTable/ElementDecl.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/symbolTable/ElementDecl.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.symbolTable;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Simple utility struct for holding element declarations.
+ *
+ * This simply correlates a QName to a TypeEntry.
+ *
+ * @author Glen Daniels (gdaniels@apache.org)
+ * @author Tom Jordahl (tomj@apache.org)
+ */
+public class ElementDecl {
+ private QName name;
+ private TypeEntry type;
+
+ private int minOccrs = 1;
+ private int maxOccurs = 1;
+ private boolean nillable = false;
+
+ // The following property is set if minOccurs=0.
+ // An item that is not set and has minOccurs=0
+ // should not be passed over the wire. This
+ // is slightly different than nillable=true which
+ // causes nil=true to be passed over the wire.
+ private boolean minOccursIs0=false;
+
+ // Indicate if the ElementDecl represents
+ // an xsd:any element
+ private boolean anyElement = false;
+
+ public ElementDecl() {
+ }
+
+ public ElementDecl(TypeEntry type, QName name) {
+ this.type = type;
+ this.name = name;
+ }
+
+ public TypeEntry getType() {
+ return type;
+ }
+
+ public void setType(TypeEntry type) {
+ this.type = type;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ public boolean getMinOccursIs0() {
+ return minOccursIs0;
+ }
+
+ public void setMinOccursIs0(boolean minOccursIs0) {
+ this.minOccursIs0 = minOccursIs0;
+ }
+
+ public boolean getAnyElement() {
+ return anyElement;
+ }
+
+ public void setAnyElement(boolean anyElement) {
+ this.anyElement = anyElement;
+ }
+ /**
+ * @return
+ */
+ public int getMaxOccurs() {
+ return maxOccurs;
+ }
+
+ /**
+ * @return
+ */
+ public int getMinOccrs() {
+ return minOccrs;
+ }
+
+ /**
+ * @return
+ */
+ public boolean isNillable() {
+ return nillable;
+ }
+
+ /**
+ * @param i
+ */
+ public void setMaxOccurs(int i) {
+ maxOccurs = i;
+ }
+
+ /**
+ * @param i
+ */
+ public void setMinOccrs(int i) {
+ minOccrs = i;
+ }
+
+ /**
+ * @param b
+ */
+ public void setNillable(boolean b) {
+ nillable = b;
+ }
+
+}
Propchange: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/symbolTable/ElementDecl.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/symbolTable/SchemaUtils.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/symbolTable/SchemaUtils.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/symbolTable/SchemaUtils.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,1061 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.symbolTable;
+
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.holders.BooleanHolder;
+import javax.xml.rpc.holders.IntHolder;
+
+
+import org.apache.axis.Constants;
+import org.apache.mirae.wsdl2ws.info.ElementInfo;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * This class contains static utility methods specifically for schema type queries.
+ *
+ * @author Rich Scheuerle (scheu@us.ibm.com)
+ */
+public class SchemaUtils {
+
+ static final QName VALUE_QNAME = Utils.findQName("", "value");
+
+ /**
+ * If the specified node represents a supported JAX-RPC complexType or
+ * simpleType, a Vector is returned which contains ElementDecls for the
+ * child element names.
+ * If the element is a simpleType, an ElementDecls is built representing
+ * the restricted type with the special name "value".
+ * If the element is a complexType which has simpleContent, an ElementDecl
+ * is built representing the extended type with the special name "value".
+ * This method does not return attribute names and types
+ * (use the getContainedAttributeTypes)
+ * If the specified node is not a supported
+ * JAX-RPC complexType/simpleType/element null is returned.
+ */
+ public static Vector getContainedElementDeclarations(Node node, SymbolTable symbolTable) {
+ if (node == null) {
+ return null;
+ }
+
+ // If the node kind is an element, dive into it.
+ if (isXSDNode(node, "element")) {
+ NodeList children = node.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "complexType")) {
+ node = kid;
+ break;
+ }
+ }
+ }
+
+ // Expecting a schema complexType or simpleType
+ if (isXSDNode(node, "complexType")) {
+ // Under the complexType there could be complexContent/simpleContent
+ // and extension elements if this is a derived type. Skip over these.
+ NodeList children = node.getChildNodes();
+ Node complexContent = null;
+ Node simpleContent = null;
+ Node extension = null;
+ for (int j = 0; j < children.getLength(); j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "complexContent")) {
+ complexContent = kid;
+ break; // REMIND: should this be here or on either branch?
+ } else if (isXSDNode(kid, "simpleContent")) {
+ simpleContent = kid;
+ }
+ }
+ if (complexContent != null) {
+ children = complexContent.getChildNodes();
+ for (int j = 0; j < children.getLength() && extension == null; j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "extension")) {
+ extension = kid;
+ }
+ }
+ }
+ if (simpleContent != null) {
+ children = simpleContent.getChildNodes();
+ for (int j = 0; j < children.getLength() && extension == null; j++) {
+ QName extensionOrRestrictionKind = Utils.getNodeQName(children.item(j));
+ if (extensionOrRestrictionKind != null &&
+ (extensionOrRestrictionKind.getLocalPart().equals("extension") ||
+ extensionOrRestrictionKind.getLocalPart().equals("restriction")) &&
+ Constants.isSchemaXSD(extensionOrRestrictionKind.getNamespaceURI())) {
+
+ // get the type of the extension/restriction from the "base" attribute
+ QName extendsOrRestrictsType =
+ Utils.getTypeQName(children.item(j), new BooleanHolder(), false);
+
+ // Return an element declaration with a fixed name
+ // ("value") and the correct type.
+ Vector v = new Vector();
+ ElementDecl elem = new ElementDecl();
+ elem.setType(symbolTable.getTypeEntry(extendsOrRestrictsType, false));
+ elem.setName(VALUE_QNAME);
+ v.add(elem);
+ return v;
+ }
+ }
+ }
+
+ if (extension != null) {
+ node = extension; // Skip over complexContent and extension
+ }
+
+ // Under the complexType there may be choice, sequence, group and/or all nodes.
+ // (There may be other #text nodes, which we will ignore).
+ children = node.getChildNodes();
+ Vector v = new Vector();
+ for (int j = 0; j < children.getLength(); j++) {
+ QName subNodeKind = Utils.getNodeQName(children.item(j));
+ if (subNodeKind != null &&
+ Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
+ if (subNodeKind.getLocalPart().equals("sequence")) {
+ v.addAll(processSequenceNode(children.item(j), symbolTable));
+ } else if (subNodeKind.getLocalPart().equals("all")) {
+ v.addAll(processAllNode(children.item(j), symbolTable));
+ } else if (subNodeKind.getLocalPart().equals("choice")) {
+ v.addAll(processChoiceNode(children.item(j), symbolTable));
+ } else if (subNodeKind.getLocalPart().equals("group")) {
+ v.addAll(processGroupNode(children.item(j), symbolTable));
+ }
+ }
+ }
+ return v;
+ } else {
+ // This may be a simpleType, return the type with the name "value"
+ QName simpleQName = getSimpleTypeBase(node);
+ if (simpleQName != null) {
+ TypeEntry simpleType = symbolTable.getType(simpleQName);
+ if (simpleType != null) {
+ Vector v = new Vector();
+ ElementDecl elem = new ElementDecl();
+ elem.setType(simpleType);
+ elem.setName(new javax.xml.namespace.QName("", "value"));
+ v.add(elem);
+ return v;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Invoked by getContainedElementDeclarations to get the child element types
+ * and child element names underneath a Choice Node
+ */
+ private static Vector processChoiceNode(Node choiceNode,
+ SymbolTable symbolTable) {
+ Vector v = new Vector();
+ NodeList children = choiceNode.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ QName subNodeKind = Utils.getNodeQName(children.item(j));
+ if (subNodeKind != null &&
+ Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
+ if (subNodeKind.getLocalPart().equals("choice")) {
+ v.addAll(processChoiceNode(children.item(j), symbolTable));
+ } else if (subNodeKind.getLocalPart().equals("sequence")) {
+ v.addAll(processSequenceNode(children.item(j), symbolTable));
+ } else if (subNodeKind.getLocalPart().equals("group")) {
+ v.addAll(processGroupNode(children.item(j), symbolTable));
+ } else if (subNodeKind.getLocalPart().equals("element")) {
+ ElementDecl elem =
+ processChildElementNode(children.item(j),
+ symbolTable);
+ if (elem != null)
+ v.add(elem);
+ }
+ }
+ }
+ return v;
+ }
+
+ /**
+ * Invoked by getContainedElementDeclarations to get the child element types
+ * and child element names underneath a Sequence Node
+ */
+ private static Vector processSequenceNode(Node sequenceNode,
+ SymbolTable symbolTable) {
+ Vector v = new Vector();
+ NodeList children = sequenceNode.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ QName subNodeKind = Utils.getNodeQName(children.item(j));
+ if (subNodeKind != null &&
+ Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
+ if (subNodeKind.getLocalPart().equals("choice")) {
+ v.addAll(processChoiceNode(children.item(j), symbolTable));
+ } else if (subNodeKind.getLocalPart().equals("sequence")) {
+ v.addAll(processSequenceNode(children.item(j), symbolTable));
+ } else if (subNodeKind.getLocalPart().equals("group")) {
+ v.addAll(processGroupNode(children.item(j), symbolTable));
+ } else if (subNodeKind.getLocalPart().equals("any")) {
+ // Represent this as an element named any of type any type.
+ // This will cause it to be serialized with the element
+ // serializer.
+ TypeEntry type = symbolTable.getType(Constants.XSD_ANY);
+ ElementDecl elem =
+ new ElementDecl(type, Utils.findQName("","any"));
+ elem.setAnyElement(true);
+ v.add(elem);
+ } else if (subNodeKind.getLocalPart().equals("element")) {
+ ElementDecl elem =
+ processChildElementNode(children.item(j),
+ symbolTable);
+ if (elem != null)
+ v.add(elem);
+ }
+ }
+ }
+ return v;
+ }
+
+ /**
+ * Invoked by getContainedElementDeclarations to get the child element types
+ * and child element names underneath a group node.
+ * (Currently the code only supports a defined group it does not
+ * support a group that references a previously defined group)
+ */
+ private static Vector processGroupNode(Node groupNode, SymbolTable symbolTable) {
+ Vector v = new Vector();
+ NodeList children = groupNode.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ QName subNodeKind = Utils.getNodeQName(children.item(j));
+ if (subNodeKind != null &&
+ Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
+ if (subNodeKind.getLocalPart().equals("choice")) {
+ v.addAll(processChoiceNode(children.item(j), symbolTable));
+ } else if (subNodeKind.getLocalPart().equals("sequence")) {
+ v.addAll(processSequenceNode(children.item(j), symbolTable));
+ } else if (subNodeKind.getLocalPart().equals("all")) {
+ v.addAll(processAllNode(children.item(j), symbolTable));
+ }
+ }
+ }
+ return v;
+ }
+
+ /**
+ * Invoked by getContainedElementDeclarations to get the child element types
+ * and child element names underneath an all node.
+ */
+ private static Vector processAllNode(Node allNode, SymbolTable symbolTable) {
+ Vector v = new Vector();
+ NodeList children = allNode.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "element")) {
+ ElementDecl elem = processChildElementNode(kid,symbolTable);
+ if (elem != null) {
+ v.add(elem);
+ }
+ }
+ }
+ return v;
+ }
+
+
+ /**
+ * Invoked by getContainedElementDeclarations to get the child element type
+ * and child element name for a child element node.
+ *
+ * If the specified node represents a supported JAX-RPC child element,
+ * we return an ElementDecl containing the child element name and type.
+ */
+ private static ElementDecl processChildElementNode(Node elementNode,
+ SymbolTable symbolTable) {
+ // Get the name qnames.
+ QName nodeName = Utils.getNodeNameQName(elementNode);
+ BooleanHolder forElement = new BooleanHolder();
+
+ // The type qname is used to locate the TypeEntry, which is then
+ // used to retrieve the proper java name of the type.
+ QName nodeType = Utils.getTypeQName(elementNode, forElement, false);
+
+ TypeEntry type = symbolTable.getTypeEntry(nodeType, forElement.value);
+
+ // An element inside a complex type is either qualified or unqualified.
+ // If the ref= attribute is used, the name of the ref'd element is used
+ // (which must be a root element). If the ref= attribute is not
+ // used, the name of the element is unqualified.
+
+ if (!forElement.value) {
+ // check the Form (or elementFormDefault) attribute of this node to
+ // determine if it should be namespace quailfied or not.
+ String form = Utils.getAttribute(elementNode, "form");
+ if (form != null && form.equals("unqualified")) {
+ // Unqualified nodeName
+ nodeName = Utils.findQName("", nodeName.getLocalPart());
+ } else if (form == null) {
+ // check elementForDefault on schema element
+ String def = Utils.getScopedAttribute(elementNode,
+ "elementFormDefault");
+ if (def == null || def.equals("unqualified")) {
+ // Unqualified nodeName
+ nodeName = Utils.findQName("", nodeName.getLocalPart());
+ }
+ }
+ }
+
+ if (type != null) {
+ ElementDecl elem = new ElementDecl(type, nodeName);
+ String minOccurs = Utils.getAttribute(elementNode, "minOccurs");
+ if (minOccurs != null && minOccurs.equals("0")) {
+ elem.setMinOccursIs0(true);
+ }
+ if(minOccurs == null){}
+ else if("unbounded".equals(minOccurs))
+ elem.setMinOccrs(ElementInfo.UNBOUNDED);
+ else{
+ elem.setMinOccrs(Integer.parseInt(minOccurs));
+ }
+
+
+ String maxOccurs = Utils.getAttribute(elementNode, "maxOccurs");
+
+ if(maxOccurs == null){}
+ else if("unbounded".equals(maxOccurs))
+ elem.setMaxOccurs(ElementInfo.UNBOUNDED);
+ else
+ elem.setMaxOccurs(Integer.parseInt(maxOccurs));
+ String nillable = Utils.getAttribute(elementNode, "nilable");
+ if(nillable != null && "true".equals(nillable))
+ elem.setNillable(true);
+
+ return elem;
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the WSDL2Java QName for the anonymous type of the element
+ * or null.
+ */
+ public static QName getElementAnonQName(Node node) {
+ if (isXSDNode(node, "element")) {
+ NodeList children = node.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "complexType") || isXSDNode(kid, "simpleType")) {
+ return Utils.getNodeNameQName(kid);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the WSDL2Java QName for the anonymous type of the attribute
+ * or null.
+ */
+ public static QName getAttributeAnonQName(Node node) {
+ if (isXSDNode(node, "attribute")) {
+ NodeList children = node.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "complexType") || isXSDNode(kid, "simpleType")) {
+ return Utils.getNodeNameQName(kid);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * If the specified node is a simple type or contains simpleContent, return true
+ */
+ public static boolean isSimpleTypeOrSimpleContent(Node node) {
+ if (node == null) {
+ return false;
+ }
+
+ // If the node kind is an element, dive into it.
+ if (isXSDNode(node, "element")) {
+ NodeList children = node.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "complexType")) {
+ node = kid;
+ break;
+ } else if (isXSDNode(kid, "simpleType")) {
+ return true;
+ }
+ }
+ }
+
+ // Expecting a schema complexType or simpleType
+ if (isXSDNode(node, "simpleType")) {
+ return true;
+ }
+
+ if (isXSDNode(node, "complexType")) {
+ // Under the complexType there could be complexContent/simpleContent
+ // and extension elements if this is a derived type. Skip over these.
+ NodeList children = node.getChildNodes();
+ Node complexContent = null;
+ Node simpleContent = null;
+ for (int j = 0; j < children.getLength(); j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "complexContent")) {
+ complexContent = kid;
+ break;
+ } else if (isXSDNode(kid, "simpleContent")) {
+ simpleContent = kid;
+ }
+ }
+ if (complexContent != null) {
+ return false;
+ }
+ if (simpleContent != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Test whether <tt>node</tt> is not null, belongs to the XML
+ * Schema namespace, and has a localName that matches
+ * <tt>schemaLocalName</tt>
+ *
+ * This can be used to determine that a given Node defines a
+ * schema "complexType" "element" and so forth.
+ *
+ * @param node a <code>Node</code> value
+ * @param schemaLocalName a <code>String</code> value
+ * @return true if the node is matches the name in the schema namespace.
+ */
+ private static boolean isXSDNode(Node node, String schemaLocalName) {
+ if ((node != null) && Constants.isSchemaXSD(node.getNamespaceURI())) {
+ String localName = node.getLocalName();
+ return ((localName != null) && localName.equals(schemaLocalName));
+ }
+ return false;
+ }
+
+ /**
+ * If the specified node represents a supported JAX-RPC complexType/element
+ * which extends another complexType. The Type of the base is returned.
+ */
+ public static TypeEntry getComplexElementExtensionBase(Node node, SymbolTable symbolTable) {
+ if (node == null) {
+ return null;
+ }
+
+ TypeEntry cached = (TypeEntry)symbolTable.node2ExtensionBase.get(node);
+ if (cached != null) {
+ return cached; // cache hit
+ }
+
+ // If the node kind is an element, dive into it.
+ if (isXSDNode(node, "element")) {
+ NodeList children = node.getChildNodes();
+ Node complexNode = null;
+ for (int j = 0; j < children.getLength() && complexNode == null; j++) {
+ if (isXSDNode(children.item(j), "complexType")) {
+ complexNode = children.item(j);
+ node = complexNode;
+ }
+ }
+ }
+
+ // Expecting a schema complexType
+ if (isXSDNode(node, "complexType")) {
+
+ // Under the complexType there could be should be a complexContent &
+ // extension elements if this is a derived type.
+ NodeList children = node.getChildNodes();
+ Node content = null;
+ Node extension = null;
+ for (int j = 0; j < children.getLength() && content == null; j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "complexContent") || isXSDNode(kid, "simpleContent")) {
+ content = kid;
+ }
+ }
+ if (content != null) {
+ children = content.getChildNodes();
+ for (int j = 0; j < children.getLength() && extension == null; j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "extension")) {
+ extension = kid;
+ }
+ }
+ }
+ if (extension == null) {
+ cached = null;
+ } else {
+ // Get the QName of the extension base
+ QName extendsType = Utils.getTypeQName(extension, new BooleanHolder(), false);
+ if (extendsType == null) {
+ cached = null;
+ } else {
+ // Return associated Type
+ cached = symbolTable.getType(extendsType);
+ }
+ }
+ }
+ symbolTable.node2ExtensionBase.put(node, cached);
+ return cached;
+ }
+
+ /**
+ * If the specified node represents a 'normal' non-enumeration simpleType,
+ * the QName of the simpleType base is returned.
+ */
+ public static QName getSimpleTypeBase(Node node) {
+ QName baseQName = null;
+
+ if (node == null) {
+ return null;
+ }
+
+ // If the node kind is an element, dive into it.
+ QName nodeKind = Utils.getNodeQName(node);
+ if (isXSDNode(node, "element")) {
+ NodeList children = node.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ if (isXSDNode(children.item(j), "simpleType")) {
+ node = children.item(j);
+ break;
+ }
+ }
+ }
+ // Get the node kind, expecting a schema simpleType
+ if (isXSDNode(node, "simpleType")) {
+ // Under the simpleType there should be a restriction.
+ // (There may be other #text nodes, which we will ignore).
+ NodeList children = node.getChildNodes();
+ Node restrictionNode = null;
+ for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
+ if (isXSDNode(children.item(j), "restriction")) {
+ restrictionNode = children.item(j);
+ }
+ }
+
+ // The restriction node indicates the type being restricted
+ // (the base attribute contains this type).
+
+ if (restrictionNode != null) {
+ baseQName = Utils.getTypeQName(restrictionNode, new BooleanHolder(), false);
+ }
+
+ // Look for enumeration elements underneath the restriction node
+ if (baseQName != null && restrictionNode != null) {
+ NodeList enums = restrictionNode.getChildNodes();
+ for (int i=0; i < enums.getLength(); i++) {
+ if (isXSDNode(enums.item(i), "enumeration")) {
+ // Found an enumeration, this isn't a
+ // 'normal' simple type.
+ return null;
+ }
+ }
+ }
+ }
+ return baseQName;
+ }
+
+ /**
+ * Returns the contained restriction or extension node underneath
+ * the specified node. Returns null if not found
+ */
+ public static Node getRestrictionOrExtensionNode(Node node) {
+ Node re = null;
+ if (node == null) {
+ return re;
+ }
+
+ // If the node kind is an element, dive into it.
+ if (isXSDNode(node, "element")) {
+ NodeList children = node.getChildNodes();
+ Node node2 = null;
+ for (int j = 0; j < children.getLength(); j++) {
+ Node n = children.item(j);
+ if (isXSDNode(n, "simpleType") || isXSDNode(n, "complexType") || isXSDNode(n, "simpleContent")) {
+ node = n;
+ break;
+ }
+ }
+ }
+ // Get the node kind, expecting a schema simpleType
+ if (isXSDNode(node, "simpleType") || isXSDNode(node, "complexType")) {
+ // Under the complexType there could be a complexContent.
+ NodeList children = node.getChildNodes();
+ Node complexContent = null;
+ if (node.getLocalName().equals("complexType")) {
+ for (int j = 0; j < children.getLength() && complexContent == null; j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "complexContent") || isXSDNode(kid, "simpleContent")) {
+ complexContent = kid;
+ }
+ }
+ node = complexContent;
+ }
+ // Now get the extension or restriction node
+ if (node != null) {
+ children = node.getChildNodes();
+ for (int j = 0; j < children.getLength() && re == null; j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "extension") || isXSDNode(kid, "restriction")) {
+ re = kid;
+ }
+ }
+ }
+ }
+
+ return re;
+ }
+
+ /**
+ * If the specified node represents an array encoding of one of the following
+ * forms, then return the qname repesenting the element type of the array.
+ * @param node is the node
+ * @param dims is the output value that contains the number of dimensions if return is not null
+ * @return QName or null
+ */
+ public static QName getArrayComponentQName(Node node, IntHolder dims) {
+ dims.value = 1; // assume 1 dimension
+ QName qName = getCollectionComponentQName(node);
+ if (qName == null) {
+ qName = getArrayComponentQName_JAXRPC(node, dims);
+ }
+ return qName;
+ }
+
+ /**
+ * If the specified node represents an element that references a collection
+ * then return the qname repesenting the component of the collection.
+ *
+ * <xsd:element name="alias" type="xsd:string" maxOccurs="unbounded"/>
+ * returns qname for"xsd:string"
+ * <xsd:element ref="alias" maxOccurs="unbounded"/>
+ * returns qname for "alias"
+ * @param node is the Node
+ * @return QName of the compoent of the collection
+ */
+ public static QName getCollectionComponentQName(Node node) {
+ if (node == null) {
+ return null;
+ }
+
+ // If the node kind is an element, dive get its type.
+ if (isXSDNode(node, "element")) {
+ // Compare the componentQName with the name of the
+ // full name. If different, return componentQName
+ BooleanHolder forElement = new BooleanHolder();
+ QName componentQName = Utils.getTypeQName(node, forElement, true);
+ if (componentQName != null) {
+ QName fullQName = Utils.getTypeQName(node, forElement, false);
+ if (!componentQName.equals(fullQName)) {
+ return componentQName;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * If the specified node represents an array encoding of one of the following
+ * forms, then return the qname repesenting the element type of the array.
+ *
+ * @param node is the node
+ * @param dims is the output value that contains the number of dimensions if return is not null
+ * @return QName or null
+ *
+ * JAX-RPC Style 2:
+ *<xsd:complexType name="hobbyArray">
+ * <xsd:complexContent>
+ * <xsd:restriction base="soapenc:Array">
+ * <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
+ * </xsd:restriction>
+ * </xsd:complexContent>
+ *</xsd:complexType>
+ *
+ * JAX-RPC Style 3:
+ *<xsd:complexType name="petArray">
+ * <xsd:complexContent>
+ * <xsd:restriction base="soapenc:Array">
+ * <xsd:sequence>
+ * <xsd:element name="alias" type="xsd:string" maxOccurs="unbounded"/>
+ * </xsd:sequence>
+ * </xsd:restriction>
+ * </xsd:complexContent>
+ *</xsd:complexType>
+ *
+ */
+ private static QName getArrayComponentQName_JAXRPC(Node node, IntHolder dims) {
+ dims.value = 0; // Assume 0
+ if (node == null) {
+ return null;
+ }
+
+ // If the node kind is an element, dive into it.
+ if (isXSDNode(node, "element")) {
+ NodeList children = node.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "complexType")) {
+ node = kid;
+ break;
+ }
+ }
+ }
+
+ // Get the node kind, expecting a schema complexType
+ if (isXSDNode(node, "complexType")) {
+ // Under the complexType there should be a complexContent.
+ // (There may be other #text nodes, which we will ignore).
+ NodeList children = node.getChildNodes();
+ Node complexContentNode = null;
+ for (int j = 0; j < children.getLength(); j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "complexContent") || isXSDNode(kid, "simpleContent")) {
+ complexContentNode = kid;
+ break;
+ }
+ }
+
+ // Under the complexContent there should be a restriction.
+ // (There may be other #text nodes, which we will ignore).
+ Node restrictionNode = null;
+ if (complexContentNode != null) {
+ children = complexContentNode.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "restriction")) {
+ restrictionNode = kid;
+ break;
+ }
+ }
+ }
+
+ // The restriction node must have a base of soapenc:Array.
+ QName baseType = null;
+ if (restrictionNode != null) {
+ baseType = Utils.getTypeQName(restrictionNode, new BooleanHolder(), false);
+ if (baseType != null &&
+ baseType.getLocalPart().equals("Array") &&
+ Constants.isSOAP_ENC(baseType.getNamespaceURI()))
+ ; // Okay
+ else
+ baseType = null; // Did not find base=soapenc:Array
+ }
+
+
+ // Under the restriction there should be an attribute OR a sequence/all group node.
+ // (There may be other #text nodes, which we will ignore).
+ Node groupNode = null;
+ Node attributeNode = null;
+ if (baseType != null) {
+ children = restrictionNode.getChildNodes();
+ for (int j = 0;
+ j < children.getLength() && groupNode == null && attributeNode == null;
+ j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "sequence") || isXSDNode(kid, "all")) {
+ groupNode = kid;
+ if (groupNode.getChildNodes().getLength() == 0) {
+ // This covers the rather odd but legal empty sequence.
+ // <complexType name="ArrayOfString">
+ // <complexContent>
+ // <restriction base="soapenc:Array">
+ // <sequence/>
+ // <attribute ref="soapenc:arrayType" wsdl:arrayType="string[]"/>
+ // </restriction>
+ // </complexContent>
+ // </complexType>
+ groupNode = null;
+ }
+ }
+ if (isXSDNode(kid, "attribute")) {
+ // If the attribute node does not have ref="soapenc:arrayType"
+ // then keep looking.
+ BooleanHolder isRef = new BooleanHolder();
+ QName refQName = Utils.getTypeQName(kid, isRef, false);
+ if (refQName != null &&
+ isRef.value &&
+ refQName.getLocalPart().equals("arrayType") &&
+ Constants.isSOAP_ENC(refQName.getNamespaceURI())) {
+ attributeNode = kid;
+ }
+ }
+ }
+ }
+
+ // If there is an attribute node, look at wsdl:arrayType to get the element type
+ if (attributeNode != null) {
+ String wsdlArrayTypeValue = null;
+ Vector attrs = Utils.getAttributesWithLocalName(attributeNode, "arrayType");
+ for (int i=0; i < attrs.size() && wsdlArrayTypeValue == null; i++) {
+ Node attrNode = (Node) attrs.elementAt(i);
+ String attrName = attrNode.getNodeName();
+ QName attrQName = Utils.getQNameFromPrefixedName(attributeNode, attrName);
+ if (Constants.isWSDL(attrQName.getNamespaceURI())) {
+ wsdlArrayTypeValue = attrNode.getNodeValue();
+ }
+ }
+
+ // The value could have any number of [] or [,] on the end
+ // Strip these off to get the prefixed name.
+ // The convert the prefixed name into a qname.
+ // Count the number of [ and , to get the dim information.
+ if (wsdlArrayTypeValue != null) {
+ int i = wsdlArrayTypeValue.indexOf('[');
+ if (i > 0) {
+ String prefixedName = wsdlArrayTypeValue.substring(0,i);
+ String mangledString = wsdlArrayTypeValue.replace(',', '[');
+ dims.value = 0;
+ int index = mangledString.indexOf('[');
+ while (index > 0) {
+ dims.value++;
+ index = mangledString.indexOf('[',index+1);
+ }
+
+ return Utils.getQNameFromPrefixedName(restrictionNode, prefixedName);
+ }
+ }
+ } else if (groupNode != null) {
+
+ // Get the first element node under the group node.
+ NodeList elements = groupNode.getChildNodes();
+ Node elementNode = null;
+ for (int i=0; i < elements.getLength() && elementNode == null; i++) {
+ Node kid = elements.item(i);
+ if (isXSDNode(kid, "element")) {
+ elementNode = elements.item(i);
+ break;
+ }
+ }
+
+ // The element node should have maxOccurs="unbounded" and
+ // a type
+ if (elementNode != null) {
+ String maxOccursValue = Utils.getAttribute(elementNode, "maxOccurs");
+ if (maxOccursValue != null &&
+ maxOccursValue.equalsIgnoreCase("unbounded")) {
+ // Get the QName of the type without considering maxOccurs
+ dims.value = 1;
+ return Utils.getTypeQName(elementNode, new BooleanHolder(), true);
+ }
+ }
+ }
+
+ }
+ return null;
+ }
+
+ /**
+ * Return the attribute names and types if any in the node
+ * The even indices are the element types (TypeEntry) and
+ * the odd indices are the corresponding names (Strings).
+ *
+ * Example:
+ * <complexType name="Person">
+ * <sequence>
+ * <element minOccurs="1" maxOccurs="1" name="Age" type="double" />
+ * <element minOccurs="1" maxOccurs="1" name="ID" type="xsd:float" />
+ * </sequence>
+ * <attribute name="Name" type="string" />
+ * <attribute name="Male" type="boolean" />
+ * </complexType>
+ *
+ */
+ public static Vector getContainedAttributeTypes(Node node,
+ SymbolTable symbolTable)
+ {
+ Vector v = null; // return value
+
+ if (node == null) {
+ return null;
+ }
+ // Check for SimpleContent
+ // If the node kind is an element, dive into it.
+ if (isXSDNode(node, "element")) {
+ NodeList children = node.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "complexType")) {
+ node = kid;
+ break;
+ }
+ }
+ }
+
+ // Expecting a schema complexType
+ if (isXSDNode(node, "complexType")) {
+ // Under the complexType there could be complexContent/simpleContent
+ // and extension elements if this is a derived type. Skip over these.
+ NodeList children = node.getChildNodes();
+ Node content = null;
+ for (int j = 0; j < children.getLength(); j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "complexContent") || isXSDNode(kid, "simpleContent")) {
+ content = kid;
+ break;
+ }
+ }
+ // Check for extensions
+ if (content != null) {
+ children = content.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ Node kid = children.item(j);
+ if (isXSDNode(kid, "extension")) {
+ node = kid;
+ break;
+ }
+ }
+ }
+
+ // examine children of the node for <attribute> elements
+ children = node.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (! isXSDNode(child, "attribute")) {
+ continue;
+ }
+
+ // we have an attribute node
+ if (v == null)
+ v = new Vector();
+
+ // Get the name and type qnames.
+ // The type qname is used to locate the TypeEntry, which is then
+ // used to retrieve the proper java name of the type.
+ QName attributeName = Utils.getNodeNameQName(child);
+ BooleanHolder forElement = new BooleanHolder();
+ QName attributeType = Utils.getTypeQName(child, forElement, false);
+
+ // An attribute is either qualified or unqualified.
+ // If the ref= attribute is used, the name of the ref'd element is used
+ // (which must be a root element). If the ref= attribute is not
+ // used, the name of the attribute is unqualified.
+ if (!forElement.value) {
+ // check the Form (or attributeFormDefault) attribute of
+ // this node to determine if it should be namespace
+ // quailfied or not.
+ String form = Utils.getAttribute(child, "form");
+ if (form != null && form.equals("unqualified")) {
+ // Unqualified nodeName
+ attributeName = Utils.findQName("", attributeName.getLocalPart());
+ } else if (form == null) {
+ // check attributeFormDefault on schema element
+ String def = Utils.getScopedAttribute(child,
+ "attributeFormDefault");
+ if (def == null || def.equals("unqualified")) {
+ // Unqualified nodeName
+ attributeName = Utils.findQName("", attributeName.getLocalPart());
+ }
+ }
+ } else {
+ attributeName = attributeType;
+ }
+
+ // Get the corresponding TypeEntry from the symbol table
+ TypeEntry type = symbolTable.getTypeEntry(attributeType,
+ forElement.value);
+
+ // add type and name to vector, skip it if we couldn't parse it
+ // XXX - this may need to be revisited.
+ if (type != null && attributeName != null) {
+ v.add(type);
+ v.add(attributeName);
+ }
+ }
+ }
+ return v;
+ }
+
+ // list of all of the XSD types in Schema 2001
+ private static String schemaTypes[] = {
+ "string",
+ "normalizedString",
+ "token",
+ "byte",
+ "unsignedByte",
+ "base64Binary",
+ "hexBinary",
+ "integer",
+ "positiveInteger",
+ "negativeInteger",
+ "nonNegativeInteger",
+ "nonPositiveInteger",
+ "int",
+ "unsignedInt",
+ "long",
+ "unsignedLong",
+ "short",
+ "unsignedShort",
+ "decimal",
+ "float",
+ "double",
+ "boolean",
+ "time",
+ "dateTime",
+ "duration",
+ "date",
+ "gMonth",
+ "gYear",
+ "gYearMonth",
+ "gDay",
+ "gMonthDay",
+ "Name",
+ "QName",
+ "NCName",
+ "anyURI",
+ "language",
+ "ID",
+ "IDREF",
+ "IDREFS",
+ "ENTITY",
+ "ENTITIES",
+ "NOTATION",
+ "NMTOKEN",
+ "NMTOKENS"
+ };
+
+ private static final Set schemaTypeSet = new HashSet(Arrays.asList(schemaTypes));
+
+ /**
+ * Determine if a string is a simple XML Schema type
+ */
+ private static boolean isSimpleSchemaType(String s) {
+ if (s == null)
+ return false;
+
+ return schemaTypeSet.contains(s);
+ }
+ /**
+ * Determine if a QName is a simple XML Schema type
+ */
+ public static boolean isSimpleSchemaType(QName qname) {
+ if (qname == null ||
+ !Constants.isSchemaXSD(qname.getNamespaceURI())) {
+ return false;
+ }
+ return isSimpleSchemaType(qname.getLocalPart());
+ }
+}
Propchange: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/CLArgParser.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/CLArgParser.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/CLArgParser.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/CLArgParser.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * This CLArgs parser can understand three types of inputs
+ * the command line arguments eg:- in rm * the argument "*"
+ * the parameters that have a key and a value they should be presents with
+ * -key value or -keyvalue e.g. in gcc hello.c -I/usr/lib the parameter "-I/usr/lib"
+ * the options that have only value
+ * --key e.g. in wsdl2java google.wsdl --server-side the option --server-side
+ */
+
+public class CLArgParser {
+ private HashMap bag;
+ private ArrayList args;
+ private ArrayList options;
+
+ /**
+ * Constructor accepts the commandline arguments.
+ * @param args
+ */
+ public CLArgParser(String[] args) {
+ this.bag = new HashMap();
+ this.args = new ArrayList();
+ this.options = new ArrayList();
+ int i = 0;
+
+ while (i < args.length) {
+ if (args[i].startsWith("--")) {
+ options.add(args[i].substring(2));
+ } else if (args[i].startsWith("-")) {
+ String value;
+ String key = args[i].substring(1, 2);
+ if (args[i].length() == 2) {
+ value = args[i + 1];
+ i++;
+ } else
+ value = args[i].substring(2);
+ bag.put(key, value);
+ } else {
+ this.args.add(args[i]);
+ }
+ i++;
+ }
+ }
+
+ /**
+ * These are direct arguments not - type options
+ * @param i
+ */
+ public String getArgument(int i) {
+ Object obj = args.get(i);
+ if (obj == null)
+ return null;
+ else
+ return (String) obj;
+ }
+
+ /**
+ * These are direct arguments not - type options
+ */
+ public int getArgumentCount() {
+ return this.args.size();
+ }
+
+ public String getParameterValueBykey(String key) {
+ return (String) bag.get(key);
+ }
+
+ public Iterator getAllParameters() {
+ return this.bag.keySet().iterator();
+ }
+
+ public boolean doesThisOptionPresents(String key) {
+ return this.options.contains(key);
+ }
+
+ public Iterator getAllOptions() {
+ return options.iterator();
+ }
+
+}
Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/Genarator.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/Genarator.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/Genarator.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/Genarator.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws;
+
+import org.apache.mirae.wsdl2ws.info.WebServiceContext;
+
+/**
+ * This is the basic Genarator, The actual way the genarator act depend on the
+ * source writer object inside the Genarator
+ */
+public class Genarator {
+ private SourceWriter sourceWriter;
+
+ /**
+ * Constructor
+ * @param genaratorType
+ * @param wscontext
+ * @throws WrapperFault
+ */
+ public Genarator(int genaratorType, WebServiceContext wscontext)
+ throws WrapperFault {
+ this.sourceWriter =
+ SourceWriterFactory.createSourceWriter(genaratorType, wscontext);
+ }
+
+ /**
+ *
+ * @throws WrapperFault
+ */
+ public void genarate() throws WrapperFault {
+ if (this.sourceWriter == null)
+ throw new WrapperFault("Cant find Maching Genarator");
+ this.sourceWriter.writeSource();
+ }
+}
Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/SourceWriter.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/SourceWriter.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/SourceWriter.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/SourceWriter.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws;
+/**
+ * Write a source to genarated. This instances decides how the Genarator will behave .
+ */
+public interface SourceWriter {
+ public void writeSource() throws WrapperFault;
+}
Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/SourceWriterFactory.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/SourceWriterFactory.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/SourceWriterFactory.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/SourceWriterFactory.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws;
+
+
+import org.apache.mirae.wsdl2ws.doclit.AllDocLitParamWriter;
+import org.apache.mirae.wsdl2ws.doclit.DocLitStubWriter;
+import org.apache.mirae.wsdl2ws.info.WebServiceContext;
+import org.apache.mirae.wsdl2ws.j2me.AllParamWriterJ2ME;
+import org.apache.mirae.wsdl2ws.j2me.client.J2MEServiceInterfaceWriter;
+import org.apache.mirae.wsdl2ws.j2me.client.J2MEStubWriter;
+
+
+/**
+ * Genarate a SourceFactory depend on the reqirements.
+ */
+public class SourceWriterFactory {
+ public static SourceWriter createSourceWriter(
+ int genaratorType,
+ WebServiceContext wscontext)
+ throws WrapperFault {
+
+ if (genaratorType == WrapperConstants.GENERATOR_PARAM_J2ME)
+ return new AllParamWriterJ2ME(wscontext);
+ else if (genaratorType == WrapperConstants.GENERATOR_STUB_SERVICE_INTERFACE_J2ME)
+ return new J2MEServiceInterfaceWriter(wscontext);
+ else if (genaratorType == WrapperConstants.GENERATOR_STUB_J2ME)
+ return new J2MEStubWriter(wscontext);
+ else if(genaratorType == WrapperConstants.GENERATOR_DOCLIT_PARAM_JAVA)
+ return new AllDocLitParamWriter(wscontext);
+ else if(genaratorType == WrapperConstants.GENERATOR_DOCLIT_STUB_JAVA)
+ return new DocLitStubWriter(wscontext);
+ System.out.println(genaratorType);
+ throw new WrapperFault("Source writer type not found");
+ }
+}
Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/SymbolTableParsingUtils.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/SymbolTableParsingUtils.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/SymbolTableParsingUtils.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/SymbolTableParsingUtils.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.mirae.wsdl2ws;
+
+
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Port;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+import org.apache.mirae.wsdl2ws.info.MethodInfo;
+
+
+
+public class SymbolTableParsingUtils {
+
+ /**
+ *
+ * @param port
+ * @return Target End Point URI
+ */
+ public static String getTargetEndPointURI(Port port){
+
+ List adresslist = port.getExtensibilityElements();
+ if (adresslist != null
+ && adresslist.size() != 0
+ && (adresslist.get(0)
+ instanceof javax.wsdl.extensions.soap.SOAPAddress))
+
+ return
+ ((javax.wsdl.extensions.soap.SOAPAddress) adresslist.get(0))
+ .getLocationURI();
+
+ return null;
+ }
+
+ /**
+ * Method for getting transport type
+ * @param binding
+ * @return
+ */
+ public static String getTransportType(Binding binding){
+ List soapbinding = binding.getExtensibilityElements();
+ if (soapbinding != null
+ && soapbinding.size() > 0
+ && (soapbinding.get(0) instanceof javax.wsdl.extensions.soap.SOAPBinding))
+ return ((javax.wsdl.extensions.soap.SOAPBinding) soapbinding.get(0))
+ .getTransportURI();
+ return null;
+ }
+
+ /**
+ *
+ * @param bindingOperation
+ * @return service name
+ */
+ public static String getSoapAction(BindingOperation bindingOperation){
+ List extenstions = bindingOperation.getExtensibilityElements();
+ for(int i=0;i<extenstions.size();i++){
+ if(extenstions.get(i) instanceof SOAPOperation)
+ return ((SOAPOperation)extenstions.get(i)).getSoapActionURI();
+ }
+ return null;
+ }
+
+ /**
+ * Method for getting input info
+ * @param input
+ * @param methodinfo
+ * @return
+ */
+ public static List getInputInfo(BindingInput input,MethodInfo methodinfo){
+ if (input == null)
+ return null;
+ List soapbodies = input.getExtensibilityElements();
+
+ if (soapbodies != null) {
+ for (int j = 0; j < soapbodies.size(); j++) {
+ if (soapbodies.get(j)
+ instanceof javax.wsdl.extensions.soap.SOAPBody) {
+ javax.wsdl.extensions.soap.SOAPBody body =
+ ((javax.wsdl.extensions.soap.SOAPBody) soapbodies
+ .get(j));
+ methodinfo.setInputEncoding(body.getEncodingStyles());
+ methodinfo.setInputUse(body.getUse());
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Method for grtting output info
+ * @param input
+ * @param methodinfo
+ * @return
+ */
+ public static List getOutputInfo(BindingOutput input,MethodInfo methodinfo){
+ if (input == null)
+ return null;
+ List soapbodies = input.getExtensibilityElements();
+
+ if (soapbodies != null) {
+ for (int j = 0; j < soapbodies.size(); j++) {
+ if (soapbodies.get(j)
+ instanceof javax.wsdl.extensions.soap.SOAPBody) {
+ javax.wsdl.extensions.soap.SOAPBody body =
+ ((javax.wsdl.extensions.soap.SOAPBody) soapbodies
+ .get(j));
+ methodinfo.setInputEncoding(body.getEncodingStyles());
+ methodinfo.setInputUse(body.getUse());
+ }
+ }
+ }
+ return null;
+ }
+
+}
Added: webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WSDL2Ws.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WSDL2Ws.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WSDL2Ws.java (added)
+++ webservices/mirae/trunk/src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/WSDL2Ws.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,545 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.wsdl2ws;
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Fault;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.holders.IntHolder;
+
+
+import org.apache.axis.wsdl.gen.Parser;
+import org.apache.axis.wsdl.symbolTable.BindingEntry;
+import org.apache.axis.wsdl.symbolTable.CollectionType;
+import org.apache.axis.wsdl.symbolTable.Element;
+import org.apache.axis.wsdl.symbolTable.ElementDecl;
+import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
+import org.apache.axis.wsdl.symbolTable.SchemaUtils;
+import org.apache.axis.wsdl.symbolTable.ServiceEntry;
+import org.apache.axis.wsdl.symbolTable.SymTabEntry;
+import org.apache.axis.wsdl.symbolTable.SymbolTable;
+import org.apache.axis.wsdl.symbolTable.TypeEntry;
+import org.apache.axis.wsdl.toJava.Utils;
+import org.apache.mirae.wsdl2ws.info.ElementInfo;
+import org.apache.mirae.wsdl2ws.info.FaultInfo;
+import org.apache.mirae.wsdl2ws.info.MethodInfo;
+import org.apache.mirae.wsdl2ws.info.ParameterInfo;
+import org.apache.mirae.wsdl2ws.info.ServiceInfo;
+import org.apache.mirae.wsdl2ws.info.Type;
+import org.apache.mirae.wsdl2ws.info.TypeMap;
+import org.apache.mirae.wsdl2ws.info.WebServiceContext;
+import org.apache.mirae.wsdl2ws.info.WrapperInfo;
+import org.w3c.dom.Node;
+
+
+/**
+ * This this the main class for the WSDL2WS_J2ME Tool. This class reuses the code in the
+ * Axis java implementations to parse the WSDL file.
+ * the functinality of the class can be discribed as follows
+ * 1) create a Symbol table
+ * 2) create WrapperInfo class parsing the commandline arguments and the SymbolTable
+ * 3) create TypeMap parsing the Symbol Table
+ * 4) create Service Info parsing the Symbol table
+ * 5) create WebServiceContext using above three classes and start execution
+ *
+ */
+public class WSDL2Ws {
+
+ private String language;
+
+ private String qualifiedServiceName;
+ private SymbolTable symbolTable;
+ private boolean hasOrder = false;
+ private String typeval;
+
+ private String serviceStyle = null;
+
+ private boolean verbose = false;
+ private String targetEndpointURI = null;
+ private String transportURI = null;
+ private String targetNameSpaceOfWSDL = null;
+ private TypeMap typeMap;
+
+ private ServiceEntry serviceentry;
+ private BindingEntry bindingEntry;
+ private PortTypeEntry portTypeEntry;
+ private ArrayList methods;
+
+ private String servicename;
+
+ /**
+ * Constructor gets the commandline arguments from the CLArgParser and creates
+ * symbol table.
+ * @param cmdLineArgs
+ * @throws WrapperFault
+ */
+ public WSDL2Ws(CLArgParser cmdLineArgs) throws WrapperFault {
+ try {
+
+ Parser wsdlParser = new Parser();
+ //get the commandline arguments
+ String wsdlfile = cmdLineArgs.getArgument(0);
+ wsdlParser.run(wsdlfile);
+
+ symbolTable = wsdlParser.getSymbolTable();
+
+ //get the target namespace
+ targetNameSpaceOfWSDL = symbolTable.getDefinition().getTargetNamespace();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new WrapperFault(e);
+ }
+ }
+
+ /**
+ * this method initailize the serviceEntry portEntry and bindingEntry
+ * @throws WrapperFault
+ */
+ Port p;
+ public void perprocess()throws WrapperFault{
+ typeMap = new TypeMap();
+ this.serviceentry = getServiceEntry();
+ Iterator ports = this.serviceentry.getService().getPorts().values().iterator();
+
+ Binding binding = null;
+
+ if (ports.hasNext()){
+ p=(Port) ports.next();
+ binding = (p).getBinding();
+ }
+
+ if (binding == null)
+ throw new WrapperFault("No binding specified");
+ this.bindingEntry = symbolTable.getBindingEntry(binding.getQName());
+
+ this.portTypeEntry = symbolTable.getPortTypeEntry(binding.getPortType().getQName());
+ if (portTypeEntry == null)
+ throw new WrapperFault("Service not found");
+ this.targetEndpointURI = SymbolTableParsingUtils.getTargetEndPointURI(p);
+
+ while(targetEndpointURI==null && ports.hasNext()==true){
+ SymbolTableParsingUtils.getTargetEndPointURI((Port)ports.next());
+ }
+ }
+
+
+
+ /**
+ * This method exteact the service,binding,encoding information and return a PortType of the
+ * webservice to publish.
+ * @return port type the webservice based on
+ */
+ private void getWebServiceInfo()
+ throws WrapperFault {
+ this.qualifiedServiceName = portTypeEntry.getName();
+ if (this.qualifiedServiceName == null) {
+ qualifiedServiceName = portTypeEntry.getQName().getNamespaceURI();
+ qualifiedServiceName =
+ WrapperUtils.firstCharacterToLowercase(
+ WrapperUtils.nsURI2packageName(qualifiedServiceName))
+ + "."
+ + portTypeEntry.getQName().getLocalPart();
+ }
+
+ //the service style (rpc|doc|msg)
+ this.serviceStyle =bindingEntry.getBindingStyle().getName();
+ //extract the trasport type as a uri
+ this.transportURI = SymbolTableParsingUtils.getTransportType(bindingEntry.getBinding());
+
+ List operations = bindingEntry.getBinding().getBindingOperations();
+ if (operations != null) {
+
+ for (int i = 0; i < operations.size(); i++) {
+ //for the each binding operation found
+ if (operations.get(i) instanceof javax.wsdl.BindingOperation) {
+ javax.wsdl.BindingOperation bindinop = (javax.wsdl.BindingOperation) operations.get(i);
+ MethodInfo method = getMethodInfoByName(bindinop.getName());
+ method.setSoapAction(SymbolTableParsingUtils.getSoapAction(bindinop));
+ SymbolTableParsingUtils.getInputInfo(bindinop.getBindingInput(),method);
+ SymbolTableParsingUtils.getOutputInfo(bindinop.getBindingOutput(),method);
+ }
+ }
+ }
+ }
+
+ /**
+ * get Service data .. service data is given as the fully qualified names
+ * When possible the user can have the schema QName if he like
+ */
+ private ArrayList getServiceInfo(PortType porttype)throws WrapperFault {
+ //get opeation list
+ Iterator oplist = porttype.getOperations().iterator();
+ ArrayList methods = new ArrayList();
+ MethodInfo minfo;
+ ParameterInfo pinfo;
+ org.apache.axis.wsdl.symbolTable.Type ptype;
+ //for each operation
+ while (oplist.hasNext()) {
+
+ minfo = new MethodInfo();
+ methods.add(minfo);
+
+ //add operation to operation List
+ Operation op = (Operation) oplist.next();
+ minfo.setMethodname(op.getName());
+
+ //setting the faults
+ Map faults = op.getFaults();
+ addFaultInfo(faults,minfo);
+
+
+ Iterator paramlist =
+ op.getInput().getMessage().getParts().values().iterator();
+ //add each parameter to parameter list
+ while (paramlist.hasNext()) {
+ Part p = (Part) paramlist.next();
+ pinfo = createParameterInfo(p);
+ minfo.addParameter(pinfo);
+ }
+
+ //get the return type
+ Iterator returnlist =
+ op.getOutput().getMessage().getParts().values().iterator();
+ if (returnlist.hasNext()) {
+ Part p = ((Part) returnlist.next());
+ minfo.setReturnType(createParameterInfo(p));
+ }
+ }
+ return methods;
+ }
+
+ /**
+ * This method extract the custom complex type info fom the symbol table
+ * @return the type map with type info
+ */
+ private TypeMap getTypeInfo()throws WrapperFault {
+ Iterator it = symbolTable.getTypeIndex().values().iterator();
+ TypeEntry type;
+ Iterator elements;
+ Type typedata;
+
+ boolean hasElements;
+ while (it.hasNext()) {
+ type = (TypeEntry) it.next();
+ Node node = type.getNode();
+ if (node != null) {
+ createTypeInfo(type);
+
+ }
+ } //end of type while
+ return typeMap;
+ } //end of method
+
+ /**
+ * Method for generating wrappers, service info, type info
+ * @param targetoutputLocation
+ * @param targetImplementationStyle
+ * @throws WrapperFault
+ */
+ public void genarateWrappers(
+ String targetoutputLocation,
+ String targetImplementationStyle) throws WrapperFault {
+
+ if (targetoutputLocation == null) targetoutputLocation = "genstub";
+
+ perprocess();
+
+ QName serviceqname = serviceentry.getService().getQName();
+ servicename = serviceqname.getLocalPart();
+ this.serviceStyle =bindingEntry.getBindingStyle().getName();
+
+ typeMap = this.getTypeInfo();
+ methods = this.getServiceInfo(this.portTypeEntry.getPortType());
+ this.getWebServiceInfo();
+
+ WebServiceGenarator wsg =
+ WebServiceGenaratorFactory.createWebServiceGenarator(
+ new WebServiceContext(
+ new WrapperInfo(
+ serviceStyle,
+ targetoutputLocation,
+ targetImplementationStyle,
+ transportURI,
+ targetEndpointURI,
+ targetNameSpaceOfWSDL),
+ new ServiceInfo(servicename, qualifiedServiceName, methods),
+ typeMap));
+ if (wsg == null)
+ throw new WrapperFault("does not support the option combination");
+ if(verbose){
+ Iterator it = typeMap.getTypes().iterator();
+ while(it.hasNext()){
+ }
+ }
+ wsg.genarate();
+ }
+
+ /**
+ * This code is taken from the org.apache.axis.wsdl.gen.Parser Class.
+ * WSDL file should have only one service, The first service
+ * find is utilized.
+ * @return
+ * @throws WrapperFault
+ */
+ public ServiceEntry getServiceEntry()throws WrapperFault{
+ Iterator it = symbolTable.getHashMap().values().iterator();
+ while (it.hasNext()) {
+ Vector v = (Vector) it.next();
+ for (int i = 0; i < v.size(); ++i) {
+ SymTabEntry entry = (SymTabEntry) v.elementAt(i);
+
+ if (entry instanceof ServiceEntry) {
+ return (ServiceEntry)entry;
+ }
+ }
+ }
+ throw new WrapperFault("the service does not exists");
+ }
+
+ /**
+ * This method is called when the type is a CollectionType
+ * @param typename
+ * @return
+ * @throws WrapperFault
+ */
+ public Type createTypeInfo(QName typename)throws WrapperFault{
+ TypeEntry type = symbolTable.getType(typename);
+ if(type == null){
+ type = symbolTable.getElement(typename);
+ if(type == null){
+ throw new WrapperFault("["+typename+"]unexpected condition occured " +
+ ".. please inform the axis-dev@apache.org mailing list ASAP");
+
+ }
+ type.getRefType();
+ }
+
+ return createTypeInfo(type);
+ }
+
+ /**
+ * This code is borrowd from the JavaBeanWriter#writeFullConstructor().
+ * @param type
+ * @param targetLanguage
+ * @return
+ */
+ public Type createTypeInfo(TypeEntry type)throws WrapperFault{
+ Type typedata = typeMap.getType(type.getQName());
+
+ if(typedata!= null){
+ //type is a inbild type or a already created type
+ return typedata;
+ }
+
+ System.out.println(
+ "############## the type found =" + type.getQName());
+ typedata =
+ new Type(type.getQName(), type.getName(), true);
+ typeMap.addType(type.getQName(), typedata);
+
+ Node node = type.getNode();
+
+ Vector enumdata = null;
+ if(type.isSimpleType()){
+ enumdata = Utils.getEnumerationBaseAndValues(node,symbolTable);
+ }
+ if(enumdata != null){
+ typedata.setEnumerationdata(enumdata);
+
+ }else if(type instanceof CollectionType){
+ typedata.setTypeNameForElementName(new ElementInfo(type.getQName(),
+ createTypeInfo(type.getRefType().getQName())));
+ typedata.setArray(true);
+ typedata.setCanThisOccuredmoreThanOnceAllTheTime(true);
+ return typedata;
+
+ }else {
+
+ QName arrayType =
+ SchemaUtils.getArrayComponentQName(node, new IntHolder(0));
+
+ if (arrayType != null) {
+ typedata.setTypeNameForElementName(new ElementInfo(new QName("item"),
+ createTypeInfo(arrayType)));
+ typedata.setArray(true);
+ } else if (
+ (arrayType = SchemaUtils.getCollectionComponentQName(node))
+ != null) {
+ typedata.setTypeNameForElementName(new ElementInfo(new QName("item"),
+ createTypeInfo(arrayType)));
+ typedata.setArray(true);
+ }
+
+ //Note in a array the parameter type is stored as under the name item all the time
+ else {
+
+ Vector extendList = new Vector();
+ extendList.add(type);
+ TypeEntry parent = SchemaUtils.getComplexElementExtensionBase(
+ type.getNode(),symbolTable);
+ while(parent != null) {
+ extendList.add(parent);
+ parent = SchemaUtils.getComplexElementExtensionBase(
+ parent.getNode(),symbolTable);
+ }
+
+ // Now generate a list of names and types starting with
+ // the oldest parent. (Attrs are considered before elements).
+ for (int i=extendList.size()-1; i >= 0; i--) {
+
+ TypeEntry te = (TypeEntry) extendList.elementAt(i);
+
+ String mangle = "";
+
+ // Process the attributes
+ Vector attributes = SchemaUtils.getContainedAttributeTypes(
+ te.getNode(), symbolTable);
+ if (attributes != null) {
+ for (int j=0; j<attributes.size(); j+=2) {
+ typedata.setTypeForAttributeName(
+ ((QName)attributes.get(j + 1)).getLocalPart(),
+ createTypeInfo(((TypeEntry) attributes.get(j)).getQName()));
+ }
+ }
+ // Process the elements
+ Vector elements = SchemaUtils.getContainedElementDeclarations(
+ te.getNode(), symbolTable);
+ if (elements != null) {
+
+ for (int j=0; j<elements.size(); j++) {
+
+ ElementDecl elem = (ElementDecl)elements.get(j);
+ QName typeName = elem.getType().getQName();
+
+ if(typeName.getLocalPart().indexOf('[')>0){
+ String localpart = typeName.getLocalPart().substring(0,typeName.getLocalPart().indexOf('['));
+ typeName = new QName(typeName.getNamespaceURI(),localpart);
+
+ }
+
+ ElementInfo eleinfo = new ElementInfo(elem.getName(),createTypeInfo(typeName));
+
+ eleinfo.setMaxOccurs(elem.getMaxOccurs());
+ typedata.setTypeNameForElementName(eleinfo);
+ }
+ }
+ }
+ }
+ }
+ return typedata;
+ }
+
+ /**
+ * Fault information got from the service is mapped
+ * @param faults
+ * @param methodinfo
+ * @throws WrapperFault
+ */
+ private void addFaultInfo(Map faults,MethodInfo methodinfo)throws WrapperFault{
+ if(faults == null)
+ return;
+ Iterator faultIt = faults.values().iterator();
+ while(faultIt.hasNext()){
+ Fault fault = (Fault)faultIt.next();
+ FaultInfo faultinfo = new FaultInfo(fault.getName());
+ Map parts = fault.getMessage().getParts();
+ Iterator partIt = parts.values().iterator();
+ while(partIt.hasNext()){
+ faultinfo.addParam(createParameterInfo((Part)partIt.next()));
+ }
+ }
+
+ }
+
+ /**
+ * Method for creating parameter info
+ * @param part
+ * @return
+ * @throws WrapperFault
+ */
+ private ParameterInfo createParameterInfo(Part part)throws WrapperFault{
+ QName qname = part.getTypeName();
+ if(qname == null){
+ Element element = symbolTable.getElement(part.getElementName());
+ qname = element.getRefType().getQName();
+ }
+ TypeEntry tentry = symbolTable.getType(qname);
+
+ Type type = this.typeMap.getType(qname);
+ if(type == null)
+ throw new WrapperFault("unregisterd type "+qname+" refered");
+
+ ParameterInfo parainfo =
+ new ParameterInfo(type,part.getName());
+ parainfo.setElementName(part.getElementName());
+ return parainfo;
+ }
+
+ /**
+ * Method for getting method info
+ * @param name
+ * @return
+ * @throws WrapperFault
+ */
+ private MethodInfo getMethodInfoByName(String name)throws WrapperFault{
+ for(int i = 0; i < methods.size();i++){
+ if(((MethodInfo)methods.get(i)).getMethodname().equals(name))
+ return (MethodInfo)methods.get(i);
+ }
+ throw new WrapperFault("binding and the port type do not match");
+ }
+
+ /**
+ * Usage
+ * =====
+ * java WSDL2WS_J2ME <wsdlfile> -<optionChar><value>
+ *
+ * Options and Values
+ * ======= === ======
+ * -o target output folder
+ *
+ * @param args
+ * @throws Exception
+ */
+ public static void main(String[] args) throws Exception {
+ CLArgParser data = new CLArgParser(args);
+ System.out.println(data.getArgumentCount());
+
+ if (data.getArgumentCount() != 1)
+ System.out.println(
+ "java WSDL2ws <wsdlfile> -<optionChar><value>\n"
+ + "-o target output folder - default is current folder\n" );
+ else {
+ WSDL2Ws gen = new WSDL2Ws(data);
+ gen.genarateWrappers(
+ data.getParameterValueBykey("o"),
+ data.getParameterValueBykey("i"));
+ }
+ }
+}