WsdlDebug.cpp

Go to the documentation of this file.
00001 /* 
00002  * wsdlpull - A C++ parser  for Wsdl  (Web services description language)
00003  * Copyright (C) 2005-2007 Vivek Krishna
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public
00016  * License along with this library; if not, write to the Free
00017  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  *
00019  *
00020  */
00021 
00022 #include "wsdlparser/WsdlParser.h"
00023 
00024 #ifdef LOGGING
00025 
00026 using namespace std;
00027 
00028 namespace WsdlPull {
00029 // just print all the stuff,for debugging
00030 void  WsdlParser::print(std::ostream & out)
00031 {
00032   Binding *bn = bindings_.front();
00033   int i = 0, soapBindingId, inId, outId, faultId;
00034   int numOps = bn->numOps();
00035 
00036   /*
00037     Print all the  operations and messages and then the types of
00038     the Schema Parser
00039   */
00040   for (i = 0; i < getNumSchemas(); i++)
00041     schemaParser_[i]->print(out);
00042   i = 0;
00043   while (i < numOps)
00044     {
00045       const int *bindings = 0;
00046       int n = 0;
00047       n = bn->getOpBinding(i, bindings);
00048       soapBindingId = bindings[0];
00049       n = bn->getInputBinding(i, bindings);
00050       inId = bindings[0];
00051       n = bn->getOutputBinding(i, bindings);
00052       outId = bindings[0];
00053       n = bn->getFaultBinding(i, bindings);
00054       faultId = bindings[0];
00055       const Operation *op = bn->getOperation(i);
00056       out << op->getName() << endl;
00057       const Message *inMessage = op->getMessage(Input);
00058       const Message *outMessage = op->getMessage(Output);
00059       int nParams = 0, j = 0;
00060       int typeId = 0,schemaId;
00061       const XSDType *pType = 0;
00062       nParams = inMessage->getNumParts();
00063       for (j = 0; j < nParams; j++)
00064         {
00065           if (inMessage->getPartRefType(j) == Part::Elem)
00066             {
00067               
00068               typeId = inMessage->getPartType(j);
00069               pType = schemaParser_[schemaId]->getType(typeId);
00070 
00071               if (!pType->isSimple())
00072                 {
00073                   ComplexType * cType = (ComplexType *) pType;
00074 
00075                   ContentModel::ContentsIterator cit_b=cType->getContents()->begin();
00076                   ContentModel::ContentsIterator cit_e=cType->getContents()->end();
00077                   ContentModel::ContentsIterator ci=cit_b;
00078   
00079                   for (ci=cit_b;ci!=cit_e;ci++){
00080                     if(ci->second==ContentModel::Particle){
00081                       out<<ci->first.e->getName()<< ":" <<
00082                         ci->first.e->getType();
00083                     }
00084                   }
00085                  
00086                 }
00087             }
00088 
00089           else
00090             out << inMessage->getPartName(j) << ":" << inMessage->
00091               getPartType(j) << XmlUtils::dbsp;
00092         }
00093       out << endl;
00094       nParams = outMessage->getNumParts();
00095       for (j = 0; j < nParams; j++)
00096         {
00097           if (outMessage->getPartRefType(j) == Part::Elem)
00098             {
00099 
00100               const Element * e =outMessage->getPartElement(j);
00101               out << e->getName() << ":" << e->getType() << XmlUtils::dbsp;
00102             }
00103 
00104           else
00105             out << outMessage->getPartName(j) << ":" << outMessage->
00106               getPartType(j) << XmlUtils::dbsp;
00107         }
00108       out << XmlUtils::blk;
00109       i++;
00110     }
00111 }
00112 }
00113 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by  doxygen 1.6.2