Friday, November 2, 2012

Sample XML creator


//this is using the HTTP/HTML protocol
long file;
long i = 30000;

vuser_init()
{

      char * filename = "c:\\test\\sunlogfile.txt";

     
       int id;
       char * groupname;
       // Create a new file
       if ((file = fopen(filename, "w+" )) == NULL) {
              lr_output_message("Unable to create %s", filename);
              return -1;
       }
       // Write the Vuser id and group to the log file

fprintf(file,"<?xml version=\"1.0\" encoding=\"utf-8\"?>");
fprintf(file,"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:tns=\"http://Med_Lib_Service/ManageServiceParametersAllocationExtV2\" xmlns:man=\"http://telstra.oss.fal/ManageServiceParametersAllocationV2.xsd\">\n");
fprintf(file,"  <SOAP-ENV:Body>\n");
fprintf(file,"  <tns:UnReserveResources>\n");
fprintf(file,"  <UnreserveResourcesRequest>\n");
fprintf(file,"        <man:InternationalFormat>false</man:InternationalFormat>\n");
fprintf(file,"        <man:ResourceType>\n");
fprintf(file,"              <man:CommonName>IMSI</man:CommonName>\n");
fprintf(file,"              </man:ResourceType>\n");
fprintf(file,"        <man:Activity>USOS Unreserve</man:Activity>\n");

 

return 0;
}
------------------

Action()
{
//long i ;

// for(i=30000, i<39999, i++)
// {
fprintf(file,"        <man:Resource>\n");
fprintf(file,"             <man:ObjectID>5050100068");
fprintf(file,"%d",i);
fprintf(file,"</man:ObjectID>\n");
fprintf(file,"        </man:Resource>\n");
//    }

i=i+1;
return 0;
}
--------------------

vuser_end()
{

fprintf(file,"</UnreserveResourcesRequest>\n");
fprintf(file,"</tns:UnReserveResources>\n");
fprintf(file," </SOAP-ENV:Body>\n");
fprintf(file," </SOAP-ENV:Envelope>\n");

fclose(file);
return 0;

}


No comments:

Post a Comment