Loading ...
Sorry, an error occurred while loading the content.

HELP!!!Why does MS SOAP Toolkit3.0 build these bad XML for me????

Expand Messages
  • snowlovingboy
    The tool i used is MS SOAP Toolkit3.0 and MS VC++6.0, The platform if MS WindoswXP+SP2. Below is the source code : #include #import msxml4.dll
    Message 1 of 1 , Jan 16, 2005
    • 0 Attachment
      The tool i used is MS SOAP Toolkit3.0 and MS VC++6.0, The platform
      if MS WindoswXP+SP2. Below is the source code :

      #include <stdio.h>
      #import "msxml4.dll"
      using namespace MSXML2;
      #import "C:\Program Files\Common Files\MSSoap\Binaries\mssoap30.dll"
      ("IStream", "IErrorInfo", "ISequentialStream", "_LARGE_INTEGER", \

      using namespace MSSOAPLib30;
      void Get()
      HRESULT hr;

      ISoapSerializerPtr Serializer;
      ISoapReaderPtr Reader;
      ISoapConnectorPtr Connector;
      // Connect to the service.
      hr = Connector.CreateInstance(__uuidof(HttpConnector30));
      Connector->Property["EndPointURL"] =
      hr = Connector->Connect();

      // Begin the message.
      Connector->Property["SoapAction"] =
      hr = Connector->BeginMessage();

      // Create the SoapSerializer object.
      hr = Serializer.CreateInstance(__uuidof(SoapSerializer30));

      // Connect the serializer object to the input stream of the
      connector object.
      hr = Serializer->Init(_variant_t((IUnknown*)Connector-

      // Build the SOAP Message.

      hr = Serializer->StartEnvelope("", "", "");
      // Serializer->SoapNamespace(L"xsi",
      // Serializer->SoapNamespace

      hr = Serializer->StartBody(L"");

      Serializer->StartElement(L"request", "", "", "");

      hr = Serializer->StartElement(L"WTAU1", "", "","");
      // Serializer->SoapNamespace
      ("", "http://www.waytech.com.cn/webservices/WTAU");
      hr = Serializer->StartElement(L"Module", "", "", "");

      hr = Serializer->StartElement(L"ProdType","","","");
      hr = Serializer->WriteString(L"003");
      hr = Serializer->EndElement();

      hr = Serializer->StartElement(L"ProdSubType","","","");
      hr = Serializer->WriteString(L"003.0001");
      hr = Serializer->EndElement();

      hr = Serializer->StartElement(L"Version","","","");
      hr = Serializer->WriteString(L"");

      hr = Serializer->StartElement(L"TimeStamp","","","");
      hr = Serializer->WriteString(L"2004 12 31 00:00:00");
      hr = Serializer->EndElement();

      hr = Serializer->StartElement(L"Name","","","");
      hr = Serializer->WriteString(L"RV.EXE");
      hr = Serializer->EndElement();

      hr = Serializer->StartElement(L"FileName","","","");
      hr = Serializer->WriteString(L"RV.EXE");
      hr = Serializer->EndElement();

      hr = Serializer->EndElement();
      hr = Serializer->EndElement();
      hr = Serializer->EndBody();
      hr = Serializer->EndEnvelope();

      // Send the message to the XML Web service.
      hr = Connector->EndMessage();

      // Read the response.
      hr = Reader.CreateInstance(__uuidof(SoapReader30));

      // Connect the reader to the output stream of the connector
      >OutputStream), "");

      // Display the result.
      printf("Answer: %s\n", (const char*)Reader->Dom->xml);

      int main()
      return 0;

      I use a protocol sniffer to capture the XML the app generate, the
      XML document I get is below:
      <?xml **UnReg**1.0" encoding="UTF-8" standalone="no"?>
      <SOAP-ENV:Envelope SOAP-ENV:encodingStyle=""


      <SOAP-ENV:Body SOAP-ENV:encodingStyle="">
      <request SOAP-ENV:encodingStyle="">
      <WTAU1 SOAP-ENV:encodingStyle="">
      <Module SOAP-ENV:encodingStyle="">
      <ProdType SOAP-ENV:encodingStyle="">003</ProdType>
      <ProdSubType SOAP-ENV:e**UnReg**yle="">003.0001</ProdSubType>
      <Version SOAP-ENV:encodingStyle=""></Version>
      <TimeStamp SOAP-ENV:encodingStyle="">2004 12 31 00:00:00</TimeStamp>
      <Name SOAP-ENV:encodingStyle="">RV.EXE</Name>
      <FileName SOAP-ENV:encodingStyle="">RV.EXE</FileName>

      you can see the first line is bad, and the node "ProdSubType" is
      destroyed, too.
      who can tell me how can i solve this problem??? It is very veryt
      emergent for me.
    Your message has been successfully submitted and would be delivered to recipients shortly.