[xsd-users] How to serialize the xsd schema to output Soap protocol

Ngu, Henry C henry_c.ngu at lamrc.com
Fri Oct 19 18:51:37 EDT 2007


Hi:

    Being new to the Soap serializer and Schema, I have question
regarding how to apply the class generated from XSD files.

    From *.cxx and *.hxx where I had 2 classes 

 

class E132HeaderType_pskel: public virtual ::xml_schema::complex_content

class EstablishSessionRequestType_pskel: public virtual
::xml_schema::complex_content

 

How do I apply the above classes to the header and body, so that I don't
need to write each line of serializer code as below ?

 

void CallECCEEstablishSession(_bstr_t from, _bstr_t to)

{

   ISoapSerializerPtr Serializer;

   ISoapReaderPtr Reader;

   ISoapConnectorPtr Connector;

 

   // Connect to the service

   Connector.CreateInstance(__uuidof(HttpConnector30));

   Connector->Property["EndPointURL"] =
"http://a118661:8079/SessionManager";

   Connector->Connect();

 

   // Begin message

   Connector->Property["SoapAction"] =
"urn:semi-org:ws.E132-1.V0305.SessionManagerBinding:EstablishSession";

   Connector->BeginMessage();

 

   // Create the SoapSerializer

   Serializer.CreateInstance(__uuidof(SoapSerializer30));

 

   // Connect the serializer to the input stream of the connector

   Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));

 

   Serializer->StartEnvelope("","","");

   Serializer->StartHeader("");

 
Serializer->StartElement("E132Header","urn:semi-org:xsd.E132-1.V0305.aut
h","","");

 
Serializer->StartElement("SessionID","urn:semi-org:xsd.E132-1.V0305.auth
","","");

   Serializer->WriteString("");

   Serializer->EndElement();

 
Serializer->StartElement("From","urn:semi-org:xsd.E132-1.V0305.auth","",
"");

   Serializer->WriteString(from);

   Serializer->EndElement();

 
Serializer->StartElement("To","urn:semi-org:xsd.E132-1.V0305.auth","",""
);

   Serializer->WriteString(to);

   Serializer->EndElement();

   Serializer->EndElement();

   Serializer->EndHeader();

 

   Serializer->StartBody("");

 
Serializer->StartElement("EstablishSessionRequest","urn:semi-org:xsd.E13
2-1.V0305.auth","","");

 
Serializer->StartElement("EndPoint","urn:semi-org:xsd.E132-1.V0305.auth"
,"","");

 
Serializer->StartElement("HTTPEndPoint","urn:semi-org:xsd.E132-1.V0305.a
uth","","");

 
Serializer->StartElement("URL","urn:semi-org:xsd.E132-1.V0305.auth","","
");

 
Serializer->WriteString("http://A118661/ECCEConsumer/ECCEConsumerService
.asmx");

   Serializer->EndElement();

   Serializer->EndElement();

   Serializer->EndElement();

   Serializer->EndElement();

   Serializer->EndBody();

   Serializer->EndEnvelope();

 

   // Send the message to the web service

   Connector->EndMessage();     

} 

 

Thanks

Henry

 




More information about the xsd-users mailing list