我有一些问题,我想通过网络服务发送此信息。我的程序正在使用MFC 6.0。除了这个UploadStripMapping还有其他几个功能,其他功能也很好用。不知何故,我在这里有一些问题,这些数据没有在服务器的日志中捕获。但是,如果我使用错误的XML格式发送数据,那么服务器将回复格式错误。
以下是我想发送的声明:
<?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <UploadStripMapping xmlns="http://tempuri.org/"> <strXML><?xml version="1.0" encoding="utf-8"?>
<root>
<info>
<StripID>1234ABDD</StripID>
<LotID>B Version</LotID>
<Rows>18</Rows>
<Columns>48</Columns>
<Panels>4</Panels>
<MachineID>3RD019</MachineID>
<DateCreated>2016-07-04 13:27:43</DateCreated>
</info>
<Mapping>
<Col1>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col1>
<Col2>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col2>
<Col3>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col3>
<Col4>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col4>
<Col5>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col5>
<Col6>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col6>
<Col7>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col7>
<Col8>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col8>
<Col9>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col9>
<Col10>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col10>
<Col11>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col11>
<Col12>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col12>
<Col13>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col13>
<Col14>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col14>
<Col15>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col15>
<Col16>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col16>
<Col17>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col17>
<Col18>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col18>
<Col19>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col19>
<Col20>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col20>
<Col21>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col21>
<Col22>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col22>
<Col23>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col23>
<Col24>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col24>
<Col25>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col25>
<Col26>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col26>
<Col27>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col27>
<Col28>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col28>
<Col29>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col29>
<Col30>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col30>
<Col31>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col31>
<Col32>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col32>
<Col33>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col33>
<Col34>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col34>
<Col35>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col35>
<Col36>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col36>
<Col37>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col37>
<Col38>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col38>
<Col39>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col39>
<Col40>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col40>
<Col41>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col41>
<Col42>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col42>
<Col43>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col43>
<Col44>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col44>
<Col45>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col45>
<Col46>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col46>
<Col47>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col47>
<Col48>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Col48>
</Mapping>
</root></strXML> </UploadStripMapping> </soap12:Body> </soap12:Envelope>
以下是我在程序中编写send语句的方法,上面的数据我设置为strXML:
HTTPMethod = _bstr_t( "POST" );
httpReq->open(HTTPMethod, HTTPUrl, _variant_t(VARIANT_FALSE), _variant_t(), _variant_t());
httpReq->setRequestHeader("Content-Type", "application/soap+xml");
szRequest.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?> \ <soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\"> \
<soap12:Body>\
<UploadStripMapping xmlns=\"http://tempuri.org/\"> \
<strXML>\ %s \ </strXML>\
</UploadStripMapping>\
</soap12:Body>\
</soap12:Envelope>", strXML);
vRequest.vt = VT_BSTR;
vRequest.bstrVal = szRequest.AllocSysString();
httpReq->send(vRequest);
bsResponse = httpReq->responseText;
任何人都可以提供一些建议或在此代码中指出我的错误吗?感谢您的帮助。