dll 소스 입니다
........................................................................................................................
// WebServiceClient.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#import "msxml4.dll"
using namespace MSXML2;
int SubmitDocument_0602();
int main(int argc, char* argv[])
{
int retVal = SubmitDocument_0602();
printf("%d\n", retVal);
return 0;
}
int SubmitDocument_0602()
{
printf("This is SubmitDocument function\n");
printf("SubmitDocument Function is called\n");
CoInitialize(NULL);
IXMLHTTPRequestPtr pIXMLHTTPRequest = NULL;
IXMLDOMDocumentPtr pIXMLDOMDocument = NULL;
HRESULT hr;
_bstr_t retString;
_bstr_t reqString;
reqString = L"<?xml version=\"1.0\" encoding=\"utf-8\"?>";
reqString += L"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">";
reqString += L"<soap:Body>";
reqString += L"<SubmitDocument_0602 xmlns=\"http://schema.skico.com/WEIS/SAP/SKICO_0602\">";
reqString += L"<SKICO_0602_Req>";
reqString += L"<IM_CARWGHT>";
reqString += L"<SHNUMBER>string</SHNUMBER>";
reqString += L"<MNGST>string</MNGST>";
reqString += L"<STSFD>string</STSFD>";
reqString += L"<VEHICLE>string</VEHICLE>";
reqString += L"<VWGHT>string</VWGHT>";
reqString += L"<VWGDT>string</VWGDT>";
reqString += L"<VWGTM>string</VWGTM>";
reqString += L"<MWGHT>string</MWGHT>";
reqString += L"<MWGDT>string</MWGDT>";
reqString += L"<MWGTM>string</MWGTM>";
reqString += L"<JWGHT>string</JWGHT>";
reqString += L"<JWGDT>string</JWGDT>";
reqString += L"<JWGTM>string</JWGTM>";
reqString += L"</IM_CARWGHT>";
reqString += L"</SKICO_0602_Req>";
reqString += L"</SubmitDocument_0602>";
reqString += L"</soap:Body>";
reqString += L"</soap:Envelope>";
try
{
hr = pIXMLHTTPRequest.CreateInstance(__uuidof(XMLHTTP40));
SUCCEEDED(hr) ? 0 : throw hr;
hr = pIXMLDOMDocument.CreateInstance(__uuidof(DOMDocument40));
SUCCEEDED(hr) ? 0 : throw hr;
// 전송하실 Data를 _bstr_t 타입으로 생성하셔서
// pIXMLDOMDocument->loadXML function을 이용해 주십시오.
// 전송하실 Data는 함께 드리는 워드 문서의 내용을 보신 후
// 해당 웹 사이트의 MsgBody를 참조하셔서 생성하시면 됩니다.
// request_109.xml 파일 또한 함께 첨부해 드리겠습니다.
if (pIXMLDOMDocument->loadXML(reqString) != VARIANT_TRUE)
{
return -1;
}
else
{
printf("XML Load Success\n%s\n", (LPCSTR) pIXMLDOMDocument->xml);
}
hr = pIXMLHTTPRequest->open("POST", "http://168.154.24.76/SKICO_0602/SKICO_0602.asmx");
SUCCEEDED(hr) ? 0 : throw hr;
char dataLength[10];
wsprintf(dataLength, "%d", (pIXMLDOMDocument->xml).length());
pIXMLHTTPRequest->setRequestHeader("SOAPAction", "http://schema.skico.com/WEIS/SAP/SKICO_0602/SKICO_0602/SubmitDocument_0602");
pIXMLHTTPRequest->setRequestHeader("Content-Type", "text/xml; charset=utf-8");
pIXMLHTTPRequest->setRequestHeader("Content-Length", dataLength);
pIXMLHTTPRequest->send(pIXMLDOMDocument->xml);
if (pIXMLHTTPRequest->status == 200 || pIXMLHTTPRequest->status == 202)
{
printf("Return Code: %d Success\n", pIXMLHTTPRequest->status);
}
else
{
printf("Return Code: %d Fail\n", pIXMLHTTPRequest->status);
}
retString = pIXMLHTTPRequest->responseText;
printf("%s\n", (LPCSTR) retString);
}
catch (...)
{
printf("Error Occurred\n");
}
if(pIXMLHTTPRequest)
pIXMLHTTPRequest.Release();
if(pIXMLDOMDocument)
pIXMLDOMDocument.Release();
CoUninitialize();
return 0;
}
......................................