Author: mmerz
Date: Mon Jan 31 19:02:00 2005
New Revision: 149360

URL: http://svn.apache.org/viewcvs?view=rev&rev=149360
Log:
fixed the BARE/WRAPPED bug in the wsdl processing

Contributor: Daryoush Mehrtash

Modified:
    
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessor.java

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessor.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessor.java?view=diff&r1=149359&r2=149360
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessor.java
 (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessor.java
 Mon Jan 31 19:02:00 2005
@@ -75,7 +75,7 @@
 
/*******************************************************************************
  * An Implementation of WSDLProcessor that uses XmlBeans to convert the WSDL
  * into the WSM Object Model.
- *
+ * 
  * @author Jonathan Colwell
  */
 public class XmlBeanWSDLProcessor implements WSDLProcessor {
@@ -165,42 +165,31 @@
     }
 
     /*
-    public static DefinitionsDocument fromWebServiceMetadata
-            (WebServiceTYPEMetadata wsm)
-            throws Exception {
-        String ns = wsm.getWsTargetNamespace();
-        DefinitionsDocument defDoc = DefinitionsDocument.Factory.newInstance();
-        TDefinitions tDefs = defDoc.addNewDefinitions();
-        TPortType tPT = tDefs.addNewPortType();
-        tPT.setName(wsm.getWsName());
-        TBinding tBind = tDefs.addNewBinding();
-        tBind.setName(tPT.getName() + "Binding");
-        tBind.setType(new QName(ns, tPT.getName()));
-        org.xmlsoap.schemas.wsdl.soap.BindingDocument bindDoc =
-                
org.xmlsoap.schemas.wsdl.soap.BindingDocument.Factory.newInstance();
-        org.xmlsoap.schemas.wsdl.soap.TBinding tSoapBind = bindDoc
-                .addNewBinding();
-        if 
(SOAPBinding.Style.DOCUMENT.equals(wsm.getSoapBinding().getStyle())) {
-            tSoapBind.setStyle(TStyleChoice.DOCUMENT);
-        } else {
-            tSoapBind.setStyle(TStyleChoice.RPC);
-        }
-        tSoapBind.setTransport(TRANSPORT);
-        insertChild(tBind, bindDoc);
-        processMethodMetadata(wsm.getMethods(), tDefs, tPT, tBind, ns);
-        TService tServ = tDefs.addNewService();
-        tServ.setName(wsm.getWsServiceName());
-        TPort tPort = tServ.addNewPort();
-        tPort.setName(wsm.getWsName());
-        tPort.setBinding(new QName(ns, tBind.getName()));
-        org.xmlsoap.schemas.wsdl.soap.AddressDocument addrDoc =
-                
org.xmlsoap.schemas.wsdl.soap.AddressDocument.Factory.newInstance();
-        org.xmlsoap.schemas.wsdl.soap.TAddress tAddr = addrDoc.addNewAddress();
-        tAddr.setLocation("fake://FAKEURL");
-        insertChild(tPort, tAddr);
-        return defDoc;
-    }
-    */
+     * public static DefinitionsDocument fromWebServiceMetadata
+     * (WebServiceTYPEMetadata wsm) throws Exception { String ns =
+     * wsm.getWsTargetNamespace(); DefinitionsDocument defDoc =
+     * DefinitionsDocument.Factory.newInstance(); TDefinitions tDefs =
+     * defDoc.addNewDefinitions(); TPortType tPT = tDefs.addNewPortType();
+     * tPT.setName(wsm.getWsName()); TBinding tBind = tDefs.addNewBinding();
+     * tBind.setName(tPT.getName() + "Binding"); tBind.setType(new QName(ns,
+     * tPT.getName())); org.xmlsoap.schemas.wsdl.soap.BindingDocument bindDoc =
+     * org.xmlsoap.schemas.wsdl.soap.BindingDocument.Factory.newInstance();
+     * org.xmlsoap.schemas.wsdl.soap.TBinding tSoapBind = bindDoc
+     * .addNewBinding(); if
+     * (SOAPBinding.Style.DOCUMENT.equals(wsm.getSoapBinding().getStyle())) {
+     * tSoapBind.setStyle(TStyleChoice.DOCUMENT); } else {
+     * tSoapBind.setStyle(TStyleChoice.RPC); }
+     * tSoapBind.setTransport(TRANSPORT); insertChild(tBind, bindDoc);
+     * processMethodMetadata(wsm.getMethods(), tDefs, tPT, tBind, ns); TService
+     * tServ = tDefs.addNewService(); tServ.setName(wsm.getWsServiceName());
+     * TPort tPort = tServ.addNewPort(); tPort.setName(wsm.getWsName());
+     * tPort.setBinding(new QName(ns, tBind.getName()));
+     * org.xmlsoap.schemas.wsdl.soap.AddressDocument addrDoc =
+     * org.xmlsoap.schemas.wsdl.soap.AddressDocument.Factory.newInstance();
+     * org.xmlsoap.schemas.wsdl.soap.TAddress tAddr = addrDoc.addNewAddress();
+     * tAddr.setLocation("fake://FAKEURL"); insertChild(tPort, tAddr); return
+     * defDoc; }
+     */
 
     private void processTOperation(TOperation op,
                                    Jsr181TypeMetadata wsm,
@@ -226,7 +215,8 @@
             returnType = paraMeta[0].getJavaType();
             returnXMLType = paraMeta[0].getXmlType();
         } else {
-            // either there is no return value or there are multiple so make 
this a 
+            // either there is no return value or there are multiple so make
+            // this a
             // void function and later set OUT parameters if needed.
             returnType=Void.TYPE;
             returnXMLType = null;  
@@ -262,23 +252,36 @@
         
         methodMap.put(opName, wmm);
             
-        List paramOrder = op.getParameterOrder();  // this is the one used by 
rpc wsdls.
+        List paramOrder = op.getParameterOrder();  // this is the one used by
+                                                   // rpc wsdls.
         TParam inputParam = op.getInput();
         if (inputParam != null) {
             
             Jsr181ParameterMetadata[] params = 
                 processParameters(inputParam, types, messageMap, wsm);
                 
-            if (paramOrder != null) {  // walk the parameters according to 
order if they exist.  
-                                                          // note that the 
Jsr181MethodMetadata needs correct order of the parameters (simnilar reflection 
of method).
+            if (paramOrder != null) {  // walk the parameters according to 
order
+                                       // if they exist.
+                                                          // note that the 
Jsr181MethodMetadata
+                                       // needs correct order of the parameters
+                                       // (simnilar reflection of method).
                
-               // TODO:  Paramorder is only used for rpc.  This code should be 
modified so that in/out parameters are all handled in one place.
-               // if there is a paramoder then order the parameters, then all 
the parameters and look at in/out flag.
+               // TODO: Paramorder is only used for rpc. This code should be
+                // modified so that in/out parameters are all handled in one
+                // place.
+               // if there is a paramoder then order the parameters, then all
+                // the parameters and look at in/out flag.
                 for (Object ord : paramOrder) {  
                     for (Jsr181ParameterMetadata wpm : params) {
                         if (ord.equals(wpm.getWpName())) {
                                 
-                            wpm.setWpMode(WebParam.Mode.IN);  //THIUS MAY BE 
BUG... WE NEED TO MAKE SURE TO HANDLE THE OUT PARAMTERS ALSO (like the code for 
below) 
+                            wpm.setWpMode(WebParam.Mode.IN);  //THIUS MAY BE
+                                                              // BUG... WE NEED
+                                                              // TO MAKE SURE 
TO
+                                                              // HANDLE THE OUT
+                                                              // PARAMTERS ALSO
+                                                              // (like the code
+                                                              // for below)
                             wmm.addParam(wpm);
                             break;
                         }
@@ -287,10 +290,15 @@
             }        
             else if (params.length > 0) {
                 for (Jsr181ParameterMetadata wpm : params) {
-                    // FIXME [EMAIL PROTECTED] 2005-Jan-04 -- 
+                    // FIXME [EMAIL PROTECTED] 2005-Jan-04 --
                     // Double check DOC/Lit rules
                     if (outParamMap != null && 
outParamMap.containsKey(wpm.getWpName())) {
-                        outParamMap.remove(wpm.getWpName());  // important... 
if this param is in.out it was in the out list also, so remove it.
+                        outParamMap.remove(wpm.getWpName());  // important... 
if
+                                                              // this param is
+                                                              // in.out it was
+                                                              // in the out 
list
+                                                              // also, so 
remove
+                                                              // it.
                         wpm.setWpMode(WebParam.Mode.INOUT);
                     }
                     else {
@@ -318,15 +326,13 @@
             
         List<Jsr181ParameterMetadata> params = wmm.getParams();
         /*
-          System.out.println("adding method " + wmm.getWmOperationName() 
-          + " returning " + wmm.getJavaReturnType()
-          + " with the following " + params.size() 
-          + " parameters");
-
-          for (Jsr181ParameterMetadata wpm : params) {
-          System.out.println(wpm.getWpName() + ':' + wpm.getJavaType());
-          }
-        */   
+         * System.out.println("adding method " + wmm.getWmOperationName() + "
+         * returning " + wmm.getJavaReturnType() + " with the following " +
+         * params.size() + " parameters");
+         * 
+         * for (Jsr181ParameterMetadata wpm : params) {
+         * System.out.println(wpm.getWpName() + ':' + wpm.getJavaType()); }
+         */   
         wsm.addMethod(wmm);
         
     }
@@ -348,38 +354,81 @@
 
             
                 QName paramXmlType;                
-                if (messagePart.isSetElement()) { // if element attribute is 
set we are looking at document style 
-                                                     // in case of rpc message 
part would look something like: <part name="key" type="xsd:string"/>
-                                                     // otherwise it case of 
document it looks liek <part element="xxxx" name="parameters">
-                       // we know we are document, and thus literal.  and most 
likely using xml beans, but can use axis too.
+                if (messagePart.isSetElement()) { // if element attribute is 
set
+                                                  // we are looking at document
+                                                  // style
+                                                     // in case of rpc message 
part
+                                                  // would look something like:
+                                                  // <part name="key"
+                                                  // type="xsd:string"/>
+                                                     // otherwise it case of
+                                                  // document it looks liek
+                                                  // <part element="xxxx"
+                                                  // name="parameters">
+                       // we know we are document, and thus literal. and most
+                    // likely using xml beans, but can use axis too.
                     QName element = messagePart.getElement();
-                    Class javaType = getTypeMappingUtil().q2Class(element);  
// in case of xml beans (or other registered types) we don't need to dig any 
further
-                    if (Object.class.equals(javaType)) {  // if q2class fails, 
it reutrns an object.  
-                       // we know  document, literal, there are no reguistered 
types for the messasge.
-                       // system needs to wrap/unwrap the messages.  Thus the 
method metadata must reflect this.
-                       
+                    Class javaType = getTypeMappingUtil().q2Class(element); 
+                    // in case of xmlbeans(or other registered types) we don't 
need
+                    // to dig any further
+                    String name = messagePart.getName();
+                    if (0 == "parameters".compareTo(name)) {  
+                        // if q2class fails,it reutrns an object.
+                       // we know document, literal, there are no reguistered
+                        // types for the messasge.
+                       // system needs to wrap/unwrap the messages. Thus the
+                        // method metadata must reflect this.
+                       // Also if name="parameters" we need to unwarp the 
message/
+                        
+
                        
-                        if (types != null) {  // if there are some type 
sections.   
+                        if (types != null) {  // if there are some type
                             try {
                                 Schema[] schemas = selectChildren(types,
-                                                                  
Schema.class);  // We are looking at schemas that are defined in this schema.
-                                                                               
   //---- THIS WOULD NOT RECOGNIZE IMPORTED SCHEMAS.
+                                                                  
Schema.class); 
+                                // We are  looking at schemas that are defined 
in
+                               // this schema.
+                               //----  // THIS WOULD NOT RECOGNIZE IMPORTED 
SCHEMAS.
 
                                 for (Schema s : schemas) {
                                     if (s.getTargetNamespace()
-                                        .equals(element.getNamespaceURI())) {  
// if namespace matched the element.
+                                        .equals(element.getNamespaceURI())) {  
// if
+                                                                               
// namespace
+                                                                               
// matched
+                                                                               
// the
+                                                                               
// element.
                                         Element[] elements = 
s.getElementArray();
                                         for (Element e : elements) {
                                             if (e.getName()
                                                 
.equals(element.getLocalPart())) {
                                          
-                                                if (e.isSetType()) {  // 
simple type, element has name and type in same node for complex type it is only
-                                                                         // 
name  and type is defined as <complexType> child./
+                                                if (e.isSetType()) {  // simple
+                                                                      // type,
+                                                                      // 
element
+                                                                      // has
+                                                                      // name
+                                                                      // and
+                                                                      // type 
in
+                                                                      // same
+                                                                      // node
+                                                                      // for
+                                                                      // 
complex
+                                                                      // type 
it
+                                                                      // is 
only
+                                                                      // name
+                                                                      // and
+                                                                      // type 
is
+                                                                      // 
defined
+                                                                      // as
+                                                                      // 
<complexType>
+                                                                      // 
child./
                                                     Jsr181ParameterMetadata 
wpm =
                                                         new 
Jsr181ParameterMetadataImpl();
                                          
                                                     wpm.setWpName(e.getName());
-                                                    // FIXME [EMAIL PROTECTED] 
2004-Nov-09 -- double check the namespace stuff
+                                                    // FIXME [EMAIL PROTECTED]
+                                                    // 2004-Nov-09 -- double
+                                                    // check the namespace 
stuff
                                                     wpm.setWpTargetNamespace
                                                         
(s.getTargetNamespace());
                                                     QName type = e.getType();
@@ -388,31 +437,53 @@
                                                                     
.q2Class(type));
 
                                                     /*
-                                                    
System.out.println(wpm.getWpName()
-                                                                       + " of 
type "
-                                                                       + 
wpm.getJavaType());
-                                                    */
+                                                     * 
System.out.println(wpm.getWpName() + " of
+                                                     * type " + 
wpm.getJavaType());
+                                                     */
                                                     paramList.add(wpm);
                                                 }
                                                 else {
-                                                       // we have <element 
name=xxx> and its child must be comlexType, or somethig is wrong
+                                                    // we have <element
+                                                    // name=xxx> and its child
+                                                    // must be comlexType, or
+                                                    // somethig is wrong
 
                                                     ComplexType ct = 
e.getComplexType();
                                                     if (ct != null
                                                         && ct.isSetSequence()) 
{
                                                         // DOC/LIT WSDL
-                                                        Group g = 
ct.getSequence();  // NOTE there may other groupings also here (e.g. for arrays)
-                                                                               
      // that we are not handling correctly.
-                                                               // its child is 
either <element name="xxxx" type="xxx" /> or 
-                                                       //<element ref="xxx />
+                                                        Group g = 
ct.getSequence();  // NOTE
+                                                                               
      // there
+                                                                               
      // may
+                                                                               
      // other
+                                                                               
      // groupings
+                                                                               
      // also
+                                                                               
      // here
+                                                                               
      // (e.g.
+                                                                               
      // for
+                                                                               
      // arrays)
+                                                                               
      // that
+                                                                               
      // we
+                                                                               
      // are
+                                                                               
      // not
+                                                                               
      // handling
+                                                                               
      // correctly.
+                                                        // its child is
+                                                           // either <element
+                                                           // name="xxxx"
+                                                           // type="xxx" /> or
+                                                        //<element ref="xxx />
 
                                                         for (Element el : 
g.getElementArray()) {
 
                                                             
Jsr181ParameterMetadata wpm =
                                                                 new 
Jsr181ParameterMetadataImpl();
 
-                                                            // FIXME [EMAIL 
PROTECTED] 2004-Nov-09
-                                                            // double check 
the namespace stuff
+                                                            // FIXME
+                                                            // [EMAIL 
PROTECTED]
+                                                            // 2004-Nov-09
+                                                            // double check the
+                                                            // namespace stuff
                                                             
wpm.setWpTargetNamespace
                                                                 
(s.getTargetNamespace());
 
@@ -425,25 +496,26 @@
                                                                 
wpm.setXmlType(type);
                                                                 
wpm.setJavaType(getTypeMappingUtil().q2Class(type));
                                                                 /*
-                                                                
System.out.println(wpm
-                                                                               
    .getWpName()
-                                                                               
    + " of type "
-                                                                               
    + wpm.getJavaType());
-                                                                */
+                                                                 * 
System.out.println(wpm
+                                                                 * 
.getWpName() + " of type " +
+                                                                 * 
wpm.getJavaType());
+                                                                 */
                                                                 
paramList.add(wpm);
                                                             }
                                                             else if 
(el.isSetRef()) {
                                                                 QName ref = 
el.getRef();
                                                                 /*
-                                                                
System.out.println
-                                                                ("ref is set 
to: " + ref);*/
+                                                                 * 
System.out.println ("ref is set
+                                                                 * to: " + 
ref);
+                                                                 */
                                                                 
wpm.setWpName(ref.getLocalPart());
                                                                 
wpm.setXmlType(ref);
                                                                 Class cl = 
getTypeMappingUtil()
                                                                     
.q2Class(ref);
-                                                                
/*System.out.println
-                                                                    
("resulting java type: " +
-                                                                    
cl.getName());*/
+                                                                /*
+                                                                 * 
System.out.println ("resulting
+                                                                 * java type: 
" + cl.getName());
+                                                                 */
                                                                 
wpm.setJavaType(cl);
 
                                                                 
paramList.add(wpm);
@@ -460,10 +532,12 @@
                             }
                             catch (Exception e) {
                                 e.printStackTrace();
-                            }
-                        }
+                            }                      }
                     }
-                    else {  // if we did find object form qname.  also we know 
that there are xml-aware classes that can decode the xml we let them do the 
+                    else {  
+                        // if we did find object form qname. also we know
+                            // that there are xml-aware classes that can decode
+                            // the xml we let them do the
                        // processing.
 
                         // NOTE [EMAIL PROTECTED] 2005-Jan-07 -- Doc/Lit Bare
@@ -482,16 +556,16 @@
                 else {  // this is an rpc and with no element attribute
                     Jsr181ParameterMetadata wpm =
                         new Jsr181ParameterMetadataImpl();
-                    // FIXME [EMAIL PROTECTED] 2004-Nov-09 -- figure out where 
RPC parameter namespaces should be specified in the WSDL.
+                    // FIXME [EMAIL PROTECTED] 2004-Nov-09 -- figure out where
+                    // RPC parameter namespaces should be specified in the 
WSDL.
                     wpm.setWpTargetNamespace(wsm.getWsTargetNamespace());
                     wpm.setWpName(messagePart.getName());
                     QName type = messagePart.getType();
                     wpm.setXmlType(type);
                     wpm.setJavaType(getTypeMappingUtil().q2Class(type));
                     /*
-                    System.out.println(wpm.getWpName()
-                                       + " of type "
-                                       + wpm.getJavaType());
+                     * System.out.println(wpm.getWpName() + " of type " +
+                     * wpm.getJavaType());
                      */
                     paramList.add(wpm);
                 }
@@ -502,6 +576,14 @@
         return new Jsr181ParameterMetadata[0];
     }
 
+    /**
+     * @param types
+     */
+    private void doUnknownTypes(TTypes types) {
+        // sections.
+
+    }
+
     private void processTBinding(TBinding tBind,
                                  Jsr181TypeMetadata wsm)
         throws IllegalAccessException, NoSuchFieldException {
@@ -555,127 +637,81 @@
     }
 
     /*
-    private static void processMethodMetadata
-            (Collection<WebServiceMETHODMetadata> methods,
-             TDefinitions defs,
-             TPortType portType,
-             TBinding bind,
-             String namespace) {
-        for (WebServiceMETHODMetadata op : methods) {
-            String operationName = op.getWmOperationName();
-            String request = operationName + "Request";
-            String response = operationName + "Response";
-            TMessage tMsg = defs.addNewMessage();
-            tMsg.setName(request);
-            List<String> paramOrder = new ArrayList<String>();
-            processParameterMetadata(op.getParams(), paramOrder, tMsg);
-            if (!op.isOneWay()) {
-                tMsg = defs.addNewMessage();
-                tMsg.setName(response);
-                TPart tPart = tMsg.addNewPart();
-                tPart.setName(op.getWrName());
-                tPart.setType(class2QName(op.getJavaReturnType()));
-                //tPart.setElement(new QName("some", "element");
-            }
-            TOperation tOp = portType.addNewOperation();
-            tOp.setName(operationName);
-            tOp.setParameterOrder(paramOrder);
-            TParam input = tOp.addNewInput();
-            TParam output = tOp.addNewOutput();
-            input.setName(request);
-            input.setMessage(new QName(namespace, request));
-            if (!op.isOneWay()) {
-                output.setName(response);
-                output.setMessage(new QName(namespace, response));
-            }
-            processBindingOperationMetadata(bind.addNewOperation(),
-                    op,
-                    namespace,
-                    operationName,
-                    request,
-                    response);
-        }
-    }
-
-    private static void processParameterMetadata
-            (Collection<WebServicePARAMETERMetadata> params,
-             List<String> paramOrder,
-             TMessage msg) {
-        for (WebServicePARAMETERMetadata param : params) {
-            TPart tPart = msg.addNewPart();
-            tPart.setName(param.getWpName());
-            tPart.setType(class2QName(param.getJavaType()));
-            paramOrder.add(param.getWpName());
-        }
-    }
-
-    private static void processBindingOperationMetadata(TBindingOperation tBop,
-                                                        
WebServiceMETHODMetadata op,
-                                                        String namespace,
-                                                        String operationName,
-                                                        String request,
-                                                        String response) {
-        tBop.setName(operationName);
-        org.xmlsoap.schemas.wsdl.soap.OperationDocument opDoc =
-                org.xmlsoap.schemas.wsdl.soap.OperationDocument.Factory
-                .newInstance();
-        org.xmlsoap.schemas.wsdl.soap.TOperation tSoapOperation =
-                opDoc.addNewOperation();
-        tSoapOperation.setSoapAction(op.getWmAction());
-//        SOAPBindingInfo sb = op.getSoapBinding();
-//        if (sb != null && SOAPBinding.Style.DOCUMENT.equals(sb.getStyle())) {
-//            tSoapOperation.setStyle(TStyleChoice.DOCUMENT);
-//        }
-//        else {
-//            tSoapOperation.setStyle(TStyleChoice.RPC);
-//        }
-        insertChild(tBop, opDoc);
-        TBindingOperationMessage inBom = tBop.addNewInput();
-        TBindingOperationMessage outBom = tBop.addNewOutput();
-        inBom.setName(request);
-        outBom.setName(response);
-    */
+     * private static void processMethodMetadata (Collection
+     * <WebServiceMETHODMetadata> methods, TDefinitions defs, TPortType
+     * portType, TBinding bind, String namespace) { for
+     * (WebServiceMETHODMetadata op : methods) { String operationName =
+     * op.getWmOperationName(); String request = operationName + "Request";
+     * String response = operationName + "Response"; TMessage tMsg =
+     * defs.addNewMessage(); tMsg.setName(request); List <String> paramOrder =
+     * new ArrayList <String>(); processParameterMetadata(op.getParams(),
+     * paramOrder, tMsg); if (!op.isOneWay()) { tMsg = defs.addNewMessage();
+     * tMsg.setName(response); TPart tPart = tMsg.addNewPart();
+     * tPart.setName(op.getWrName());
+     * tPart.setType(class2QName(op.getJavaReturnType()));
+     * //tPart.setElement(new QName("some", "element"); } TOperation tOp =
+     * portType.addNewOperation(); tOp.setName(operationName);
+     * tOp.setParameterOrder(paramOrder); TParam input = tOp.addNewInput();
+     * TParam output = tOp.addNewOutput(); input.setName(request);
+     * input.setMessage(new QName(namespace, request)); if (!op.isOneWay()) {
+     * output.setName(response); output.setMessage(new QName(namespace,
+     * response)); } processBindingOperationMetadata(bind.addNewOperation(), 
op,
+     * namespace, operationName, request, response); } }
+     * 
+     * private static void processParameterMetadata (Collection
+     * <WebServicePARAMETERMetadata> params, List <String> paramOrder, TMessage
+     * msg) { for (WebServicePARAMETERMetadata param : params) { TPart tPart =
+     * msg.addNewPart(); tPart.setName(param.getWpName());
+     * tPart.setType(class2QName(param.getJavaType()));
+     * paramOrder.add(param.getWpName()); } }
+     * 
+     * private static void processBindingOperationMetadata(TBindingOperation
+     * tBop, WebServiceMETHODMetadata op, String namespace, String
+     * operationName, String request, String response) {
+     * tBop.setName(operationName);
+     * org.xmlsoap.schemas.wsdl.soap.OperationDocument opDoc =
+     * org.xmlsoap.schemas.wsdl.soap.OperationDocument.Factory .newInstance();
+     * org.xmlsoap.schemas.wsdl.soap.TOperation tSoapOperation =
+     * opDoc.addNewOperation(); 
tSoapOperation.setSoapAction(op.getWmAction()); //
+     * SOAPBindingInfo sb = op.getSoapBinding(); // if (sb != null &&
+     * SOAPBinding.Style.DOCUMENT.equals(sb.getStyle())) { //
+     * tSoapOperation.setStyle(TStyleChoice.DOCUMENT); // } // else { //
+     * tSoapOperation.setStyle(TStyleChoice.RPC); // } insertChild(tBop, 
opDoc);
+     * TBindingOperationMessage inBom = tBop.addNewInput();
+     * TBindingOperationMessage outBom = tBop.addNewOutput();
+     * inBom.setName(request); outBom.setName(response);
+     */
         /*
-         * NOTE [EMAIL PROTECTED] 2004-Aug-31 --  Using the same body 
-         * for both the input and output, this may need to be changed.
+         * NOTE [EMAIL PROTECTED] 2004-Aug-31 -- Using the same body for both 
the
+         * input and output, this may need to be changed.
          */
     /*
-        org.xmlsoap.schemas.wsdl.soap.BodyDocument bodDoc =
-                
org.xmlsoap.schemas.wsdl.soap.BodyDocument.Factory.newInstance();
-        org.xmlsoap.schemas.wsdl.soap.TBody tBod = bodDoc.addNewBody();
-            
-//        if (sb != null && SOAPBinding.Use.LITERAL.equals(sb.getUse())) {
-//            tBod.setUse(UseChoice.LITERAL);
-//        }
-//        else {
-//            tBod.setUse(UseChoice.ENCODED);
-//        }
+     * org.xmlsoap.schemas.wsdl.soap.BodyDocument bodDoc =
+     * org.xmlsoap.schemas.wsdl.soap.BodyDocument.Factory.newInstance();
+     * org.xmlsoap.schemas.wsdl.soap.TBody tBod = bodDoc.addNewBody(); // if 
(sb !=
+     * null && SOAPBinding.Use.LITERAL.equals(sb.getUse())) { //
+     * tBod.setUse(UseChoice.LITERAL); // } // else { //
+     * tBod.setUse(UseChoice.ENCODED); // }
      */
         /*
-         * NOTE [EMAIL PROTECTED] 2004-Aug-31 -- not sure what parts 
-         * get set here.
+         * NOTE [EMAIL PROTECTED] 2004-Aug-31 -- not sure what parts get set
+         * here.
          */
         // tBod.setParts(?);
     /*
-        tBod.setNamespace(namespace);
-        List<String> encodingStyles = new ArrayList<String>();
-        encodingStyles.add(SOAPENCODING);
-        tBod.setEncodingStyle(encodingStyles);
-        insertChild(inBom, bodDoc);
-        insertChild(outBom, bodDoc);
-    }
-    
-
-    public static boolean insertChild(XmlObject parent, XmlObject child) {
-        // might need to use copyXmlContents() instead if copyXml copies too 
much
-        XmlCursor kidCursor = child.newCursor();
-        XmlCursor parentCursor = parent.newCursor();
-        parentCursor.toFirstContentToken();
-        //parentCursor.toNextToken();
-        kidCursor.toNextToken();
-        return kidCursor.copyXml(parentCursor);
-    }
-    */
+     * tBod.setNamespace(namespace); List <String> encodingStyles = new
+     * ArrayList <String>(); encodingStyles.add(SOAPENCODING);
+     * tBod.setEncodingStyle(encodingStyles); insertChild(inBom, bodDoc);
+     * insertChild(outBom, bodDoc); }
+     * 
+     * 
+     * public static boolean insertChild(XmlObject parent, XmlObject child) { 
//
+     * might need to use copyXmlContents() instead if copyXml copies too much
+     * XmlCursor kidCursor = child.newCursor(); XmlCursor parentCursor =
+     * parent.newCursor(); parentCursor.toFirstContentToken();
+     * //parentCursor.toNextToken(); kidCursor.toNextToken(); return
+     * kidCursor.copyXml(parentCursor); }
+     */
 
     public Jsr181TypeMetadata loadWebServiceMetadataFromWSDL
             (String wsdlLocation)
@@ -756,15 +792,18 @@
         else {
             element = st.getName();
         }
-        /*System.out.println("Selecting children " + element +" of class " 
-          + st.getJavaClass()); */
+        /*
+         * System.out.println("Selecting children " + element +" of class " +
+         * st.getJavaClass());
+         */
         XmlObject[] kids = parent.selectChildren(element);
       
         T[] castKids = (T[]) Array.newInstance(childClass, kids.length);
         for (int j = 0; j < castKids.length; j++) {
 
             if (!st.getJavaClass().isAssignableFrom(kids[j].getClass())) {
-                //System.out.println("before typechange " + 
kids[j].getClass());
+                //System.out.println("before typechange " +
+                // kids[j].getClass());
                 kids[j] = kids[j].changeType(st);
                 //System.out.println("after typechange " + kids[j].getClass());
             }


Reply via email to