00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "Types.h"
00023 #include "Wsdl.h"
00024 #include "Application.h"
00025 #include "WsdlException.h"
00026 #include <Sockets/Debug.h>
00027
00028
00029 Types::Types(const Application& appl, const Wsdl& wsdl)
00030 : m_appl(appl)
00031 , m_wsdl(wsdl)
00032 {
00033 }
00034
00035
00036 Types::~Types()
00037 {
00038 }
00039
00040
00041 void Types::display(const std::string& name, const Xml::XmlNode& node)
00042 {
00043 printf(" %s %s", name.c_str(), node.GetProperty("type").c_str());
00044 if (node.PropertyExists("minOccurs"))
00045 printf(" minOccurs %s", node.GetProperty("minOccurs").c_str());
00046 if (node.PropertyExists("maxOccurs"))
00047 printf(" maxOccurs %s", node.GetProperty("maxOccurs").c_str());
00048
00049
00050 printf("\n");
00051 }
00052
00053
00054 void Types::generate()
00055 {
00056 std::list<std::string> ops = m_wsdl.GetOperations( m_appl.Portname() );
00057
00058 for (std::list<std::string>::iterator it = ops.begin(); it != ops.end(); it++)
00059 {
00060 std::string op = *it;
00061
00062 printf("Operation: %s\n", op.c_str());
00063 printf("SOAPaction: %s\n", m_wsdl.GetSoapAction(m_appl.Portname(), op).c_str());
00064
00065 std::string in;
00066 std::string out;
00067 std::string path;
00068 try {
00069 in = m_wsdl.GetMessage(m_appl.Portname(), op, "input");
00070 } catch (const WsdlException&) {}
00071 if (!in.empty())
00072 {
00073 std::list<std::pair<std::string, Xml::XmlNode> > vec = m_wsdl.GetMessageParameters(in, path);
00074 printf("Input: %s\nPath: %s\n", in.c_str(), path.c_str());
00075 for (std::list<std::pair<std::string, Xml::XmlNode> >::iterator it = vec.begin(); it != vec.end(); it++)
00076 {
00077 display(it -> first, it -> second);
00078 }
00079 }
00080 try {
00081 out = m_wsdl.GetMessage(m_appl.Portname(), op, "output");
00082 } catch (const WsdlException&) {}
00083 if (!out.empty())
00084 {
00085 std::list<std::pair<std::string, Xml::XmlNode> > vec = m_wsdl.GetMessageParameters(out, path);
00086 printf("Output: %s\nPath: %s\n", out.c_str(), path.c_str());
00087 for (std::list<std::pair<std::string, Xml::XmlNode> >::iterator it = vec.begin(); it != vec.end(); it++)
00088 {
00089 display(it -> first, it -> second);
00090 }
00091 }
00092
00093 printf("\n");
00094 }
00095 }
00096
00097