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"
      \
      exclude
      ("IStream", "IErrorInfo", "ISequentialStream", "_LARGE_INTEGER", \
      "_ULARGE_INTEGER", "tagSTATSTG", "_FILETIME")

      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"] =
      L"http://update.waytech.com.cn/Webservices/WTAU/WTAU.asmx?WSDL";
      hr = Connector->Connect();

      // Begin the message.
      Connector->Property["SoapAction"] =
      L"http://www.waytech.com.cn/webservices/WTAU/WTAU0";
      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-
      >InputStream));

      // Build the SOAP Message.

      hr = Serializer->StartEnvelope("", "", "");
      // Serializer->SoapNamespace(L"xsi",
      L"http://www.w3.org/2001/XMLSchema-instance");
      // Serializer->SoapNamespace
      (L"xsd",L"http://www.w3.org/2001/XMLSchema");

      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"1.0.0.0");
      Serializer->EndElement();

      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();
      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
      object.
      Reader->Load(_variant_t((IUnknown*)Connector-
      >OutputStream), "");

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

      int main()
      {
      CoInitialize(NULL);
      Get();
      CoUninitialize();
      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=""
      xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"

      xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"

      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
      <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="">1.0.0.0</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>
      </Module>
      </WTAU1>
      </request>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      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.