00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "wsdlparser/WsdlParser.h"
00023
00024 #ifdef LOGGING
00025
00026 using namespace std;
00027
00028 namespace WsdlPull {
00029
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
00038
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